Class renaming.

DRAWSEGMENT  -> PCB_SHAPE
EDGE_MODULE  -> FP_SHAPE
TEXTE_PCB    -> PCB_TEXT
TEXTE_MODULE -> FP_TEXT
This commit is contained in:
Jeff Young 2020-10-05 00:34:59 +01:00
parent a28a0e14ba
commit 37906511f5
142 changed files with 1763 additions and 1870 deletions

View File

@ -40,8 +40,8 @@
#include <class_track.h>
#include <wx/gdicmn.h>
#include <pcb_base_frame.h>
#include <class_pcb_text.h>
#include <class_drawsegment.h>
#include <pcb_text.h>
#include <pcb_shape.h>
#include <class_dimension.h>
#include <class_zone.h>
#include <class_module.h>
@ -560,12 +560,12 @@ class BOARD_ADAPTER
PCB_LAYER_ID aLayerId,
int aInflateValue );
void AddShapeWithClearanceToContainer( const TEXTE_PCB *aTextPCB,
void AddShapeWithClearanceToContainer( const PCB_TEXT *aText,
CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId,
int aClearanceValue );
void AddShapeWithClearanceToContainer( const DRAWSEGMENT *aDrawSegment,
void AddShapeWithClearanceToContainer( const PCB_SHAPE *aShape,
CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId,
int aClearanceValue );

View File

@ -38,10 +38,10 @@
#include <class_board.h>
#include <class_module.h>
#include <class_pad.h>
#include <class_pcb_text.h>
#include <class_edge_mod.h>
#include <pcb_text.h>
#include <fp_shape.h>
#include <class_zone.h>
#include <class_text_mod.h>
#include <fp_text.h>
#include <convert_basic_shapes_to_polygon.h>
#include <trigo.h>
#include <geometry/shape_segment.h>
@ -81,9 +81,9 @@ void addTextSegmToContainer( int x0, int y0, int xf, int yf, void* aData )
// Based on
// void TEXTE_PCB::TransformShapeWithClearanceToPolygon
// void PCB_TEXT::TransformShapeWithClearanceToPolygon
// board_items_to_polygon_shape_transform.cpp
void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const TEXTE_PCB* aText,
void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const PCB_TEXT* aText,
CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId,
int aClearanceValue )
@ -190,16 +190,16 @@ void BOARD_ADAPTER::AddGraphicsShapesWithClearanceToContainer( const MODULE* aMo
PCB_LAYER_ID aLayerId,
int aInflateValue )
{
std::vector<TEXTE_MODULE *> texts; // List of TEXTE_MODULE to convert
EDGE_MODULE* outline;
std::vector<FP_TEXT*> texts; // List of FP_TEXT to convert
FP_SHAPE* outline;
for( auto item : aModule->GraphicalItems() )
for( BOARD_ITEM* item : aModule->GraphicalItems() )
{
switch( item->Type() )
{
case PCB_FP_TEXT_T:
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
FP_TEXT* text = static_cast<FP_TEXT*>( item );
if( text->GetLayer() == aLayerId && text->IsVisible() )
texts.push_back( text );
@ -209,13 +209,12 @@ void BOARD_ADAPTER::AddGraphicsShapesWithClearanceToContainer( const MODULE* aMo
case PCB_FP_SHAPE_T:
{
outline = (EDGE_MODULE*) item;
outline = (FP_SHAPE*) item;
if( outline->GetLayer() != aLayerId )
break;
AddShapeWithClearanceToContainer( (const DRAWSEGMENT *)outline,
aDstContainer,
AddShapeWithClearanceToContainer( (const PCB_SHAPE*) outline, aDstContainer,
aLayerId, 0 );
}
break;
@ -236,7 +235,7 @@ void BOARD_ADAPTER::AddGraphicsShapesWithClearanceToContainer( const MODULE* aMo
s_dstcontainer = aDstContainer;
s_biuTo3Dunits = m_biuTo3Dunits;
for( TEXTE_MODULE* text : texts )
for( FP_TEXT* text : texts )
{
s_textWidth = text->GetEffectiveTextPenWidth() + ( 2 * aInflateValue );
wxSize size = text->GetTextSize();
@ -626,7 +625,7 @@ void BOARD_ADAPTER::TransformArcToSegments( const wxPoint &aCentre,
// Based on
// TransformShapeWithClearanceToPolygon
// board_items_to_polygon_shape_transform.cpp#L431
void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const DRAWSEGMENT* aDrawSegment,
void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const PCB_SHAPE* aDrawSegment,
CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId,
int aClearanceValue )

View File

@ -38,8 +38,8 @@
#include <class_board.h>
#include <class_module.h>
#include <class_pad.h>
#include <class_pcb_text.h>
#include <class_edge_mod.h>
#include <pcb_text.h>
#include <fp_shape.h>
#include <class_zone.h>
#include <convert_basic_shapes_to_polygon.h>
#include <trigo.h>
@ -636,7 +636,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
{
case PCB_SHAPE_T:
{
AddShapeWithClearanceToContainer( (DRAWSEGMENT*)item,
AddShapeWithClearanceToContainer( (PCB_SHAPE*)item,
layerContainer,
curr_layer_id,
0 );
@ -644,7 +644,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
break;
case PCB_TEXT_T:
AddShapeWithClearanceToContainer( (TEXTE_PCB*) item,
AddShapeWithClearanceToContainer( (PCB_TEXT*) item,
layerContainer,
curr_layer_id,
0 );
@ -688,12 +688,12 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
switch( item->Type() )
{
case PCB_SHAPE_T:
( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon( *layerPoly,
cur_layer_id, 0 );
( (PCB_SHAPE*) item )->TransformShapeWithClearanceToPolygon( *layerPoly,
cur_layer_id, 0 );
break;
case PCB_TEXT_T:
( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet( *layerPoly, 0 );
( (PCB_TEXT*) item )->TransformShapeWithClearanceToPolygonSet( *layerPoly, 0 );
break;
default:
@ -933,14 +933,14 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
switch( item->Type() )
{
case PCB_SHAPE_T:
AddShapeWithClearanceToContainer( (DRAWSEGMENT*)item,
AddShapeWithClearanceToContainer( (PCB_SHAPE*) item,
layerContainer,
curr_layer_id,
0 );
break;
case PCB_TEXT_T:
AddShapeWithClearanceToContainer( (TEXTE_PCB*) item,
AddShapeWithClearanceToContainer( (PCB_TEXT*) item,
layerContainer,
curr_layer_id,
0 );
@ -971,12 +971,12 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
switch( item->Type() )
{
case PCB_SHAPE_T:
( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon( *layerPoly,
curr_layer_id, 0 );
( (PCB_SHAPE*) item )->TransformShapeWithClearanceToPolygon( *layerPoly,
curr_layer_id, 0 );
break;
case PCB_TEXT_T:
( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet( *layerPoly, 0 );
( (PCB_TEXT*) item )->TransformShapeWithClearanceToPolygonSet( *layerPoly, 0 );
break;
default:

View File

@ -30,7 +30,7 @@
#include "board_adapter.h"
#include <convert_basic_shapes_to_polygon.h>
#include <class_edge_mod.h>
#include <fp_shape.h>
#include <class_module.h>
@ -67,7 +67,7 @@ void BOARD_ADAPTER::transformGraphicModuleEdgeToPolygonSet( const MODULE *aModul
{
if( item->Type() == PCB_FP_SHAPE_T )
{
EDGE_MODULE* outline = (EDGE_MODULE*) item;
FP_SHAPE* outline = (FP_SHAPE*) item;
if( outline->GetLayer() == aLayer )
outline->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, 0 );

View File

@ -235,7 +235,7 @@ As an example:
modifiedItem->Move( x, y );
// create a new item
DRAWSEGMENT* newItem = new DRAWSEGMENT;
PCB_SHAPE* newItem = new PCB_SHAPE;
// ... set up item here
@ -516,7 +516,7 @@ Below you will find the contents of useless_tool.cpp:
int USELESS_TOOL::fixedCircle( const TOOL_EVENT& aEvent )
{
// new circle to add (ideally use a smart pointer)
DRAWSEGMENT* circle = new DRAWSEGMENT;
PCB_SHAPE* circle = new PCB_SHAPE;
// Set the circle attributes
circle->SetShape( S_CIRCLE );

View File

@ -492,8 +492,8 @@ set( PCB_COMMON_SRCS
${CMAKE_SOURCE_DIR}/pcbnew/class_board.cpp
${CMAKE_SOURCE_DIR}/pcbnew/class_board_item.cpp
${CMAKE_SOURCE_DIR}/pcbnew/class_dimension.cpp
${CMAKE_SOURCE_DIR}/pcbnew/class_drawsegment.cpp
${CMAKE_SOURCE_DIR}/pcbnew/class_edge_mod.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_shape.cpp
${CMAKE_SOURCE_DIR}/pcbnew/fp_shape.cpp
${CMAKE_SOURCE_DIR}/pcbnew/class_pcb_group.cpp
${CMAKE_SOURCE_DIR}/pcbnew/class_marker_pcb.cpp
${CMAKE_SOURCE_DIR}/pcbnew/class_module.cpp
@ -501,9 +501,9 @@ set( PCB_COMMON_SRCS
${CMAKE_SOURCE_DIR}/pcbnew/netinfo_list.cpp
${CMAKE_SOURCE_DIR}/pcbnew/class_pad.cpp
${CMAKE_SOURCE_DIR}/pcbnew/class_pcb_target.cpp
${CMAKE_SOURCE_DIR}/pcbnew/class_pcb_text.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_text.cpp
${CMAKE_SOURCE_DIR}/pcbnew/board_stackup_manager/class_board_stackup.cpp
${CMAKE_SOURCE_DIR}/pcbnew/class_text_mod.cpp
${CMAKE_SOURCE_DIR}/pcbnew/fp_text.cpp
${CMAKE_SOURCE_DIR}/pcbnew/class_track.cpp
${CMAKE_SOURCE_DIR}/pcbnew/class_zone.cpp
${CMAKE_SOURCE_DIR}/pcbnew/collectors.cpp

View File

@ -497,8 +497,6 @@ EATTR::EATTR( wxXmlNode* aTree )
y = parseOptionalAttribute<ECOORD>( aTree, "y" );
size = parseOptionalAttribute<ECOORD>( aTree, "size" );
// KiCad cannot currently put a TEXTE_MODULE on a different layer than the MODULE
// Eagle can it seems.
layer = parseOptionalAttribute<int>( aTree, "layer" );
ratio = parseOptionalAttribute<double>( aTree, "ratio" );
rot = parseOptionalAttribute<EROT>( aTree, "rot" );

View File

@ -26,8 +26,8 @@
#include <hash_eda.h>
#include <class_module.h>
#include <class_text_mod.h>
#include <class_edge_mod.h>
#include <fp_text.h>
#include <fp_shape.h>
#include <class_pad.h>
#include <functional>
@ -105,12 +105,12 @@ size_t hash_eda( const EDA_ITEM* aItem, int aFlags )
case PCB_FP_TEXT_T:
{
const TEXTE_MODULE* text = static_cast<const TEXTE_MODULE*>( aItem );
const FP_TEXT* text = static_cast<const FP_TEXT*>( aItem );
if( !( aFlags & HASH_REF ) && text->GetType() == TEXTE_MODULE::TEXT_is_REFERENCE )
if( !( aFlags & HASH_REF ) && text->GetType() == FP_TEXT::TEXT_is_REFERENCE )
break;
if( !( aFlags & HASH_VALUE ) && text->GetType() == TEXTE_MODULE::TEXT_is_VALUE )
if( !( aFlags & HASH_VALUE ) && text->GetType() == FP_TEXT::TEXT_is_VALUE )
break;
ret = hash_board_item( text, aFlags );
@ -138,7 +138,7 @@ size_t hash_eda( const EDA_ITEM* aItem, int aFlags )
case PCB_FP_SHAPE_T:
{
const EDGE_MODULE* segment = static_cast<const EDGE_MODULE*>( aItem );
const FP_SHAPE* segment = static_cast<const FP_SHAPE*>( aItem );
ret = hash_board_item( segment, aFlags );
hash_combine( ret, segment->GetType() );
hash_combine( ret, segment->GetShape() );

View File

@ -88,10 +88,10 @@ enum KICAD_T
// Items in pcb
PCB_MODULE_T, ///< class MODULE, a footprint
PCB_PAD_T, ///< class D_PAD, a pad in a footprint
PCB_SHAPE_T, ///< class DRAWSEGMENT, a segment not on copper layers
PCB_TEXT_T, ///< class TEXTE_PCB, text on a layer
PCB_FP_TEXT_T, ///< class TEXTE_MODULE, text in a footprint
PCB_FP_SHAPE_T, ///< class EDGE_MODULE, a footprint edge
PCB_SHAPE_T, ///< class PCB_SHAPE, a segment not on copper layers
PCB_TEXT_T, ///< class PCB_TEXT, text on a layer
PCB_FP_TEXT_T, ///< class FP_TEXT, text in a footprint
PCB_FP_SHAPE_T, ///< class FP_SHAPE, a footprint edge
PCB_FP_ZONE_AREA_T, ///< class ZONE_CONTAINER, managed by a footprint
PCB_TRACE_T, ///< class TRACK, a track segment (segment on a copper layer)
PCB_VIA_T, ///< class VIA, a via (like a track segment on a copper layer)

View File

@ -53,7 +53,6 @@ class COLOR_SETTINGS;
class MODULE;
class TRACK;
class D_PAD;
class TEXTE_MODULE;
class EDA_3D_VIEWER;
class GENERAL_COLLECTOR;
class GENERAL_COLLECTORS_GUIDE;

View File

@ -474,8 +474,8 @@ if( KICAD_SCRIPTING ) # Generate pcbnew.py and pcbnew_wrap.cxx using swig
DEPENDS swig/board_item_container.i
DEPENDS swig/connectivity.i
DEPENDS swig/dimension.i
DEPENDS swig/drawsegment.i
DEPENDS swig/edge_mod.i
DEPENDS swig/pcb_shape.i
DEPENDS swig/fp_shape.i
DEPENDS swig/marker_pcb.i
DEPENDS swig/pcb_target.i
DEPENDS swig/pcb_plot_params.i
@ -484,7 +484,7 @@ if( KICAD_SCRIPTING ) # Generate pcbnew.py and pcbnew_wrap.cxx using swig
DEPENDS swig/pad.i
DEPENDS swig/pcb_text.i
DEPENDS swig/plugins.i
DEPENDS swig/text_mod.i
DEPENDS swig/fp_text.i
DEPENDS swig/track.i
DEPENDS swig/units.i
DEPENDS swig/typeinfo.i

View File

@ -32,7 +32,7 @@
#include <class_board.h>
#include <class_module.h>
#include <class_track.h>
#include <class_drawsegment.h>
#include <pcb_shape.h>
#include <class_pad.h>
#include <board_commit.h>
#include <connectivity/connectivity_data.h>
@ -136,7 +136,7 @@ int AR_AUTOPLACER::genPlacementRoutingMatrix()
case PCB_SHAPE_T:
if( drawing->GetLayer() != Edge_Cuts )
{
m_matrix.TraceSegmentPcb( (DRAWSEGMENT*)drawing, CELL_IS_HOLE | CELL_IS_EDGE,
m_matrix.TraceSegmentPcb( (PCB_SHAPE*) drawing, CELL_IS_HOLE | CELL_IS_EDGE,
m_matrix.m_GridRouting, AR_MATRIX::WRITE_CELL );
}
break;

View File

@ -30,7 +30,7 @@
#include <math_for_graphics.h>
#include <trigo.h>
#include <class_drawsegment.h>
#include <pcb_shape.h>
#include <class_pad.h>
AR_MATRIX::AR_MATRIX()
@ -762,8 +762,8 @@ void AR_MATRIX::TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, LSET a
}
void AR_MATRIX::TraceSegmentPcb(
DRAWSEGMENT* pt_segm, int color, int marge, AR_MATRIX::CELL_OP op_logic )
void AR_MATRIX::TraceSegmentPcb( PCB_SHAPE* pt_segm, int color, int marge,
AR_MATRIX::CELL_OP op_logic )
{
int half_width = ( pt_segm->GetWidth() / 2 ) + marge;

View File

@ -32,7 +32,7 @@
#include <eda_rect.h>
#include <layers_id_colors_and_visibility.h>
class DRAWSEGMENT;
class PCB_SHAPE;
class TRACK;
class D_PAD;
class MODULE;
@ -130,7 +130,7 @@ public:
DIST_CELL GetDist( int aRow, int aCol, int aSide );
void SetDist( int aRow, int aCol, int aSide, DIST_CELL );
void TraceSegmentPcb( DRAWSEGMENT* pt_segm, int color, int marge, AR_MATRIX::CELL_OP op_logic );
void TraceSegmentPcb( PCB_SHAPE* pt_segm, int color, int marge, AR_MATRIX::CELL_OP op_logic );
void CreateKeepOutRectangle(
int ux0, int uy0, int ux1, int uy1, int marge, int aKeepOut, LSET aLayerMask );
void PlacePad( D_PAD* aPad, int color, int marge, AR_MATRIX::CELL_OP op_logic );

View File

@ -193,10 +193,10 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
if( boardItem->Type() == PCB_FP_TEXT_T )
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( boardItem );
FP_TEXT* text = static_cast<FP_TEXT*>( boardItem );
// don't allow deletion of Reference or Value
if( text->GetType() != TEXTE_MODULE::TEXT_is_DIVERS )
if( text->GetType() != FP_TEXT::TEXT_is_DIVERS )
break;
}

View File

@ -31,11 +31,11 @@
#include <class_board.h>
#include <class_pad.h>
#include <class_track.h>
#include <class_drawsegment.h>
#include <class_pcb_text.h>
#include <pcb_shape.h>
#include <pcb_text.h>
#include <class_zone.h>
#include <class_module.h>
#include <class_edge_mod.h>
#include <fp_shape.h>
#include <convert_basic_shapes_to_polygon.h>
#include <geometry/geometry_utils.h>
#include <geometry/shape_segment.h>
@ -98,11 +98,11 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_
switch( item->Type() )
{
case PCB_SHAPE_T:
( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon( aOutlines, aLayer, 0 );
( (PCB_SHAPE*) item )->TransformShapeWithClearanceToPolygon( aOutlines, aLayer, 0 );
break;
case PCB_TEXT_T:
( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet( aOutlines, 0 );
( (PCB_TEXT*) item )->TransformShapeWithClearanceToPolygonSet( aOutlines, 0 );
break;
default:
@ -216,13 +216,13 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet( PCB_LAYER_ID aLaye
bool aIncludeText,
bool aIncludeEdges ) const
{
std::vector<TEXTE_MODULE *> texts; // List of TEXTE_MODULE to convert
std::vector<FP_TEXT*> texts; // List of FP_TEXT to convert
for( auto item : GraphicalItems() )
{
if( item->Type() == PCB_FP_TEXT_T && aIncludeText )
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
FP_TEXT* text = static_cast<FP_TEXT*>( item );
if( aLayer != UNDEFINED_LAYER && text->GetLayer() == aLayer && text->IsVisible() )
texts.push_back( text );
@ -230,7 +230,7 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet( PCB_LAYER_ID aLaye
if( item->Type() == PCB_FP_SHAPE_T && aIncludeEdges )
{
EDGE_MODULE* outline = (EDGE_MODULE*) item;
FP_SHAPE* outline = static_cast<FP_SHAPE*>( item );
if( aLayer != UNDEFINED_LAYER && outline->GetLayer() == aLayer )
outline->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, 0, aError );
@ -248,7 +248,7 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet( PCB_LAYER_ID aLaye
prms.m_cornerBuffer = &aCornerBuffer;
for( TEXTE_MODULE* textmod : texts )
for( FP_TEXT* textmod : texts )
{
bool forceBold = true;
int penWidth = 0; // force max width for bold text
@ -338,8 +338,8 @@ void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( SHAPE_POLY_SET* aCorn
* @aClearanceValue = the clearance around the text
* @aError = the maximum error to allow when approximating curves
*/
void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet( SHAPE_POLY_SET& aCornerBuffer,
int aClearanceValue, int aError ) const
void PCB_TEXT::TransformShapeWithClearanceToPolygonSet( SHAPE_POLY_SET& aCornerBuffer,
int aClearanceValue, int aError ) const
{
wxSize size = GetTextSize();
@ -377,10 +377,10 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet( SHAPE_POLY_SET& aCorner
}
void DRAWSEGMENT::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer,
int aClearanceValue, int aError,
bool ignoreLineWidth ) const
void PCB_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer,
int aClearanceValue, int aError,
bool ignoreLineWidth ) const
{
int width = ignoreLineWidth ? 0 : m_Width;
@ -494,7 +494,7 @@ void DRAWSEGMENT::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerB
break;
default:
wxFAIL_MSG( "DRAWSEGMENT::TransformShapeWithClearanceToPolygon no implementation for "
wxFAIL_MSG( "PCB_SHAPE::TransformShapeWithClearanceToPolygon no implementation for "
+ PCB_SHAPE_TYPE_T_asString( m_Shape ) );
break;
}

View File

@ -36,7 +36,6 @@
#include <class_track.h>
#include <class_zone.h>
#include <class_marker_pcb.h>
#include <class_drawsegment.h>
#include <class_pcb_target.h>
#include <connectivity/connectivity_data.h>
#include <pgm_base.h>

View File

@ -29,7 +29,7 @@
#include <base_units.h>
#include <class_board.h>
#include <class_dimension.h>
#include <class_pcb_text.h>
#include <pcb_text.h>
#include <geometry/shape_circle.h>
#include <geometry/shape_rect.h>
#include <geometry/shape_segment.h>
@ -312,10 +312,10 @@ void DIMENSION::SetEnd( const wxPoint& aEnd )
void DIMENSION::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{
// for now, display only the text within the DIMENSION using class TEXTE_PCB.
// for now, display only the text within the DIMENSION using class PCB_TEXT.
wxString msg;
wxCHECK_RET( m_Parent != NULL, wxT( "TEXTE_PCB::GetMsgPanelInfo() m_Parent is NULL." ) );
wxCHECK_RET( m_Parent != NULL, wxT( "PCB_TEXT::GetMsgPanelInfo() m_Parent is NULL." ) );
aList.emplace_back( _( "Dimension" ), m_text.GetShownText(), DARKGREEN );

View File

@ -32,12 +32,11 @@
#include <class_board_item.h>
#include <class_pcb_text.h>
#include <pcb_text.h>
#include <geometry/shape.h>
class LINE_READER;
class TEXTE_PCB;
class MSG_PANEL_ITEM;
@ -217,8 +216,8 @@ public:
*/
const wxString GetText() const;
TEXTE_PCB& Text() { return m_text; }
TEXTE_PCB& Text() const { return *( const_cast<TEXTE_PCB*> ( &m_text ) ); }
PCB_TEXT& Text() { return m_text; }
PCB_TEXT& Text() const { return *( const_cast<PCB_TEXT*> ( &m_text ) ); }
/**
* @return a list of line segments that make up this dimension (for drawing, plotting, etc)
@ -305,7 +304,7 @@ protected:
bool m_keepTextAligned; ///< Calculate text orientation to match dimension
// Internal
TEXTE_PCB m_text; ///< The actual text object
PCB_TEXT m_text; ///< The actual text object
int m_measuredValue; ///< value of PCB dimensions
wxPoint m_start;
wxPoint m_end;

View File

@ -30,7 +30,7 @@
#include <unordered_set>
#include <pcb_edit_frame.h>
#include <class_board.h>
#include <class_edge_mod.h>
#include <fp_shape.h>
#include <class_module.h>
#include <view/view.h>
#include <geometry/shape_null.h>
@ -56,8 +56,8 @@ MODULE::MODULE( BOARD* parent ) :
m_ThermalGap = 0; // Use zone setting by default
// These are special and mandatory text fields
m_Reference = new TEXTE_MODULE( this, TEXTE_MODULE::TEXT_is_REFERENCE );
m_Value = new TEXTE_MODULE( this, TEXTE_MODULE::TEXT_is_VALUE );
m_Reference = new FP_TEXT( this, FP_TEXT::TEXT_is_REFERENCE );
m_Value = new FP_TEXT( this, FP_TEXT::TEXT_is_VALUE );
m_3D_Drawings.clear();
}
@ -87,9 +87,9 @@ MODULE::MODULE( const MODULE& aModule ) :
m_ThermalGap = aModule.m_ThermalGap;
// Copy reference and value.
m_Reference = new TEXTE_MODULE( *aModule.m_Reference );
m_Reference = new FP_TEXT( *aModule.m_Reference );
m_Reference->SetParent( this );
m_Value = new TEXTE_MODULE( *aModule.m_Value );
m_Value = new FP_TEXT( *aModule.m_Value );
m_Value->SetParent( this );
std::map<BOARD_ITEM*, BOARD_ITEM*> ptrMap;
@ -433,7 +433,7 @@ void MODULE::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
{
case PCB_FP_TEXT_T:
// Only user text can be added this way.
assert( static_cast<TEXTE_MODULE*>( aBoardItem )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS );
assert( static_cast<FP_TEXT*>( aBoardItem )->GetType() == FP_TEXT::TEXT_is_DIVERS );
KI_FALLTHROUGH;
case PCB_FP_SHAPE_T:
@ -487,7 +487,7 @@ void MODULE::Remove( BOARD_ITEM* aBoardItem )
case PCB_FP_TEXT_T:
// Only user text can be removed this way.
wxCHECK_RET(
static_cast<TEXTE_MODULE*>( aBoardItem )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS,
static_cast<FP_TEXT*>( aBoardItem )->GetType() == FP_TEXT::TEXT_is_DIVERS,
"Please report this bug: Invalid remove operation on required text" );
KI_FALLTHROUGH;
@ -1236,7 +1236,7 @@ void MODULE::Rotate( const wxPoint& aRotCentre, double aAngle )
for( BOARD_ITEM* item : m_drawings )
{
if( item->Type() == PCB_FP_TEXT_T )
static_cast<TEXTE_MODULE*>( item )->KeepUpright( orientation, newOrientation );
static_cast<FP_TEXT*>( item )->KeepUpright( orientation, newOrientation );
}
}
@ -1286,11 +1286,11 @@ void MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
switch( item->Type() )
{
case PCB_FP_SHAPE_T:
static_cast<EDGE_MODULE*>( item )->Flip( m_Pos, false );
static_cast<FP_SHAPE*>( item )->Flip( m_Pos, false );
break;
case PCB_FP_TEXT_T:
static_cast<TEXTE_MODULE*>( item )->Flip( m_Pos, false );
static_cast<FP_TEXT*>( item )->Flip( m_Pos, false );
break;
default:
@ -1330,14 +1330,14 @@ void MODULE::SetPosition( const wxPoint& aPos )
{
case PCB_FP_SHAPE_T:
{
EDGE_MODULE* pt_edgmod = (EDGE_MODULE*) item;
pt_edgmod->SetDrawCoord();
FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
shape->SetDrawCoord();
break;
}
case PCB_FP_TEXT_T:
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
FP_TEXT* text = static_cast<FP_TEXT*>( item );
text->EDA_TEXT::Offset( delta );
break;
}
@ -1387,14 +1387,14 @@ void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector )
{
case PCB_FP_SHAPE_T:
{
EDGE_MODULE* edge = static_cast<EDGE_MODULE*>( item );
edge->Move( moveVector );
FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
shape->Move( moveVector );
}
break;
case PCB_FP_TEXT_T:
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
FP_TEXT* text = static_cast<FP_TEXT*>( item );
text->SetPos0( text->GetPos0() + moveVector );
text->SetDrawCoord();
}
@ -1437,11 +1437,11 @@ void MODULE::SetOrientation( double aNewAngle )
{
if( item->Type() == PCB_FP_SHAPE_T )
{
static_cast<EDGE_MODULE*>( item )->SetDrawCoord();
static_cast<FP_SHAPE*>( item )->SetDrawCoord();
}
else if( item->Type() == PCB_FP_TEXT_T )
{
static_cast<TEXTE_MODULE*>( item )->SetDrawCoord();
static_cast<FP_TEXT*>( item )->SetDrawCoord();
}
}
}
@ -1494,18 +1494,18 @@ BOARD_ITEM* MODULE::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToModule )
case PCB_FP_TEXT_T:
{
TEXTE_MODULE* new_text = new TEXTE_MODULE( *static_cast<const TEXTE_MODULE*>( aItem ) );
FP_TEXT* new_text = new FP_TEXT( *static_cast<const FP_TEXT*>( aItem ) );
const_cast<KIID&>( new_text->m_Uuid ) = KIID();
if( new_text->GetType() == TEXTE_MODULE::TEXT_is_REFERENCE )
if( new_text->GetType() == FP_TEXT::TEXT_is_REFERENCE )
{
new_text->SetText( wxT( "${REFERENCE}" ) );
new_text->SetType( TEXTE_MODULE::TEXT_is_DIVERS );
new_text->SetType( FP_TEXT::TEXT_is_DIVERS );
}
else if( new_text->GetType() == TEXTE_MODULE::TEXT_is_VALUE )
else if( new_text->GetType() == FP_TEXT::TEXT_is_VALUE )
{
new_text->SetText( wxT( "${VALUE}" ) );
new_text->SetType( TEXTE_MODULE::TEXT_is_DIVERS );
new_text->SetType( FP_TEXT::TEXT_is_DIVERS );
}
if( aAddToModule )
@ -1518,13 +1518,13 @@ BOARD_ITEM* MODULE::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToModule )
case PCB_FP_SHAPE_T:
{
EDGE_MODULE* new_edge = new EDGE_MODULE( *static_cast<const EDGE_MODULE*>( aItem ) );
const_cast<KIID&>( new_edge->m_Uuid ) = KIID();
FP_SHAPE* new_shape = new FP_SHAPE( *static_cast<const FP_SHAPE*>( aItem ) );
const_cast<KIID&>( new_shape->m_Uuid ) = KIID();
if( aAddToModule )
Add( new_edge );
Add( new_shape );
new_item = new_edge;
new_item = new_shape;
break;
}
@ -1656,8 +1656,8 @@ double MODULE::CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const
// see convert_drawsegment_list_to_polygon.cpp:
extern bool ConvertOutlineToPolygon( std::vector<DRAWSEGMENT*>& aSegList, SHAPE_POLY_SET& aPolygons,
wxString* aErrorText, unsigned int aTolerance, wxPoint* aErrorLocation = nullptr );
extern bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET& aPolygons,
wxString* aErrorText, unsigned int aTolerance, wxPoint* aErrorLocation = nullptr );
std::shared_ptr<SHAPE> MODULE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
@ -1675,16 +1675,16 @@ bool MODULE::BuildPolyCourtyard()
// Build the courtyard area from graphic items on the courtyard.
// Only PCB_FP_SHAPE_T have meaning, graphic texts are ignored.
// Collect items:
std::vector< DRAWSEGMENT* > list_front;
std::vector< DRAWSEGMENT* > list_back;
std::vector<PCB_SHAPE*> list_front;
std::vector<PCB_SHAPE*> list_back;
for( BOARD_ITEM* item : GraphicalItems() )
{
if( item->GetLayer() == B_CrtYd && item->Type() == PCB_FP_SHAPE_T )
list_back.push_back( static_cast< DRAWSEGMENT* > ( item ) );
list_back.push_back( static_cast<PCB_SHAPE*>( item ) );
if( item->GetLayer() == F_CrtYd && item->Type() == PCB_FP_SHAPE_T )
list_front.push_back( static_cast< DRAWSEGMENT* > ( item ) );
list_front.push_back( static_cast<PCB_SHAPE*>( item ) );
}
// Note: if no item found on courtyard layers, return true.
@ -1748,8 +1748,8 @@ bool MODULE::cmp_drawings::operator()( const BOARD_ITEM* aFirst, const BOARD_ITE
if( aFirst->Type() == PCB_FP_SHAPE_T )
{
const EDGE_MODULE* dwgA = static_cast<const EDGE_MODULE*>( aFirst );
const EDGE_MODULE* dwgB = static_cast<const EDGE_MODULE*>( aSecond );
const FP_SHAPE* dwgA = static_cast<const FP_SHAPE*>( aFirst );
const FP_SHAPE* dwgB = static_cast<const FP_SHAPE*>( aSecond );
if( dwgA->GetShape() != dwgB->GetShape() )
return dwgA->GetShape() < dwgB->GetShape();

View File

@ -36,7 +36,7 @@
#include <list>
#include "zones.h"
#include <class_text_mod.h>
#include <fp_text.h>
#include <class_zone.h>
#include <functional>
@ -470,12 +470,12 @@ public:
}
/// read/write accessors:
TEXTE_MODULE& Value() { return *m_Value; }
TEXTE_MODULE& Reference() { return *m_Reference; }
FP_TEXT& Value() { return *m_Value; }
FP_TEXT& Reference() { return *m_Reference; }
/// The const versions to keep the compiler happy.
TEXTE_MODULE& Value() const { return *m_Value; }
TEXTE_MODULE& Reference() const { return *m_Reference; }
FP_TEXT& Value() const { return *m_Value; }
FP_TEXT& Reference() const { return *m_Reference; }
const std::map<wxString, wxString>& GetProperties() const { return m_properties; }
void SetProperties( const std::map<wxString, wxString>& aProps ) { m_properties = aProps; }
@ -699,8 +699,8 @@ private:
double m_Orient; // Orientation in tenths of a degree, 900=90.0 degrees.
wxPoint m_Pos; // Position of module on the board in internal units.
TEXTE_MODULE* m_Reference; // Component reference designator value (U34, R18..)
TEXTE_MODULE* m_Value; // Component value (74LS00, 22K..)
FP_TEXT* m_Reference; // Component reference designator value (U34, R18..)
FP_TEXT* m_Value; // Component value (74LS00, 22K..)
LIB_ID m_fpid; // The #LIB_ID of the MODULE.
int m_Attributs; // Flag bits ( see Mod_Attribut )
int m_ModuleStatus; // For autoplace: flags (LOCKED, FIELDS_AUTOPLACED)

View File

@ -42,7 +42,7 @@
#include <view/view.h>
#include <class_board.h>
#include <class_module.h>
#include <class_drawsegment.h>
#include <pcb_shape.h>
#include <connectivity/connectivity_data.h>
#include <geometry/polygon_test_point_inside.h>
#include <convert_to_biu.h>
@ -407,7 +407,7 @@ void D_PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
if( GetShape() == PAD_SHAPE_CUSTOM )
{
for( const std::shared_ptr<DRAWSEGMENT>& primitive : m_editPrimitives )
for( const std::shared_ptr<PCB_SHAPE>& primitive : m_editPrimitives )
{
for( SHAPE* shape : primitive->MakeEffectiveShapes() )
{
@ -595,7 +595,7 @@ void D_PAD::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
// Flip (mirror) the basic shapes (primitives), in custom pads
void D_PAD::FlipPrimitives( bool aFlipLeftRight )
{
for( std::shared_ptr<DRAWSEGMENT>& primitive : m_editPrimitives )
for( std::shared_ptr<PCB_SHAPE>& primitive : m_editPrimitives )
primitive->Flip( wxPoint( 0, 0 ), aFlipLeftRight );
m_shapesDirty = true;

View File

@ -39,7 +39,7 @@
#include <pad_shapes.h>
#include <pcbnew.h>
class DRAWSEGMENT;
class PCB_SHAPE;
class PARAM_CFG;
class SHAPE;
class SHAPE_SEGMENT;
@ -53,7 +53,7 @@ enum CUST_PAD_SHAPE_IN_ZONE
class LINE_READER;
class EDA_3D_CANVAS;
class MODULE;
class EDGE_MODULE;
class FP_SHAPE;
class TRACK;
namespace KIGFX
@ -277,7 +277,7 @@ public:
/**
* Accessor to the basic shape list for custom-shaped pads.
*/
const std::vector<std::shared_ptr<DRAWSEGMENT>>& GetPrimitives() const
const std::vector<std::shared_ptr<PCB_SHAPE>>& GetPrimitives() const
{
return m_editPrimitives;
}
@ -294,18 +294,18 @@ public:
* Clear the current custom shape primitives list and import a new list. Copies the input,
* which is not altered.
*/
void ReplacePrimitives( const std::vector<std::shared_ptr<DRAWSEGMENT>>& aPrimitivesList );
void ReplacePrimitives( const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList );
/**
* Import a custom shape primites list (composed of basic shapes) and add items to the
* current list. Copies the input, which is not altered.
*/
void AppendPrimitives( const std::vector<std::shared_ptr<DRAWSEGMENT>>& aPrimitivesList );
void AppendPrimitives( const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList );
/**
* Add item to the custom shape primitives list
*/
void AddPrimitive( DRAWSEGMENT* aPrimitive );
void AddPrimitive( PCB_SHAPE* aPrimitive );
/**
* Function SetOrientation
@ -647,7 +647,7 @@ private:
* Editing definitions of primitives for custom pad shapes. In local coordinates relative
* to m_Pos (NOT shapePos) at orient 0.
*/
std::vector<std::shared_ptr<DRAWSEGMENT>> m_editPrimitives;
std::vector<std::shared_ptr<PCB_SHAPE>> m_editPrimitives;
// Must be set to true to force rebuild shapes to draw (after geometry change for instance)
mutable bool m_shapesDirty;

View File

@ -26,12 +26,12 @@
#include <class_board_item.h> // class BOARD_ITEM
#include <class_module.h>
#include <class_edge_mod.h>
#include <fp_shape.h>
#include <class_pad.h>
#include <class_track.h>
#include <class_marker_pcb.h>
#include <class_zone.h>
#include <class_drawsegment.h>
#include <pcb_shape.h>
#include <class_pcb_group.h>
#include <macros.h>
#include <math/util.h> // for KiROUND
@ -189,13 +189,13 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
{
BOARD_ITEM* item = (BOARD_ITEM*) testItem;
MODULE* module = nullptr;
PCB_GROUP* group = nullptr;
PCB_GROUP* group = nullptr;
D_PAD* pad = nullptr;
bool pad_through = false;
VIA* via = nullptr;
MARKER_PCB* marker = nullptr;
ZONE_CONTAINER* zone = nullptr;
DRAWSEGMENT* drawSegment = nullptr;
PCB_SHAPE* shape = nullptr;
#if 0 // debugging
static int breakhere = 0;
@ -236,7 +236,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
case PCB_FP_TEXT_T:
{
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
FP_TEXT* tm = (FP_TEXT*) item;
if( tm->GetText() == wxT( "10uH" ) )
{
@ -317,7 +317,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
break;
case PCB_SHAPE_T:
drawSegment = static_cast<DRAWSEGMENT*>( item );
shape = static_cast<PCB_SHAPE*>( item );
break;
case PCB_DIM_ALIGNED_T:
@ -331,7 +331,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
case PCB_FP_TEXT_T:
{
TEXTE_MODULE *text = static_cast<TEXTE_MODULE*>( item );
FP_TEXT *text = static_cast<FP_TEXT*>( item );
if( m_Guide->IgnoreMTextsMarkedNoShow() && !text->IsVisible() )
goto exit;
@ -349,17 +349,17 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
switch( text->GetType() )
{
case TEXTE_MODULE::TEXT_is_REFERENCE:
case FP_TEXT::TEXT_is_REFERENCE:
if( m_Guide->IgnoreModulesRefs() )
goto exit;
break;
case TEXTE_MODULE::TEXT_is_VALUE:
case FP_TEXT::TEXT_is_VALUE:
if( m_Guide->IgnoreModulesVals() )
goto exit;
break;
case TEXTE_MODULE::TEXT_is_DIVERS:
case FP_TEXT::TEXT_is_DIVERS:
if( !m_Guide->IsLayerVisible( text->GetLayer() )
&& m_Guide->IgnoreNonVisibleLayers() )
goto exit;
@ -372,7 +372,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
break;
case PCB_FP_SHAPE_T:
drawSegment = static_cast<EDGE_MODULE*>( item );
shape = static_cast<FP_SHAPE*>( item );
break;
case PCB_MODULE_T:
@ -489,9 +489,9 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
goto exit;
}
}
else if( drawSegment )
else if( shape )
{
if( drawSegment->HitTest( m_refPos, accuracy ) )
if( shape->HitTest( m_refPos, accuracy ) )
{
Append( item );
goto exit;
@ -553,9 +553,9 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
goto exit;
}
}
else if( drawSegment )
else if( shape )
{
if( drawSegment->HitTest( m_refPos, accuracy ) )
if( shape->HitTest( m_refPos, accuracy ) )
{
Append( item );
goto exit;

View File

@ -33,7 +33,7 @@
#include <macros.h>
#include <math/vector2d.h>
#include <class_drawsegment.h>
#include <pcb_shape.h>
#include <class_module.h>
#include <base_units.h>
#include <convert_basic_shapes_to_polygon.h>
@ -105,15 +105,16 @@ inline bool close_st( const wxPoint& aReference, const wxPoint& aFirst, const wx
/**
* Searches for a DRAWSEGMENT matching a given end point or start point in a list, and
* Searches for a PCB_SHAPE matching a given end point or start point in a list, and
* if found, removes it from the TYPE_COLLECTOR and returns it, else returns NULL.
* @param aPoint The starting or ending point to search for.
* @param aList The list to remove from.
* @param aLimit is the distance from \a aPoint that still constitutes a valid find.
* @return DRAWSEGMENT* - The first DRAWSEGMENT that has a start or end point matching
* @return PCB_SHAPE* - The first PCB_SHAPE that has a start or end point matching
* aPoint, otherwise NULL if none.
*/
static DRAWSEGMENT* findPoint( const wxPoint& aPoint, std::vector< DRAWSEGMENT* >& aList, unsigned aLimit )
static PCB_SHAPE* findPoint( const wxPoint& aPoint, std::vector< PCB_SHAPE* >& aList,
unsigned aLimit )
{
unsigned min_d = INT_MAX;
int ndx_min = 0;
@ -121,8 +122,8 @@ static DRAWSEGMENT* findPoint( const wxPoint& aPoint, std::vector< DRAWSEGMENT*
// find the point closest to aPoint and perhaps exactly matching aPoint.
for( size_t i = 0; i < aList.size(); ++i )
{
DRAWSEGMENT* graphic = aList[i];
unsigned d;
PCB_SHAPE* graphic = aList[i];
unsigned d;
switch( graphic->GetShape() )
{
@ -173,7 +174,7 @@ static DRAWSEGMENT* findPoint( const wxPoint& aPoint, std::vector< DRAWSEGMENT*
if( min_d <= aLimit )
{
DRAWSEGMENT* graphic = aList[ndx_min];
PCB_SHAPE* graphic = aList[ndx_min];
aList.erase( aList.begin() + ndx_min );
return graphic;
}
@ -184,7 +185,7 @@ static DRAWSEGMENT* findPoint( const wxPoint& aPoint, std::vector< DRAWSEGMENT*
/**
* Function ConvertOutlineToPolygon
* build a polygon (with holes) from a DRAWSEGMENT list, which is expected to be
* build a polygon (with holes) from a PCB_SHAPE list, which is expected to be
* a outline, therefore a closed main outline with perhaps closed inner outlines.
* These closed inner outlines are considered as holes in the main outline
* @param aSegList the initial list of drawsegments (only lines, circles and arcs).
@ -194,7 +195,7 @@ static DRAWSEGMENT* findPoint( const wxPoint& aPoint, std::vector< DRAWSEGMENT*
* @param aErrorText is a wxString to return error message.
* @param aErrorLocation is the optional position of the error in the outline
*/
bool ConvertOutlineToPolygon( std::vector<DRAWSEGMENT*>& aSegList, SHAPE_POLY_SET& aPolygons,
bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET& aPolygons,
wxString* aErrorText, unsigned int aTolerance,
wxPoint* aErrorLocation )
{
@ -207,9 +208,9 @@ bool ConvertOutlineToPolygon( std::vector<DRAWSEGMENT*>& aSegList, SHAPE_POLY_SE
wxString msg;
// Make a working copy of aSegList, because the list is modified during calculations
std::vector< DRAWSEGMENT* > segList = aSegList;
std::vector<PCB_SHAPE*> segList = aSegList;
DRAWSEGMENT* graphic;
PCB_SHAPE* graphic;
wxPoint prevPt;
// Find edge point with minimum x, this should be in the outer polygon
@ -219,7 +220,7 @@ bool ConvertOutlineToPolygon( std::vector<DRAWSEGMENT*>& aSegList, SHAPE_POLY_SE
for( size_t i = 0; i < segList.size(); i++ )
{
graphic = (DRAWSEGMENT*) segList[i];
graphic = (PCB_SHAPE*) segList[i];
switch( graphic->GetShape() )
{
@ -329,9 +330,9 @@ bool ConvertOutlineToPolygon( std::vector<DRAWSEGMENT*>& aSegList, SHAPE_POLY_SE
// can put enough graphics together by matching endpoints to formulate a cohesive
// polygon.
graphic = (DRAWSEGMENT*) segList[xmini];
graphic = (PCB_SHAPE*) segList[xmini];
// The first DRAWSEGMENT is in 'graphic', ok to remove it from 'items'
// The first PCB_SHAPE is in 'graphic', ok to remove it from 'items'
segList.erase( segList.begin() + xmini );
// Output the outline perimeter as polygon.
@ -471,7 +472,7 @@ bool ConvertOutlineToPolygon( std::vector<DRAWSEGMENT*>& aSegList, SHAPE_POLY_SE
default:
if( aErrorText )
{
msg.Printf( "Unsupported DRAWSEGMENT type %s.",
msg.Printf( "Unsupported PCB_SHAPE type %s.",
BOARD_ITEM::ShowShape( graphic->GetShape() ) );
*aErrorText << msg << "\n";
@ -527,7 +528,7 @@ bool ConvertOutlineToPolygon( std::vector<DRAWSEGMENT*>& aSegList, SHAPE_POLY_SE
int hole = aPolygons.NewHole();
holeNum++;
graphic = (DRAWSEGMENT*) segList[0];
graphic = (PCB_SHAPE*) segList[0];
segList.erase( segList.begin() );
// Both circles and polygons on the edge cuts layer are closed items that
@ -680,7 +681,7 @@ bool ConvertOutlineToPolygon( std::vector<DRAWSEGMENT*>& aSegList, SHAPE_POLY_SE
default:
if( aErrorText )
{
msg.Printf( "Unsupported DRAWSEGMENT type %s.",
msg.Printf( "Unsupported PCB_SHAPE type %s.",
BOARD_ITEM::ShowShape( graphic->GetShape() ) );
*aErrorText << msg << "\n";
@ -787,12 +788,12 @@ bool BuildBoardPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, wxStri
items.Collect( aBoard, scan_graphics );
// Make a working copy of aSegList, because the list is modified during calculations
std::vector< DRAWSEGMENT* > segList;
std::vector<PCB_SHAPE*> segList;
for( int ii = 0; ii < items.GetCount(); ii++ )
{
if( items[ii]->GetLayer() == Edge_Cuts )
segList.push_back( static_cast< DRAWSEGMENT* >( items[ii] ) );
segList.push_back( static_cast<PCB_SHAPE*>( items[ii] ) );
}
if( segList.size() )
@ -1008,12 +1009,12 @@ bool BuildFootprintPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines,
items.Collect( aBoard, scan_graphics );
// Make a working copy of aSegList, because the list is modified during calculations
std::vector< DRAWSEGMENT* > segList;
std::vector<PCB_SHAPE*> segList;
for( int ii = 0; ii < items.GetCount(); ii++ )
{
if( items[ii]->GetLayer() == Edge_Cuts )
segList.push_back( static_cast< DRAWSEGMENT* >( items[ii] ) );
segList.push_back( static_cast<PCB_SHAPE*>( items[ii] ) );
}
bool success = ConvertOutlineToPolygon( segList, outlines, aErrorText, aTolerance, aErrorLocation );

View File

@ -423,15 +423,14 @@ std::string FormatProbeItem( BOARD_ITEM* aItem )
{
module = static_cast<MODULE*>( aItem->GetParent() );
TEXTE_MODULE* text_mod = static_cast<TEXTE_MODULE*>( aItem );
const char* text_key;
FP_TEXT* text = static_cast<FP_TEXT*>( aItem );
const char* text_key;
/* This can't be a switch since the break need to pull out
* from the outer switch! */
if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_REFERENCE )
if( text->GetType() == FP_TEXT::TEXT_is_REFERENCE )
text_key = "$REF:";
else if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_VALUE )
else if( text->GetType() == FP_TEXT::TEXT_is_VALUE )
text_key = "$VAL:";
else
break;
@ -439,7 +438,7 @@ std::string FormatProbeItem( BOARD_ITEM* aItem )
return StrPrintf( "$PART: \"%s\" %s \"%s\"",
TO_UTF8( module->GetReference() ),
text_key,
TO_UTF8( text_mod->GetText() ) );
TO_UTF8( text->GetText() ) );
}
default:

View File

@ -28,7 +28,6 @@
#include <class_board.h>
#include <class_module.h>
#include <class_text_mod.h>
#include <dialogs/dialog_board_reannotate_base.h>
#include <layers_id_colors_and_visibility.h>
#include <netlist_reader/pcb_netlist.h>

View File

@ -29,7 +29,6 @@
#include <base_units.h>
#include <class_board.h>
#include <class_drawsegment.h>
#include <class_track.h>
#include <confirm.h>
#include <dialog_board_statistics_base.h>

View File

@ -201,7 +201,7 @@ bool DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow()
m_cbSuppressZeroes->SetValue( m_dimension->GetSuppressZeroes() );
TEXTE_PCB& text = m_dimension->Text();
PCB_TEXT& text = m_dimension->Text();
m_textWidth.SetValue( text.GetTextSize().x );
m_textHeight.SetValue( text.GetTextSize().y );
@ -305,7 +305,7 @@ void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( DIMENSION* aTarget
aTarget->SetPrecision( m_cbPrecision->GetSelection() );
aTarget->SetSuppressZeroes( m_cbSuppressZeroes->GetValue() );
TEXTE_PCB& text = aTarget->Text();
PCB_TEXT& text = aTarget->Text();
DIM_TEXT_POSITION tpm = static_cast<DIM_TEXT_POSITION>( m_cbTextPositionMode->GetSelection() );
aTarget->SetTextPositionMode( tpm );

View File

@ -265,10 +265,10 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow()
for( BOARD_ITEM* item : m_footprint->GraphicalItems() )
{
TEXTE_MODULE* textModule = dyn_cast<TEXTE_MODULE*>( item );
FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
if( textModule )
m_texts->push_back( *textModule );
if( textItem )
m_texts->push_back( *textItem );
}
// notify the grid
@ -599,7 +599,7 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::Validate()
// Check for empty texts.
for( size_t i = 2; i < m_texts->size(); ++i )
{
TEXTE_MODULE& text = m_texts->at( i );
FP_TEXT& text = m_texts->at( i );
if( text.GetText().IsEmpty() )
{
@ -646,24 +646,24 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow()
size_t i = 2;
for( auto item : m_footprint->GraphicalItems() )
for( BOARD_ITEM* item : m_footprint->GraphicalItems() )
{
TEXTE_MODULE* textModule = dyn_cast<TEXTE_MODULE*>( item );
FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
if( textModule )
if( textItem )
{
// copy grid table entries till we run out, then delete any remaining texts
if( i < m_texts->size() )
*textModule = m_texts->at( i++ );
*textItem = m_texts->at( i++ );
else
textModule->DeleteStructure();
textItem->DeleteStructure();
}
}
// if there are still grid table entries, create new texts for them
while( i < m_texts->size() )
{
auto newText = new TEXTE_MODULE( m_texts->at( i++ ) );
auto newText = new FP_TEXT( m_texts->at( i++ ) );
m_footprint->Add( newText, ADD_MODE::APPEND );
view->Add( newText );
}
@ -768,21 +768,21 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField( wxCommandEvent& )
return;
const BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings();
TEXTE_MODULE textMod( m_footprint );
FP_TEXT textItem( m_footprint );
// Set active layer if legal; otherwise copy layer from previous text item
if( LSET::AllTechMask().test( m_frame->GetActiveLayer() ) )
textMod.SetLayer( m_frame->GetActiveLayer() );
textItem.SetLayer( m_frame->GetActiveLayer() );
else
textMod.SetLayer( m_texts->at( m_texts->size() - 1 ).GetLayer() );
textItem.SetLayer( m_texts->at( m_texts->size() - 1 ).GetLayer() );
textMod.SetTextSize( dsnSettings.GetTextSize( textMod.GetLayer() ) );
textMod.SetTextThickness( dsnSettings.GetTextThickness( textMod.GetLayer() ) );
textMod.SetItalic( dsnSettings.GetTextItalic( textMod.GetLayer() ) );
textMod.SetKeepUpright( dsnSettings.GetTextUpright( textMod.GetLayer() ) );
textMod.SetMirrored( IsBackLayer( textMod.GetLayer() ) );
textItem.SetTextSize( dsnSettings.GetTextSize( textItem.GetLayer() ) );
textItem.SetTextThickness( dsnSettings.GetTextThickness( textItem.GetLayer() ) );
textItem.SetItalic( dsnSettings.GetTextItalic( textItem.GetLayer() ) );
textItem.SetKeepUpright( dsnSettings.GetTextUpright( textItem.GetLayer() ) );
textItem.SetMirrored( IsBackLayer( textItem.GetLayer() ) );
m_texts->push_back( textMod );
m_texts->push_back( textItem );
// notify the grid
wxGridTableMessage msg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );

View File

@ -216,10 +216,10 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow()
for( auto item : m_footprint->GraphicalItems() )
{
auto textModule = dyn_cast<TEXTE_MODULE*>( item );
auto textItem = dyn_cast<FP_TEXT*>( item );
if( textModule )
m_texts->push_back( *textModule );
if( textItem )
m_texts->push_back( *textItem );
}
// notify the grid
@ -562,7 +562,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::Validate()
// Check for empty texts.
for( size_t i = 2; i < m_texts->size(); ++i )
{
TEXTE_MODULE& text = m_texts->at( i );
FP_TEXT& text = m_texts->at( i );
if( text.GetText().IsEmpty() )
{
@ -615,31 +615,31 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow()
m_footprint->Value() = m_texts->at( 1 );
size_t i = 2;
std::vector<TEXTE_MODULE*> items_to_remove;
std::vector<FP_TEXT*> items_to_remove;
for( BOARD_ITEM* item : m_footprint->GraphicalItems() )
{
TEXTE_MODULE* textModule = dynamic_cast<TEXTE_MODULE*>( item );
FP_TEXT* textItem = dynamic_cast<FP_TEXT*>( item );
if( textModule )
if( textItem )
{
// copy grid table entries till we run out, then delete any remaining texts
if( i < m_texts->size() )
*textModule = m_texts->at( i++ );
*textItem = m_texts->at( i++ );
else // store this item to remove and delete it later,
// after the graphic list is explored:
items_to_remove.push_back( textModule );
items_to_remove.push_back( textItem );
}
}
// Remove items from m_footprint graphic list:
for( TEXTE_MODULE* item: items_to_remove )
for( FP_TEXT* item: items_to_remove )
item->DeleteStructure();
// if there are still grid table entries, create new texts for them
while( i < m_texts->size() )
{
auto newText = new TEXTE_MODULE( m_texts->at( i++ ) );
FP_TEXT* newText = new FP_TEXT( m_texts->at( i++ ) );
m_footprint->Add( newText, ADD_MODE::APPEND );
view->Add( newText );
}
@ -736,19 +736,19 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnAddField( wxCommandEvent& event )
return;
const BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings();
TEXTE_MODULE textMod( m_footprint );
FP_TEXT textItem( m_footprint );
// Set active layer if legal; otherwise copy layer from previous text item
if( LSET::AllTechMask().test( m_frame->GetActiveLayer() ) )
textMod.SetLayer( m_frame->GetActiveLayer() );
textItem.SetLayer( m_frame->GetActiveLayer() );
else
textMod.SetLayer( m_texts->at( m_texts->size() - 1 ).GetLayer() );
textItem.SetLayer( m_texts->at( m_texts->size() - 1 ).GetLayer() );
textMod.SetTextSize( dsnSettings.GetTextSize( textMod.GetLayer() ) );
textMod.SetTextThickness( dsnSettings.GetTextThickness( textMod.GetLayer() ) );
textMod.SetItalic( dsnSettings.GetTextItalic( textMod.GetLayer() ) );
textItem.SetTextSize( dsnSettings.GetTextSize( textItem.GetLayer() ) );
textItem.SetTextThickness( dsnSettings.GetTextThickness( textItem.GetLayer() ) );
textItem.SetItalic( dsnSettings.GetTextItalic( textItem.GetLayer() ) );
m_texts->push_back( textMod );
m_texts->push_back( textItem );
// notify the grid
wxGridTableMessage msg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );

View File

@ -401,7 +401,7 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processModule( MODULE* aModule, const LIB_ID& a
}
void processTextItem( const TEXTE_MODULE& aSrc, TEXTE_MODULE& aDest,
void processTextItem( const FP_TEXT& aSrc, FP_TEXT& aDest,
bool resetText, bool resetTextLayers, bool resetTextEffects )
{
if( !resetText )
@ -423,13 +423,13 @@ void processTextItem( const TEXTE_MODULE& aSrc, TEXTE_MODULE& aDest,
}
TEXTE_MODULE* getMatchingTextItem( TEXTE_MODULE* aRefItem, MODULE* aModule )
FP_TEXT* getMatchingTextItem( FP_TEXT* aRefItem, MODULE* aModule )
{
std::vector<TEXTE_MODULE*> candidates;
std::vector<FP_TEXT*> candidates;
for( BOARD_ITEM* item : aModule->GraphicalItems() )
{
TEXTE_MODULE* candidate = dyn_cast<TEXTE_MODULE*>( item );
FP_TEXT* candidate = dyn_cast<FP_TEXT*>( item );
if( candidate && candidate->GetText() == aRefItem->GetText() )
candidates.push_back( candidate );
@ -442,9 +442,9 @@ TEXTE_MODULE* getMatchingTextItem( TEXTE_MODULE* aRefItem, MODULE* aModule )
return candidates[0];
// Try refining the match by layer
std::vector<TEXTE_MODULE*> candidatesOnSameLayer;
std::vector<FP_TEXT*> candidatesOnSameLayer;
for( TEXTE_MODULE* candidate : candidates )
for( FP_TEXT* candidate : candidates )
{
if( candidate->GetLayer() == aRefItem->GetLayer() )
candidatesOnSameLayer.push_back( candidate );
@ -454,9 +454,9 @@ TEXTE_MODULE* getMatchingTextItem( TEXTE_MODULE* aRefItem, MODULE* aModule )
return candidatesOnSameLayer[0];
// Last ditch effort: refine by position
std::vector<TEXTE_MODULE*> candidatesAtSamePos;
std::vector<FP_TEXT*> candidatesAtSamePos;
for( TEXTE_MODULE* candidate : candidatesOnSameLayer.size() ? candidatesOnSameLayer : candidates )
for( FP_TEXT* candidate : candidatesOnSameLayer.size() ? candidatesOnSameLayer : candidates )
{
if( candidate->GetPos0() == aRefItem->GetPos0() )
candidatesAtSamePos.push_back( candidate );
@ -528,16 +528,16 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aExisting, MODULE* aNew, BOARD_COM
// Copy fields in accordance with the reset* flags
for( BOARD_ITEM* item : aExisting->GraphicalItems() )
{
TEXTE_MODULE* srcItem = dyn_cast<TEXTE_MODULE*>( item );
FP_TEXT* srcItem = dyn_cast<FP_TEXT*>( item );
if( srcItem )
{
TEXTE_MODULE* destItem = getMatchingTextItem( srcItem, aNew );
FP_TEXT* destItem = getMatchingTextItem( srcItem, aNew );
if( destItem )
processTextItem( *srcItem, *destItem, false, resetTextLayers, resetTextEffects );
else if( !deleteExtraTexts )
aNew->Add( new TEXTE_MODULE( *srcItem ) );
aNew->Add( new FP_TEXT( *srcItem ) );
}
}

View File

@ -26,8 +26,8 @@
#include <class_board.h>
#include <class_marker_pcb.h>
#include <class_module.h>
#include <class_pcb_text.h>
#include <class_text_mod.h>
#include <pcb_text.h>
#include <fp_text.h>
#include <dialog_find.h>
#include <kicad_string.h>
#include <pcb_edit_frame.h>
@ -234,7 +234,7 @@ void DIALOG_FIND::search( bool aDirection )
{
for( BOARD_ITEM* item : module->GraphicalItems() )
{
TEXTE_MODULE* textItem = dynamic_cast<TEXTE_MODULE*>( item );
FP_TEXT* textItem = dynamic_cast<FP_TEXT*>( item );
if( textItem
&& textItem->Matches( m_frame->GetFindReplaceData(), nullptr ) )
@ -249,7 +249,7 @@ void DIALOG_FIND::search( bool aDirection )
{
for( BOARD_ITEM* item : m_frame->GetBoard()->Drawings() )
{
TEXTE_PCB* textItem = dynamic_cast<TEXTE_PCB*>( item );
PCB_TEXT* textItem = dynamic_cast<PCB_TEXT*>( item );
if( textItem && textItem->Matches( m_frame->GetFindReplaceData(), nullptr ) )
{

View File

@ -28,8 +28,8 @@
#include <pcb_layer_box_selector.h>
#include <class_board.h>
#include <class_module.h>
#include <class_edge_mod.h>
#include <class_pcb_text.h>
#include <fp_shape.h>
#include <pcb_text.h>
#include <widgets/unit_binder.h>
#include <tools/global_edit_tool.h>
#include <dialog_global_edit_text_and_graphics_base.h>
@ -270,8 +270,8 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, B
aCommit.Modify( aItem );
auto textItem = dynamic_cast<EDA_TEXT*>( aItem );
auto drawItem = dynamic_cast<DRAWSEGMENT*>( aItem );
auto moduleTextItem = dyn_cast<TEXTE_MODULE*>( aItem );
auto drawItem = dynamic_cast<PCB_SHAPE*>( aItem );
auto moduleTextItem = dyn_cast<FP_TEXT*>( aItem );
if( m_setToSpecifiedValues->GetValue() )
{

View File

@ -33,8 +33,8 @@
#include <pcb_layer_box_selector.h>
#include <html_messagebox.h>
#include <class_board.h>
#include <class_drawsegment.h>
#include <class_edge_mod.h>
#include <pcb_shape.h>
#include <fp_shape.h>
#include <widgets/unit_binder.h>
#include <dialog_graphic_item_properties_base.h>
@ -43,8 +43,8 @@ class DIALOG_GRAPHIC_ITEM_PROPERTIES : public DIALOG_GRAPHIC_ITEM_PROPERTIES_BAS
{
private:
PCB_BASE_EDIT_FRAME* m_parent;
DRAWSEGMENT* m_item;
EDGE_MODULE* m_moduleItem;
PCB_SHAPE* m_item;
FP_SHAPE* m_moduleItem;
UNIT_BINDER m_startX, m_startY;
UNIT_BINDER m_endX, m_endY;
@ -96,8 +96,8 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR
m_AngleValue( 0.0 )
{
m_parent = aParent;
m_item = dynamic_cast<DRAWSEGMENT*>( aItem );
m_moduleItem = dynamic_cast<EDGE_MODULE*>( aItem );
m_item = dynamic_cast<PCB_SHAPE*>( aItem );
m_moduleItem = dynamic_cast<FP_SHAPE*>( aItem );
// Configure display origin transforms
m_startX.SetCoordType( ORIGIN_TRANSFORMS::ABS_X_COORD );
@ -360,7 +360,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate()
default:
wxASSERT_MSG( false, "DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate not implemented for shape"
+ DRAWSEGMENT::ShowShape( m_item->GetShape() ) );
+ PCB_SHAPE::ShowShape( m_item->GetShape() ) );
break;
}

View File

@ -42,7 +42,7 @@
DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES( wxWindow* aParent,
PCB_BASE_FRAME* aFrame,
DRAWSEGMENT* aShape ) :
PCB_SHAPE* aShape ) :
DIALOG_PAD_PRIMITIVES_PROPERTIES_BASE( aParent ),
m_shape( aShape ),
m_startX( aFrame, m_startXLabel, m_startXCtrl, m_startXUnits, true ),
@ -214,7 +214,7 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataFromWindow()
DIALOG_PAD_PRIMITIVE_POLY_PROPS::DIALOG_PAD_PRIMITIVE_POLY_PROPS( wxWindow* aParent,
PCB_BASE_FRAME* aFrame,
DRAWSEGMENT* aShape ) :
PCB_SHAPE* aShape ) :
DIALOG_PAD_PRIMITIVE_POLY_PROPS_BASE( aParent ),
m_shape( aShape ),
m_thickness( aFrame, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits, true )
@ -526,7 +526,7 @@ void DIALOG_PAD_PRIMITIVE_POLY_PROPS::onCellChanging( wxGridEvent& event )
// (move, rotate around origin, scaling factor, duplication).
DIALOG_PAD_PRIMITIVES_TRANSFORM::DIALOG_PAD_PRIMITIVES_TRANSFORM( wxWindow* aParent,
PCB_BASE_FRAME* aFrame,
std::vector<std::shared_ptr<DRAWSEGMENT>>& aList,
std::vector<std::shared_ptr<PCB_SHAPE>>& aList,
bool aShowDuplicate ) :
DIALOG_PAD_PRIMITIVES_TRANSFORM_BASE( aParent ),
m_list( aList ),
@ -557,7 +557,7 @@ inline void geom_transf( wxPoint& aCoord, wxPoint& aMove, double aScale, double
}
void DIALOG_PAD_PRIMITIVES_TRANSFORM::Transform( std::vector<std::shared_ptr<DRAWSEGMENT>>* aList,
void DIALOG_PAD_PRIMITIVES_TRANSFORM::Transform( std::vector<std::shared_ptr<PCB_SHAPE>>* aList,
int aDuplicateCount )
{
wxPoint move_vect( m_vectorX.GetValue(), m_vectorY.GetValue() );
@ -582,13 +582,13 @@ void DIALOG_PAD_PRIMITIVES_TRANSFORM::Transform( std::vector<std::shared_ptr<DRA
do {
for( unsigned idx = 0; idx < m_list.size(); ++idx )
{
std::shared_ptr<DRAWSEGMENT> shape;
std::shared_ptr<PCB_SHAPE> shape;
if( aList == NULL )
shape = m_list[idx];
else
{
aList->emplace_back( std::make_shared<DRAWSEGMENT>( *m_list[idx] ) );
aList->emplace_back( std::make_shared<PCB_SHAPE>( *m_list[idx] ) );
shape = aList->back();
}

View File

@ -694,7 +694,7 @@ void DIALOG_PAD_PROPERTIES::displayPrimitivesList()
for( unsigned ii = 0; ii < m_primitives.size(); ++ii )
{
const std::shared_ptr<DRAWSEGMENT>& primitive = m_primitives[ii];
const std::shared_ptr<PCB_SHAPE>& primitive = m_primitives[ii];
for( wxString& s : bs_info )
s.Empty();
@ -1354,13 +1354,13 @@ void DIALOG_PAD_PROPERTIES::redraw()
while( select >= 0 )
{
DRAWSEGMENT* dummySegment = (DRAWSEGMENT*) m_primitives[select]->Clone();
dummySegment->SetLayer( SELECTED_ITEMS_LAYER );
dummySegment->Rotate( wxPoint( 0, 0), m_dummyPad->GetOrientation() );
dummySegment->Move( m_dummyPad->GetPosition() );
PCB_SHAPE* dummyShape = (PCB_SHAPE*) m_primitives[select]->Clone();
dummyShape->SetLayer( SELECTED_ITEMS_LAYER );
dummyShape->Rotate( wxPoint( 0, 0), m_dummyPad->GetOrientation() );
dummyShape->Move( m_dummyPad->GetPosition() );
view->Add( dummySegment );
m_highlight.push_back( dummySegment );
view->Add( dummyShape );
m_highlight.push_back( dummyShape );
select = m_listCtrlPrimitives->GetNextSelected( select );
}
@ -1938,7 +1938,7 @@ void DIALOG_PAD_PROPERTIES::editPrimitive()
return;
}
std::shared_ptr<DRAWSEGMENT>& shape = m_primitives[select];
std::shared_ptr<PCB_SHAPE>& shape = m_primitives[select];
if( shape->GetShape() == S_POLYGON )
{
@ -2035,7 +2035,7 @@ void DIALOG_PAD_PROPERTIES::onAddPrimitive( wxCommandEvent& event )
PCB_SHAPE_TYPE_T listtype[] = { S_SEGMENT, S_ARC, S_CURVE, S_CIRCLE, S_POLYGON };
DRAWSEGMENT* primitive = new DRAWSEGMENT();
PCB_SHAPE* primitive = new PCB_SHAPE();
primitive->SetShape( listtype[type] );
primitive->SetWidth( m_board->GetDesignSettings().GetLineThickness( F_Cu ) );
@ -2077,7 +2077,7 @@ void DIALOG_PAD_PROPERTIES::onGeometryTransform( wxCommandEvent& event )
}
// Multiple selections are allowed. Build selected shapes list
std::vector<std::shared_ptr<DRAWSEGMENT>> shapeList;
std::vector<std::shared_ptr<PCB_SHAPE>> shapeList;
shapeList.emplace_back( m_primitives[select] );
while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
@ -2111,7 +2111,7 @@ void DIALOG_PAD_PROPERTIES::onDuplicatePrimitive( wxCommandEvent& event )
}
// Multiple selections are allowed. Build selected shapes list
std::vector<std::shared_ptr<DRAWSEGMENT>> shapeList;
std::vector<std::shared_ptr<PCB_SHAPE>> shapeList;
shapeList.emplace_back( m_primitives[select] );
while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
@ -2125,7 +2125,7 @@ void DIALOG_PAD_PROPERTIES::onDuplicatePrimitive( wxCommandEvent& event )
// Transfer new settings
// save duplicates to a separate vector to avoid m_primitives reallocation,
// as shapeList contains pointers to its elements
std::vector<std::shared_ptr<DRAWSEGMENT>> duplicates;
std::vector<std::shared_ptr<PCB_SHAPE>> duplicates;
dlg.Transform( &duplicates, dlg.GetDuplicateCount() );
std::move( duplicates.begin(), duplicates.end(), std::back_inserter( m_primitives ) );

View File

@ -33,7 +33,7 @@
#include <wx/valnum.h>
#include <class_board.h>
#include <class_module.h>
#include <class_drawsegment.h>
#include <pcb_shape.h>
#include <origin_viewitem.h>
#include <dialog_pad_properties_base.h>
#include <widgets/text_ctrl_eval.h>
@ -62,13 +62,13 @@ private:
bool m_canUpdate;
bool m_canEditNetName; // true only if the caller is the board editor
std::vector<std::shared_ptr<DRAWSEGMENT>> m_primitives; // the custom shape primitives in
std::vector<std::shared_ptr<PCB_SHAPE>> m_primitives; // the custom shape primitives in
// local coords, orient 0
// must define a single copper area
COLOR4D m_selectedColor; // color used to draw selected primitives when
// editing a custom pad shape
std::vector<DRAWSEGMENT*> m_highlight; // shapes highlighted in GAL mode
std::vector<PCB_SHAPE*> m_highlight; // shapes highlighted in GAL mode
PCB_DRAW_PANEL_GAL* m_padPreviewGAL;
KIGFX::ORIGIN_VIEWITEM* m_axisOrigin; // origin of the preview canvas
static bool m_sketchPreview; // session storage
@ -171,7 +171,7 @@ class DIALOG_PAD_PRIMITIVES_PROPERTIES: public DIALOG_PAD_PRIMITIVES_PROPERTIES_
{
public:
DIALOG_PAD_PRIMITIVES_PROPERTIES( wxWindow* aParent, PCB_BASE_FRAME* aFrame,
DRAWSEGMENT* aShape );
PCB_SHAPE* aShape );
/**
* Function TransferDataFromWindow
@ -187,7 +187,7 @@ private:
bool TransferDataToWindow() override;
// The basic shape currently edited
DRAWSEGMENT* m_shape;
PCB_SHAPE* m_shape;
UNIT_BINDER m_startX;
UNIT_BINDER m_startY;
@ -208,7 +208,7 @@ private:
class DIALOG_PAD_PRIMITIVE_POLY_PROPS: public DIALOG_PAD_PRIMITIVE_POLY_PROPS_BASE
{
// The basic shape currently edited
DRAWSEGMENT* m_shape;
PCB_SHAPE* m_shape;
// The working copy of the basic shape currently edited
std::vector<wxPoint> m_currPoints;
@ -217,7 +217,7 @@ class DIALOG_PAD_PRIMITIVE_POLY_PROPS: public DIALOG_PAD_PRIMITIVE_POLY_PROPS_BA
public:
DIALOG_PAD_PRIMITIVE_POLY_PROPS( wxWindow* aParent, PCB_BASE_FRAME* aFrame,
DRAWSEGMENT* aShape );
PCB_SHAPE* aShape );
~DIALOG_PAD_PRIMITIVE_POLY_PROPS();
/**
@ -266,7 +266,7 @@ class DIALOG_PAD_PRIMITIVES_TRANSFORM : public DIALOG_PAD_PRIMITIVES_TRANSFORM_B
{
public:
DIALOG_PAD_PRIMITIVES_TRANSFORM( wxWindow* aParent, PCB_BASE_FRAME* aFrame,
std::vector<std::shared_ptr<DRAWSEGMENT>>& aList,
std::vector<std::shared_ptr<PCB_SHAPE>>& aList,
bool aShowDuplicate );
/**
@ -276,7 +276,7 @@ public:
* The duplicated items are transformed, but the initial shpes are not modified.
* The duplicated items are added to aList
*/
void Transform( std::vector<std::shared_ptr<DRAWSEGMENT>>* aList = NULL,
void Transform( std::vector<std::shared_ptr<PCB_SHAPE>>* aList = nullptr,
int aDuplicateCount = 0 );
/**
@ -285,7 +285,7 @@ public:
int GetDuplicateCount() { return m_spinCtrlDuplicateCount->GetValue(); }
private:
std::vector<std::shared_ptr<DRAWSEGMENT>>& m_list;
std::vector<std::shared_ptr<PCB_SHAPE>>& m_list;
UNIT_BINDER m_vectorX;
UNIT_BINDER m_vectorY;

View File

@ -23,7 +23,6 @@
#include <pcb_base_edit_frame.h>
#include <grid_layer_box_helpers.h>
#include <class_drawsegment.h>
#include <class_track.h>
#include <view/view.h>
#include <widgets/wx_grid.h>

View File

@ -28,8 +28,8 @@
#include <board_commit.h>
#include <class_board.h>
#include <class_module.h>
#include <class_pcb_text.h>
#include <class_text_mod.h>
#include <pcb_text.h>
#include <fp_text.h>
#include <pcb_edit_frame.h>
#include <pcb_layer_box_selector.h>
#include <wx/valnum.h>
@ -41,7 +41,7 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BO
m_Parent( aParent ),
m_item( aItem ),
m_edaText( nullptr ),
m_modText( nullptr ),
m_fpText( nullptr ),
m_pcbText( nullptr ),
m_textWidth( aParent, m_SizeXLabel, m_SizeXCtrl, m_SizeXUnits, true ),
m_textHeight( aParent, m_SizeYLabel, m_SizeYCtrl, m_SizeYUnits, true ),
@ -69,14 +69,14 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BO
{
title = _( "Footprint Text Properties" );
m_modText = (TEXTE_MODULE*) m_item;
m_edaText = static_cast<EDA_TEXT*>( m_modText );
m_fpText = (FP_TEXT*) m_item;
m_edaText = static_cast<EDA_TEXT*>( m_fpText );
switch( m_modText->GetType() )
switch( m_fpText->GetType() )
{
case TEXTE_MODULE::TEXT_is_REFERENCE: m_TextLabel->SetLabel( _( "Reference:" ) ); break;
case TEXTE_MODULE::TEXT_is_VALUE: m_TextLabel->SetLabel( _( "Value:" ) ); break;
case TEXTE_MODULE::TEXT_is_DIVERS: m_TextLabel->SetLabel( _( "Text:" ) ); break;
case FP_TEXT::TEXT_is_REFERENCE: m_TextLabel->SetLabel( _( "Reference:" ) ); break;
case FP_TEXT::TEXT_is_VALUE: m_TextLabel->SetLabel( _( "Value:" ) ); break;
case FP_TEXT::TEXT_is_DIVERS: m_TextLabel->SetLabel( _( "Text:" ) ); break;
}
SetInitialFocus( m_SingleLineText );
@ -86,7 +86,7 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BO
{
title = _( "Text Properties" );
m_pcbText = (TEXTE_PCB*) aItem;
m_pcbText = (PCB_TEXT*) aItem;
m_edaText = static_cast<EDA_TEXT*>( m_pcbText );
SetInitialFocus( m_MultiLineText );
@ -234,7 +234,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
{
m_SingleLineText->SetValue( m_edaText->GetText() );
if( m_modText && m_modText->GetType() == TEXTE_MODULE::TEXT_is_REFERENCE )
if( m_fpText && m_fpText->GetType() == FP_TEXT::TEXT_is_REFERENCE )
SelectReferenceNumber( static_cast<wxTextEntry*>( m_SingleLineText ) );
else
m_SingleLineText->SetSelection( -1, -1 );
@ -248,9 +248,9 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
m_MultiLineText->SetSelection( -1, -1 );
}
if( m_item->Type() == PCB_FP_TEXT_T && m_modText )
if( m_item->Type() == PCB_FP_TEXT_T && m_fpText )
{
MODULE* module = dynamic_cast<MODULE*>( m_modText->GetParent() );
MODULE* module = dynamic_cast<MODULE*>( m_fpText->GetParent() );
wxString msg;
if( module )
@ -289,8 +289,8 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
m_OrientValue = m_edaText->GetTextAngleDegrees();
m_Mirrored->SetValue( m_edaText->IsMirrored() );
if( m_modText )
m_KeepUpright->SetValue( m_modText->IsKeepUpright() );
if( m_fpText )
m_KeepUpright->SetValue( m_fpText->IsKeepUpright() );
return DIALOG_TEXT_PROPERTIES_BASE::TransferDataToWindow();
}
@ -348,8 +348,8 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
m_edaText->SetTextThickness( m_thickness.GetValue() );
m_edaText->SetTextPos( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) );
if( m_modText )
m_modText->SetLocalCoord();
if( m_fpText )
m_fpText->SetLocalCoord();
// Test for acceptable values for thickness and size and clamp if fails
int maxPenWidth = Clamp_Text_PenSize( m_edaText->GetTextThickness(), m_edaText->GetTextSize() );
@ -366,8 +366,8 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
m_edaText->SetTextAngle( KiROUND( m_OrientValue * 10.0 ) );
m_edaText->SetMirrored( m_Mirrored->GetValue() );
if( m_modText )
m_modText->SetKeepUpright( m_KeepUpright->GetValue() );
if( m_fpText )
m_fpText->SetKeepUpright( m_KeepUpright->GetValue() );
switch( m_JustifyChoice->GetSelection() )
{

View File

@ -33,8 +33,8 @@
class PCB_BASE_EDIT_FRAME;
class BOARD_ITEM;
class EDA_TEXT;
class TEXTE_MODULE;
class TEXTE_PCB;
class FP_TEXT;
class PCB_TEXT;
class DIALOG_TEXT_PROPERTIES : public DIALOG_TEXT_PROPERTIES_BASE
@ -45,10 +45,10 @@ public:
private:
PCB_BASE_EDIT_FRAME* m_Parent;
BOARD_ITEM* m_item; // TEXTE_MODULE, TEXTE_PCB, or DIMENSION
BOARD_ITEM* m_item; // FP_TEXT, PCB_TEXT, or DIMENSION
EDA_TEXT* m_edaText; // always non-null
TEXTE_MODULE* m_modText; // only non-null for TEXTE_MODULEs
TEXTE_PCB* m_pcbText; // only non-null for TEXTE_PCBs and DIMENSIONs
FP_TEXT* m_fpText; // only non-null for FP_TEXTs
PCB_TEXT* m_pcbText; // only non-null for PCB_TEXTs and DIMENSIONs
UNIT_BINDER m_textWidth;
UNIT_BINDER m_textHeight;

View File

@ -28,7 +28,7 @@
#include <class_module.h>
#include <class_pad.h>
#include <class_zone.h>
#include <class_pcb_text.h>
#include <pcb_text.h>
DRC_TEST_PROVIDER::DRC_TEST_PROVIDER() :
m_drcEngine( nullptr )
@ -286,13 +286,13 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes,
bool DRC_TEST_PROVIDER::isInvisibleText( const BOARD_ITEM* aItem ) const
{
if( auto text = dyn_cast<const TEXTE_MODULE*>( aItem ) )
if( const FP_TEXT* text = dyn_cast<const FP_TEXT*>( aItem ) )
{
if( !text->IsVisible() )
return true;
}
if( auto text = dyn_cast<const TEXTE_PCB*>( aItem ) )
if( const PCB_TEXT* text = dyn_cast<const PCB_TEXT*>( aItem ) )
{
if( !text->IsVisible() )
return true;

View File

@ -23,7 +23,7 @@
#include <common.h>
#include <class_board.h>
#include <class_drawsegment.h>
#include <pcb_shape.h>
#include <class_pad.h>
#include <class_track.h>
@ -160,8 +160,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperTextAndGraphics()
for( MODULE* module : m_board->Modules() )
{
TEXTE_MODULE& ref = module->Reference();
TEXTE_MODULE& val = module->Value();
FP_TEXT& ref = module->Reference();
FP_TEXT& val = module->Value();
if( ref.IsVisible() && IsCopperLayer( ref.GetLayer() ) )
testCopperDrawItem( &ref );
@ -176,7 +176,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperTextAndGraphics()
{
if( IsCopperLayer( item->GetLayer() ) )
{
if( item->Type() == PCB_FP_TEXT_T && ( (TEXTE_MODULE*) item )->IsVisible() )
if( item->Type() == PCB_FP_TEXT_T && ( (FP_TEXT*) item )->IsVisible() )
testCopperDrawItem( item );
else if( item->Type() == PCB_FP_SHAPE_T )
testCopperDrawItem( item );

View File

@ -20,7 +20,6 @@
#include <common.h>
#include <class_board.h>
#include <class_drawsegment.h>
#include <class_pad.h>
#include <class_track.h>

View File

@ -22,7 +22,7 @@
*/
#include <common.h>
#include <class_drawsegment.h>
#include <pcb_shape.h>
#include <geometry/seg.h>
#include <geometry/shape_segment.h>
#include <drc/drc_engine.h>
@ -93,13 +93,13 @@ bool DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run()
if( !reportPhase( _( "Checking board edge clearances..." ) ) )
return false;
std::vector<DRAWSEGMENT*> boardOutline;
std::vector<PCB_SHAPE*> boardOutline;
std::vector<BOARD_ITEM*> boardItems;
auto queryBoardOutlineItems =
[&]( BOARD_ITEM *item ) -> bool
{
boardOutline.push_back( dyn_cast<DRAWSEGMENT*>( item ) );
boardOutline.push_back( dyn_cast<PCB_SHAPE*>( item ) );
return true;
};
@ -119,7 +119,7 @@ bool DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run()
drc_dbg( 2, "outline: %d items, board: %d items\n",
(int) boardOutline.size(), (int) boardItems.size() );
for( DRAWSEGMENT* outlineItem : boardOutline )
for( PCB_SHAPE* outlineItem : boardOutline )
{
if( m_drcEngine->IsErrorLimitExceeded( DRC_CONSTRAINT_TYPE_EDGE_CLEARANCE ) )
break;

View File

@ -22,7 +22,6 @@
*/
#include <common.h>
#include <class_drawsegment.h>
#include <class_pad.h>
#include <class_track.h>
#include <geometry/shape_segment.h>

View File

@ -19,7 +19,6 @@
#include <common.h>
#include <class_board.h>
#include <class_drawsegment.h>
#include <class_pad.h>
#include <class_track.h>

View File

@ -21,7 +21,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <class_pcb_text.h>
#include <drc/drc_engine.h>
#include <drc/drc_item.h>
#include <drc/drc_rule.h>

View File

@ -23,7 +23,6 @@
#include <common.h>
#include <class_board.h>
#include <class_drawsegment.h>
#include <geometry/polygon_test_point_inside.h>
#include <geometry/seg.h>

View File

@ -23,7 +23,6 @@
#include <common.h>
#include <class_board.h>
#include <class_drawsegment.h>
#include <geometry/polygon_test_point_inside.h>
#include <geometry/seg.h>

View File

@ -66,9 +66,9 @@ Load() TODO's
#include <class_board.h>
#include <class_module.h>
#include <class_track.h>
#include <class_edge_mod.h>
#include <fp_shape.h>
#include <class_zone.h>
#include <class_pcb_text.h>
#include <pcb_text.h>
#include <class_dimension.h>
#include <eagle_plugin.h>
@ -582,32 +582,32 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
if( layer != UNDEFINED_LAYER )
{
DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board );
int width = w.width.ToPcbUnits();
PCB_SHAPE* shape = new PCB_SHAPE( m_board );
int width = w.width.ToPcbUnits();
// KiCad cannot handle zero or negative line widths
if( width <= 0 )
width = m_board->GetDesignSettings().GetLineThickness( layer );
m_board->Add( dseg, ADD_MODE::APPEND );
m_board->Add( shape, ADD_MODE::APPEND );
if( !w.curve )
{
dseg->SetStart( start );
dseg->SetEnd( end );
shape->SetStart( start );
shape->SetEnd( end );
}
else
{
wxPoint center = ConvertArcCenter( start, end, *w.curve );
dseg->SetShape( S_ARC );
dseg->SetStart( center );
dseg->SetEnd( start );
dseg->SetAngle( *w.curve * -10.0 ); // KiCad rotates the other way
shape->SetShape( S_ARC );
shape->SetStart( center );
shape->SetEnd( start );
shape->SetAngle( *w.curve * -10.0 ); // KiCad rotates the other way
}
dseg->SetLayer( layer );
dseg->SetWidth( width );
shape->SetLayer( layer );
shape->SetWidth( width );
}
m_xpath->pop();
@ -621,7 +621,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
if( layer != UNDEFINED_LAYER )
{
TEXTE_PCB* pcbtxt = new TEXTE_PCB( m_board );
PCB_TEXT* pcbtxt = new PCB_TEXT( m_board );
m_board->Add( pcbtxt, ADD_MODE::APPEND );
pcbtxt->SetLayer( layer );
@ -767,8 +767,8 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
if( layer != UNDEFINED_LAYER ) // unsupported layer
{
DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board );
m_board->Add( dseg, ADD_MODE::APPEND );
PCB_SHAPE* shape = new PCB_SHAPE( m_board );
m_board->Add( shape, ADD_MODE::APPEND );
// with == 0 means filled circle
if( width <= 0 )
@ -777,11 +777,11 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
radius = radius / 2;
}
dseg->SetShape( S_CIRCLE );
dseg->SetLayer( layer );
dseg->SetStart( wxPoint( kicad_x( c.x ), kicad_y( c.y ) ) );
dseg->SetEnd( wxPoint( kicad_x( c.x ) + radius, kicad_y( c.y ) ) );
dseg->SetWidth( width );
shape->SetShape( S_CIRCLE );
shape->SetLayer( layer );
shape->SetStart( wxPoint( kicad_x( c.x ), kicad_y( c.y ) ) );
shape->SetEnd( wxPoint( kicad_x( c.x ) + radius, kicad_y( c.y ) ) );
shape->SetWidth( width );
}
}
m_xpath->pop();
@ -1384,8 +1384,8 @@ void EAGLE_PLUGIN::orientModuleAndText( MODULE* m, const EELEMENT& e, const EATT
}
void EAGLE_PLUGIN::orientModuleText( MODULE* m, const EELEMENT& e,
TEXTE_MODULE* txt, const EATTR* aAttr )
void EAGLE_PLUGIN::orientModuleText( MODULE* m, const EELEMENT& e, FP_TEXT* txt,
const EATTR* aAttr )
{
// Smashed part ?
if( aAttr )
@ -1609,18 +1609,18 @@ void EAGLE_PLUGIN::packageWire( MODULE* aModule, wxXmlNode* aTree ) const
// FIXME: the cap attribute is ignored because KiCad can't create lines
// with flat ends.
EDGE_MODULE* dwg;
FP_SHAPE* dwg;
if( !w.curve )
{
dwg = new EDGE_MODULE( aModule, S_SEGMENT );
dwg = new FP_SHAPE( aModule, S_SEGMENT );
dwg->SetStart0( start );
dwg->SetEnd0( end );
}
else
{
dwg = new EDGE_MODULE( aModule, S_ARC );
dwg = new FP_SHAPE( aModule, S_ARC );
wxPoint center = ConvertArcCenter( start, end, *w.curve );
dwg->SetStart0( center );
@ -1746,7 +1746,7 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, wxXmlNode* aTree ) const
if( layer == UNDEFINED_LAYER )
layer = Cmts_User;
TEXTE_MODULE* txt;
FP_TEXT* txt;
if( t.text == ">NAME" || t.text == ">name" )
txt = &aModule->Reference();
@ -1755,7 +1755,7 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, wxXmlNode* aTree ) const
else
{
// FIXME: graphical text items are rotated for some reason.
txt = new TEXTE_MODULE( aModule );
txt = new FP_TEXT( aModule );
aModule->Add( txt );
}
@ -1874,8 +1874,7 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, wxXmlNode* aTree ) const
else
{
PCB_LAYER_ID layer = kicad_layer( r.layer );
EDGE_MODULE* dwg = new EDGE_MODULE( aModule, S_POLYGON );
FP_SHAPE* dwg = new FP_SHAPE( aModule, S_POLYGON );
aModule->Add( dwg );
@ -1980,7 +1979,7 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const
else
{
PCB_LAYER_ID layer = kicad_layer( p.layer );
EDGE_MODULE* dwg = new EDGE_MODULE( aModule, S_POLYGON );
FP_SHAPE* dwg = new FP_SHAPE( aModule, S_POLYGON );
aModule->Add( dwg );
@ -2040,7 +2039,7 @@ void EAGLE_PLUGIN::packageCircle( MODULE* aModule, wxXmlNode* aTree ) const
else
{
PCB_LAYER_ID layer = kicad_layer( e.layer );
EDGE_MODULE* gr = new EDGE_MODULE( aModule, S_CIRCLE );
FP_SHAPE* gr = new FP_SHAPE( aModule, S_CIRCLE );
// with == 0 means filled circle
if( width <= 0 )

View File

@ -33,7 +33,7 @@
#include <wx/xml/xml.h>
class D_PAD;
class TEXTE_MODULE;
class FP_TEXT;
class ZONE_CONTAINER;
typedef std::map<wxString, MODULE*> MODULE_MAP;
@ -250,20 +250,12 @@ private:
ZONE_CONTAINER* loadPolygon( wxXmlNode* aPolyNode );
void orientModuleAndText( MODULE* m, const EELEMENT& e, const EATTR* nameAttr, const EATTR* valueAttr );
void orientModuleText( MODULE* m, const EELEMENT& e, TEXTE_MODULE* txt, const EATTR* a );
void orientModuleText( MODULE* m, const EELEMENT& e, FP_TEXT* txt, const EATTR* a );
/// move the BOARD into the center of the page
void centerBoard();
/**
* Function fmtDEG
* formats an angle in a way particular to a board file format. This function
* is the opposite or complement of degParse(). One has to know what the
* other is doing.
*/
wxString fmtDEG( double aAngle ) const;
/**
* Function makeModule
* creates a MODULE from an Eagle package.

View File

@ -39,7 +39,6 @@
#include <class_board.h>
#include <class_module.h>
#include <class_track.h>
#include <class_edge_mod.h>
#include <vector>
#include <cctype>
#include <math/util.h> // for KiROUND

View File

@ -31,7 +31,7 @@
#include <build_version.h>
#include <class_board.h>
#include <class_edge_mod.h>
#include <fp_shape.h>
#include <class_module.h>
#include <class_track.h>
#include <confirm.h>
@ -840,28 +840,24 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
mirror, flip );
// Text on silk layer: RefDes and value (are they actually useful?)
TEXTE_MODULE *textmod = &module->Reference();
for( int ii = 0; ii < 2; ii++ )
for( FP_TEXT* textItem : { &module->Reference(), &module->Value() } )
{
double txt_orient = textmod->GetTextAngle();
double txt_orient = textItem->GetTextAngle();
std::string layer = GenCADLayerName( cu_count, module->GetFlag() ? B_SilkS : F_SilkS );
fprintf( aFile, "TEXT %g %g %g %g %s %s \"%s\"",
textmod->GetPos0().x / SCALE_FACTOR,
-textmod->GetPos0().y / SCALE_FACTOR,
textmod->GetTextWidth() / SCALE_FACTOR,
textItem->GetPos0().x / SCALE_FACTOR,
-textItem->GetPos0().y / SCALE_FACTOR,
textItem->GetTextWidth() / SCALE_FACTOR,
txt_orient / 10.0,
mirror,
layer.c_str(),
TO_UTF8( escapeString( textmod->GetText() ) ) );
TO_UTF8( escapeString( textItem->GetText() ) ) );
// Please note, the width is approx
fprintf( aFile, " 0 0 %g %g\n",
( textmod->GetTextWidth() * textmod->GetLength() ) / SCALE_FACTOR,
textmod->GetTextHeight() / SCALE_FACTOR );
textmod = &module->Value(); // Dirty trick for the second iteration
( textItem->GetTextWidth() * textItem->GetLength() ) / SCALE_FACTOR,
textItem->GetTextHeight() / SCALE_FACTOR );
}
// The SHEET is a 'generic description' for referencing the component
@ -1090,7 +1086,7 @@ static void CreateBoardSection( FILE* aFile, BOARD* aPcb )
{
if( drawing->Type() == PCB_SHAPE_T )
{
DRAWSEGMENT* drawseg = static_cast<DRAWSEGMENT*>( drawing );
PCB_SHAPE* drawseg = static_cast<PCB_SHAPE*>( drawing );
if( drawseg->GetLayer() == Edge_Cuts )
{
@ -1142,7 +1138,7 @@ static void CreateTracksInfoData( FILE* aFile, BOARD* aPcb )
*/
static void FootprintWriteShape( FILE* aFile, MODULE* module, const wxString& aShapeName )
{
EDGE_MODULE* PtEdge;
FP_SHAPE* shape;
/* creates header: */
fprintf( aFile, "\nSHAPE \"%s\"\n", TO_UTF8( escapeString( aShapeName ) ) );
@ -1166,51 +1162,50 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module, const wxString& aS
break;
case PCB_FP_SHAPE_T:
PtEdge = (EDGE_MODULE*) PtStruct;
if( PtEdge->GetLayer() == F_SilkS || PtEdge->GetLayer() == B_SilkS )
shape = (FP_SHAPE*) PtStruct;
if( shape->GetLayer() == F_SilkS || shape->GetLayer() == B_SilkS )
{
switch( PtEdge->GetShape() )
switch( shape->GetShape() )
{
case S_SEGMENT:
fprintf( aFile, "LINE %g %g %g %g\n",
PtEdge->m_Start0.x / SCALE_FACTOR,
-PtEdge->m_Start0.y / SCALE_FACTOR,
PtEdge->m_End0.x / SCALE_FACTOR,
-PtEdge->m_End0.y / SCALE_FACTOR );
shape->m_Start0.x / SCALE_FACTOR,
-shape->m_Start0.y / SCALE_FACTOR,
shape->m_End0.x / SCALE_FACTOR,
-shape->m_End0.y / SCALE_FACTOR );
break;
case S_RECT:
{
fprintf( aFile, "LINE %g %g %g %g\n",
PtEdge->m_Start0.x / SCALE_FACTOR,
-PtEdge->m_Start0.y / SCALE_FACTOR,
PtEdge->m_End0.x / SCALE_FACTOR,
-PtEdge->m_Start0.y / SCALE_FACTOR );
shape->m_Start0.x / SCALE_FACTOR,
-shape->m_Start0.y / SCALE_FACTOR,
shape->m_End0.x / SCALE_FACTOR,
-shape->m_Start0.y / SCALE_FACTOR );
fprintf( aFile, "LINE %g %g %g %g\n",
PtEdge->m_End0.x / SCALE_FACTOR,
-PtEdge->m_Start0.y / SCALE_FACTOR,
PtEdge->m_End0.x / SCALE_FACTOR,
-PtEdge->m_End0.y / SCALE_FACTOR );
shape->m_End0.x / SCALE_FACTOR,
-shape->m_Start0.y / SCALE_FACTOR,
shape->m_End0.x / SCALE_FACTOR,
-shape->m_End0.y / SCALE_FACTOR );
fprintf( aFile, "LINE %g %g %g %g\n",
PtEdge->m_End0.x / SCALE_FACTOR,
-PtEdge->m_End0.y / SCALE_FACTOR,
PtEdge->m_Start0.x / SCALE_FACTOR,
-PtEdge->m_End0.y / SCALE_FACTOR );
shape->m_End0.x / SCALE_FACTOR,
-shape->m_End0.y / SCALE_FACTOR,
shape->m_Start0.x / SCALE_FACTOR,
-shape->m_End0.y / SCALE_FACTOR );
fprintf( aFile, "LINE %g %g %g %g\n",
PtEdge->m_Start0.x / SCALE_FACTOR,
-PtEdge->m_End0.y / SCALE_FACTOR,
PtEdge->m_Start0.x / SCALE_FACTOR,
-PtEdge->m_Start0.y / SCALE_FACTOR );
shape->m_Start0.x / SCALE_FACTOR,
-shape->m_End0.y / SCALE_FACTOR,
shape->m_Start0.x / SCALE_FACTOR,
-shape->m_Start0.y / SCALE_FACTOR );
}
break;
case S_CIRCLE:
{
int radius = KiROUND( GetLineLength( PtEdge->m_End0,
PtEdge->m_Start0 ) );
int radius = KiROUND( GetLineLength( shape->m_End0, shape->m_Start0 ) );
fprintf( aFile, "CIRCLE %g %g %g\n",
PtEdge->m_Start0.x / SCALE_FACTOR,
-PtEdge->m_Start0.y / SCALE_FACTOR,
shape->m_Start0.x / SCALE_FACTOR,
-shape->m_Start0.y / SCALE_FACTOR,
radius / SCALE_FACTOR );
break;
}
@ -1218,19 +1213,19 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module, const wxString& aS
case S_ARC:
{
int arcendx, arcendy;
arcendx = PtEdge->m_End0.x - PtEdge->m_Start0.x;
arcendy = PtEdge->m_End0.y - PtEdge->m_Start0.y;
RotatePoint( &arcendx, &arcendy, -PtEdge->GetAngle() );
arcendx += PtEdge->GetStart0().x;
arcendy += PtEdge->GetStart0().y;
arcendx = shape->m_End0.x - shape->m_Start0.x;
arcendy = shape->m_End0.y - shape->m_Start0.y;
RotatePoint( &arcendx, &arcendy, -shape->GetAngle() );
arcendx += shape->GetStart0().x;
arcendy += shape->GetStart0().y;
fprintf( aFile, "ARC %g %g %g %g %g %g\n",
PtEdge->m_End0.x / SCALE_FACTOR,
-PtEdge->GetEnd0().y / SCALE_FACTOR,
arcendx / SCALE_FACTOR,
-arcendy / SCALE_FACTOR,
PtEdge->GetStart0().x / SCALE_FACTOR,
-PtEdge->GetStart0().y / SCALE_FACTOR );
shape->m_End0.x / SCALE_FACTOR,
-shape->GetEnd0().y / SCALE_FACTOR,
arcendx / SCALE_FACTOR,
-arcendy / SCALE_FACTOR,
shape->GetStart0().x / SCALE_FACTOR,
-shape->GetStart0().y / SCALE_FACTOR );
break;
}

View File

@ -25,7 +25,6 @@
#include <pcb_edit_frame.h>
#include <class_board.h>
#include <class_board_item.h>
#include <class_drawsegment.h>
#include <class_module.h>
#include <class_track.h>
#include <class_zone.h>

View File

@ -31,7 +31,7 @@
#include <pcbnew.h>
#include <class_board.h>
#include <class_module.h>
#include <class_edge_mod.h>
#include <fp_shape.h>
#include <idf_parser.h>
#include <3d_cache/3d_info.h>
#include <build_version.h>
@ -60,7 +60,7 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
{
double scale = aIDFBoard.GetUserScale();
DRAWSEGMENT* graphic; // KiCad graphical item
PCB_SHAPE* graphic; // KiCad graphical item
IDF_POINT sp, ep; // start and end points from KiCad item
std::list< IDF_SEGMENT* > lines; // IDF intermediate form of KiCad graphical item
@ -80,7 +80,7 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
if( item->Type() != PCB_SHAPE_T || item->GetLayer() != Edge_Cuts )
continue;
graphic = (DRAWSEGMENT*) item;
graphic = (PCB_SHAPE*) item;
switch( graphic->GetShape() )
{

View File

@ -33,9 +33,9 @@
#include "3d_cache/3d_cache.h"
#include "3d_cache/3d_info.h"
#include "class_board.h"
#include "class_edge_mod.h"
#include "fp_shape.h"
#include "class_module.h"
#include "class_pcb_text.h"
#include "pcb_text.h"
#include "class_track.h"
#include "class_zone.h"
#include "convert_to_biu.h"
@ -656,8 +656,8 @@ static void export_vrml_arc( MODEL_VRML& aModel, LAYER_NUM layer,
}
static void export_vrml_polygon( MODEL_VRML& aModel, LAYER_NUM layer,
DRAWSEGMENT *aOutline, double aOrientation, wxPoint aPos )
static void export_vrml_polygon( MODEL_VRML& aModel, LAYER_NUM layer, PCB_SHAPE *aOutline,
double aOrientation, wxPoint aPos )
{
if( aOutline->IsPolyShapeValid() )
{
@ -692,7 +692,7 @@ static void export_vrml_polygon( MODEL_VRML& aModel, LAYER_NUM layer,
}
static void export_vrml_drawsegment( MODEL_VRML& aModel, DRAWSEGMENT* drawseg )
static void export_vrml_drawsegment( MODEL_VRML& aModel, PCB_SHAPE* drawseg )
{
LAYER_NUM layer = drawseg->GetLayer();
double w = drawseg->GetWidth() * BOARD_SCALE;
@ -759,7 +759,7 @@ static void vrml_text_callback( int x0, int y0, int xf, int yf, void* aData )
}
static void export_vrml_pcbtext( MODEL_VRML& aModel, TEXTE_PCB* text )
static void export_vrml_pcbtext( MODEL_VRML& aModel, PCB_TEXT* text )
{
wxSize size = text->GetTextSize();
@ -810,11 +810,11 @@ static void export_vrml_drawings( MODEL_VRML& aModel, BOARD* pcb )
switch( drawing->Type() )
{
case PCB_SHAPE_T:
export_vrml_drawsegment( aModel, (DRAWSEGMENT*) drawing );
export_vrml_drawsegment( aModel, (PCB_SHAPE*) drawing );
break;
case PCB_TEXT_T:
export_vrml_pcbtext( aModel, (TEXTE_PCB*) drawing );
export_vrml_pcbtext( aModel, (PCB_TEXT*) drawing );
break;
default:
@ -1047,7 +1047,7 @@ static void export_vrml_zones( MODEL_VRML& aModel, BOARD* aPcb, COMMIT* aCommit
}
static void export_vrml_text_module( TEXTE_MODULE* item )
static void export_vrml_text_module( FP_TEXT* item )
{
if( item->IsVisible() )
{
@ -1069,8 +1069,7 @@ static void export_vrml_text_module( TEXTE_MODULE* item )
}
static void export_vrml_edge_module( MODEL_VRML& aModel, EDGE_MODULE* aOutline,
MODULE* aModule )
static void export_vrml_edge_module( MODEL_VRML& aModel, FP_SHAPE* aOutline, MODULE* aModule )
{
LAYER_NUM layer = aOutline->GetLayer();
double x = aOutline->GetStart().x * BOARD_SCALE;
@ -1381,11 +1380,11 @@ static void export_vrml_module( MODEL_VRML& aModel, BOARD* aPcb,
switch( item->Type() )
{
case PCB_FP_TEXT_T:
export_vrml_text_module( static_cast<TEXTE_MODULE*>( item ) );
export_vrml_text_module( static_cast<FP_TEXT*>( item ) );
break;
case PCB_FP_SHAPE_T:
export_vrml_edge_module( aModel, static_cast<EDGE_MODULE*>( item ), aModule );
export_vrml_edge_module( aModel, static_cast<FP_SHAPE*>( item ), aModule );
break;
default:

View File

@ -192,11 +192,11 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
switch( PtStruct->Type() )
{
case PCB_SHAPE_T:
itemplotter.PlotDrawSegment( (DRAWSEGMENT*) PtStruct );
itemplotter.PlotPcbShape( (PCB_SHAPE*) PtStruct );
break;
case PCB_TEXT_T:
itemplotter.PlotTextePcb( (TEXTE_PCB*) PtStruct );
itemplotter.PlotPcbText( (PCB_TEXT*) PtStruct );
break;
case PCB_DIM_ALIGNED_T:

View File

@ -301,7 +301,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
for( BOARD_ITEM* item : footprint->GraphicalItems() )
{
if( item->Type() == PCB_FP_SHAPE_T && item->GetLayer() == Edge_Cuts )
brd_plotter.PlotFootprintGraphicItem((EDGE_MODULE*) item );
brd_plotter.PlotFootprintGraphicItem( (FP_SHAPE*) item );
}
}
}

View File

@ -478,7 +478,7 @@ int PCB_EDIT_FRAME::inferLegacyEdgeClearance( BOARD* aBoard )
{
if( collector[i]->Type() == PCB_SHAPE_T )
{
int itemWidth = static_cast<DRAWSEGMENT*>( collector[i] )->GetWidth();
int itemWidth = static_cast<PCB_SHAPE*>( collector[i] )->GetWidth();
if( edgeWidth != -1 && edgeWidth != itemWidth )
{

View File

@ -28,7 +28,6 @@
class PCB_LAYER_BOX_SELECTOR;
class FP_LIB_TABLE;
class EDGE_MODULE;
class FOOTPRINT_TREE_PANE;
class LIB_MANAGER;
class FOOTPRINT_EDITOR_SETTINGS;

View File

@ -24,7 +24,7 @@
#include <3d_viewer/eda_3d_viewer.h>
#include <board_commit.h>
#include <class_board.h>
#include <class_edge_mod.h>
#include <fp_shape.h>
#include <class_module.h>
#include <confirm.h>
#include <dialog_create_array.h>
@ -81,17 +81,17 @@ void FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary( LIB_ID aFPID)
// if either m_Reference or m_Value are gone, reinstall them -
// otherwise you cannot see what you are doing on board
TEXTE_MODULE* ref = &fp->Reference();
TEXTE_MODULE* val = &fp->Value();
FP_TEXT* ref = &fp->Reference();
FP_TEXT* val = &fp->Value();
if( val && ref )
{
ref->SetType( TEXTE_MODULE::TEXT_is_REFERENCE ); // just in case ...
ref->SetType( FP_TEXT::TEXT_is_REFERENCE ); // just in case ...
if( ref->GetLength() == 0 )
ref->SetText( wxT( "Ref**" ) );
val->SetType( TEXTE_MODULE::TEXT_is_VALUE ); // just in case ...
val->SetType( FP_TEXT::TEXT_is_VALUE ); // just in case ...
if( val->GetLength() == 0 )
val->SetText( wxT( "Val**" ) );

View File

@ -1053,7 +1053,7 @@ MODULE* PCB_BASE_FRAME::CreateNewModule( const wxString& aModuleName )
for( size_t i = 2; i < settings.m_DefaultFPTextItems.size(); ++i )
{
TEXTE_MODULE* textItem = new TEXTE_MODULE( module );
FP_TEXT* textItem = new FP_TEXT( module );
textItem->SetText( settings.m_DefaultFPTextItems[i].m_Text );
textItem->SetVisible( settings.m_DefaultFPTextItems[i].m_Visible );
txt_layer = (PCB_LAYER_ID) settings.m_DefaultFPTextItems[i].m_Layer;
@ -1075,8 +1075,8 @@ MODULE* PCB_BASE_FRAME::CreateNewModule( const wxString& aModuleName )
{
if( aChild->Type() == PCB_FP_TEXT_T )
{
TEXTE_MODULE* textItem = static_cast<TEXTE_MODULE*>( aChild );
PCB_LAYER_ID layer = textItem->GetLayer();
FP_TEXT* textItem = static_cast<FP_TEXT*>( aChild );
PCB_LAYER_ID layer = textItem->GetLayer();
textItem->SetTextThickness( settings.GetTextThickness( layer ) );
textItem->SetTextSize( settings.GetTextSize( layer ) );

View File

@ -31,12 +31,12 @@
#include <pcb_edit_frame.h>
#include <class_board.h>
#include <class_module.h>
#include <class_edge_mod.h>
#include <fp_shape.h>
#include <view/view.h>
EDGE_MODULE::EDGE_MODULE( MODULE* parent, PCB_SHAPE_TYPE_T aShape ) :
DRAWSEGMENT( parent, PCB_FP_SHAPE_T )
FP_SHAPE::FP_SHAPE( MODULE* parent, PCB_SHAPE_TYPE_T aShape ) :
PCB_SHAPE( parent, PCB_FP_SHAPE_T )
{
m_Shape = aShape;
m_Angle = 0;
@ -44,12 +44,12 @@ EDGE_MODULE::EDGE_MODULE( MODULE* parent, PCB_SHAPE_TYPE_T aShape ) :
}
EDGE_MODULE::~EDGE_MODULE()
FP_SHAPE::~FP_SHAPE()
{
}
void EDGE_MODULE::SetLocalCoord()
void FP_SHAPE::SetLocalCoord()
{
MODULE* module = (MODULE*) m_Parent;
@ -77,7 +77,7 @@ void EDGE_MODULE::SetLocalCoord()
}
void EDGE_MODULE::SetDrawCoord()
void FP_SHAPE::SetDrawCoord()
{
MODULE* module = (MODULE*) m_Parent;
@ -107,7 +107,7 @@ void EDGE_MODULE::SetDrawCoord()
// see class_edge_mod.h
void EDGE_MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
void FP_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{
wxString msg;
@ -124,11 +124,11 @@ void EDGE_MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL
aList.emplace_back( _( "Footprint" ), module->GetReference(), DARKCYAN );
// append the features shared with the base class
DRAWSEGMENT::GetMsgPanelInfo( aFrame, aList );
PCB_SHAPE::GetMsgPanelInfo( aFrame, aList );
}
wxString EDGE_MODULE::GetSelectMenuText( EDA_UNITS aUnits ) const
wxString FP_SHAPE::GetSelectMenuText( EDA_UNITS aUnits ) const
{
return wxString::Format( _( "%s on %s" ),
ShowShape( m_Shape ),
@ -136,19 +136,19 @@ wxString EDGE_MODULE::GetSelectMenuText( EDA_UNITS aUnits ) const
}
BITMAP_DEF EDGE_MODULE::GetMenuImage() const
BITMAP_DEF FP_SHAPE::GetMenuImage() const
{
return show_mod_edge_xpm;
}
EDA_ITEM* EDGE_MODULE::Clone() const
EDA_ITEM* FP_SHAPE::Clone() const
{
return new EDGE_MODULE( *this );
return new FP_SHAPE( *this );
}
void EDGE_MODULE::SetAngle( double aAngle )
void FP_SHAPE::SetAngle( double aAngle )
{
// Mark as depreciated.
// m_Angle does not define the arc anymore
@ -159,7 +159,7 @@ void EDGE_MODULE::SetAngle( double aAngle )
}
void EDGE_MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
void FP_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
{
wxPoint pt( 0, 0 );
@ -213,20 +213,20 @@ void EDGE_MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
break;
}
// DRAWSEGMENT items are not usually on copper layers, but it can happen in microwave apps.
// PCB_SHAPE items are not usually on copper layers, but it can happen in microwave apps.
// However, currently, only on Front or Back layers.
// So the copper layers count is not taken in account
SetLayer( FlipLayer( GetLayer() ) );
}
bool EDGE_MODULE::IsParentFlipped() const
bool FP_SHAPE::IsParentFlipped() const
{
if( GetParent() && GetParent()->GetLayer() == B_Cu )
return true;
return false;
}
void EDGE_MODULE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
void FP_SHAPE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
{
// Mirror an edge of the footprint. the layer is not modified
// This is a footprint shape modification.
@ -274,18 +274,18 @@ void EDGE_MODULE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
SetDrawCoord();
}
void EDGE_MODULE::Rotate( const wxPoint& aRotCentre, double aAngle )
void FP_SHAPE::Rotate( const wxPoint& aRotCentre, double aAngle )
{
// We should rotate the relative coordinates, but to avoid duplicate code do the base class
// rotation of draw coordinates, which is acceptable because in module editor, m_Pos0 = m_Pos
DRAWSEGMENT::Rotate( aRotCentre, aAngle );
PCB_SHAPE::Rotate( aRotCentre, aAngle );
// and now update the relative coordinates, which are the reference in most transforms.
SetLocalCoord();
}
void EDGE_MODULE::Move( const wxPoint& aMoveVector )
void FP_SHAPE::Move( const wxPoint& aMoveVector )
{
// Move an edge of the footprint.
// This is a footprint shape modification.
@ -312,7 +312,7 @@ void EDGE_MODULE::Move( const wxPoint& aMoveVector )
}
double EDGE_MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
double FP_SHAPE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
{
constexpr double HIDE = std::numeric_limits<double>::max();
@ -336,7 +336,7 @@ static struct EDGE_MODULE_DESC
EDGE_MODULE_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( EDGE_MODULE );
propMgr.InheritsAfter( TYPE_HASH( EDGE_MODULE ), TYPE_HASH( DRAWSEGMENT ) );
REGISTER_TYPE( FP_SHAPE );
propMgr.InheritsAfter( TYPE_HASH( FP_SHAPE ), TYPE_HASH( PCB_SHAPE ) );
}
} _EDGE_MODULE_DESC;

View File

@ -23,33 +23,28 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file class_edge_mod.h
* @brief EDGE_MODULE class definition.
*/
#ifndef CLASS_EDGE_MOD_H_
#define CLASS_EDGE_MOD_H_
#ifndef FP_SHAPE_H
#define FP_SHAPE_H
#include <wx/gdicmn.h>
#include <class_drawsegment.h>
#include <pcb_shape.h>
class LINE_READER;
class MSG_PANEL_ITEM;
class EDGE_MODULE : public DRAWSEGMENT
class FP_SHAPE : public PCB_SHAPE
{
public:
EDGE_MODULE( MODULE* parent, PCB_SHAPE_TYPE_T aShape = S_SEGMENT );
FP_SHAPE( MODULE* parent, PCB_SHAPE_TYPE_T aShape = S_SEGMENT );
// Do not create a copy constructor & operator=.
// The ones generated by the compiler are adequate.
~EDGE_MODULE();
~FP_SHAPE();
static inline bool ClassOf( const EDA_ITEM* aItem )
{
@ -161,4 +156,4 @@ public:
wxPoint m_Bezier0_C2; ///< Bezier Control Point 2, relative to module origin, orient 0.
};
#endif // CLASS_EDGE_MOD_H_
#endif // FP_SHAPE_H

View File

@ -30,7 +30,7 @@
#include <class_module.h>
#include <settings/settings_manager.h>
TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, TEXT_TYPE text_type ) :
FP_TEXT::FP_TEXT( MODULE* parent, TEXT_TYPE text_type ) :
BOARD_ITEM( parent, PCB_FP_TEXT_T ),
EDA_TEXT()
{
@ -59,18 +59,18 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, TEXT_TYPE text_type ) :
}
TEXTE_MODULE::~TEXTE_MODULE()
FP_TEXT::~FP_TEXT()
{
}
void TEXTE_MODULE::SetTextAngle( double aAngle )
void FP_TEXT::SetTextAngle( double aAngle )
{
EDA_TEXT::SetTextAngle( NormalizeAngle360Min( aAngle ) );
}
bool TEXTE_MODULE::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
bool FP_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
EDA_RECT rect = GetTextBox();
wxPoint location = aPoint;
@ -83,7 +83,7 @@ bool TEXTE_MODULE::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
}
bool TEXTE_MODULE::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
bool FP_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
{
EDA_RECT rect = aRect;
@ -96,7 +96,7 @@ bool TEXTE_MODULE::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccu
}
void TEXTE_MODULE::KeepUpright( double aOldOrientation, double aNewOrientation )
void FP_TEXT::KeepUpright( double aOldOrientation, double aNewOrientation )
{
if( !IsKeepUpright() )
return;
@ -123,7 +123,7 @@ void TEXTE_MODULE::KeepUpright( double aOldOrientation, double aNewOrientation )
}
void TEXTE_MODULE::Rotate( const wxPoint& aRotCentre, double aAngle )
void FP_TEXT::Rotate( const wxPoint& aRotCentre, double aAngle )
{
// Used in footprint editing
// Note also in module editor, m_Pos0 = m_Pos
@ -137,7 +137,7 @@ void TEXTE_MODULE::Rotate( const wxPoint& aRotCentre, double aAngle )
}
void TEXTE_MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
void FP_TEXT::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
{
// flipping the footprint is relative to the X axis
if( aFlipLeftRight )
@ -159,7 +159,7 @@ void TEXTE_MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
}
}
bool TEXTE_MODULE::IsParentFlipped() const
bool FP_TEXT::IsParentFlipped() const
{
if( GetParent() && GetParent()->GetLayer() == B_Cu )
return true;
@ -167,7 +167,7 @@ bool TEXTE_MODULE::IsParentFlipped() const
}
void TEXTE_MODULE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
void FP_TEXT::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
{
// Used in modedit, to transform the footprint
// the mirror is around the Y axis or X axis if aMirrorAroundXAxis = true
@ -181,20 +181,20 @@ void TEXTE_MODULE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
}
void TEXTE_MODULE::Move( const wxPoint& aMoveVector )
void FP_TEXT::Move( const wxPoint& aMoveVector )
{
Offset( aMoveVector );
SetLocalCoord();
}
int TEXTE_MODULE::GetLength() const
int FP_TEXT::GetLength() const
{
return GetText().Len();
}
void TEXTE_MODULE::SetDrawCoord()
void FP_TEXT::SetDrawCoord()
{
const MODULE* module = static_cast<const MODULE*>( m_Parent );
@ -213,7 +213,7 @@ void TEXTE_MODULE::SetDrawCoord()
}
void TEXTE_MODULE::SetLocalCoord()
void FP_TEXT::SetLocalCoord()
{
const MODULE* module = static_cast<const MODULE*>( m_Parent );
@ -231,7 +231,7 @@ void TEXTE_MODULE::SetLocalCoord()
}
}
const EDA_RECT TEXTE_MODULE::GetBoundingBox() const
const EDA_RECT FP_TEXT::GetBoundingBox() const
{
double angle = GetDrawRotation();
EDA_RECT text_area = GetTextBox();
@ -243,7 +243,7 @@ const EDA_RECT TEXTE_MODULE::GetBoundingBox() const
}
double TEXTE_MODULE::GetDrawRotation() const
double FP_TEXT::GetDrawRotation() const
{
MODULE* module = (MODULE*) m_Parent;
double rotation = GetTextAngle();
@ -270,7 +270,7 @@ double TEXTE_MODULE::GetDrawRotation() const
// see class_text_mod.h
void TEXTE_MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
void FP_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{
MODULE* module = (MODULE*) m_Parent;
@ -324,7 +324,7 @@ void TEXTE_MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANE
}
wxString TEXTE_MODULE::GetSelectMenuText( EDA_UNITS aUnits ) const
wxString FP_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
{
switch( m_Type )
{
@ -345,19 +345,19 @@ wxString TEXTE_MODULE::GetSelectMenuText( EDA_UNITS aUnits ) const
}
BITMAP_DEF TEXTE_MODULE::GetMenuImage() const
BITMAP_DEF FP_TEXT::GetMenuImage() const
{
return footprint_text_xpm;
}
EDA_ITEM* TEXTE_MODULE::Clone() const
EDA_ITEM* FP_TEXT::Clone() const
{
return new TEXTE_MODULE( *this );
return new FP_TEXT( *this );
}
const BOX2I TEXTE_MODULE::ViewBBox() const
const BOX2I FP_TEXT::ViewBBox() const
{
double angle = GetDrawRotation();
EDA_RECT text_area = GetTextBox();
@ -369,7 +369,7 @@ const BOX2I TEXTE_MODULE::ViewBBox() const
}
void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
void FP_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
{
if( IsVisible() )
aLayers[0] = GetLayer();
@ -380,7 +380,7 @@ void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
}
double TEXTE_MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
double FP_TEXT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
{
constexpr double HIDE = (double)std::numeric_limits<double>::max();
@ -418,7 +418,7 @@ double TEXTE_MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
}
wxString TEXTE_MODULE::GetShownText( int aDepth ) const
wxString FP_TEXT::GetShownText( int aDepth ) const
{
const MODULE* module = static_cast<MODULE*>( GetParent() );
wxASSERT( module );
@ -454,7 +454,7 @@ wxString TEXTE_MODULE::GetShownText( int aDepth ) const
}
std::shared_ptr<SHAPE> TEXTE_MODULE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
std::shared_ptr<SHAPE> FP_TEXT::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
{
return GetEffectiveTextShape();
}
@ -465,10 +465,10 @@ static struct TEXTE_MODULE_DESC
TEXTE_MODULE_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( TEXTE_MODULE );
propMgr.AddTypeCast( new TYPE_CAST<TEXTE_MODULE, BOARD_ITEM> );
propMgr.AddTypeCast( new TYPE_CAST<TEXTE_MODULE, EDA_TEXT> );
propMgr.InheritsAfter( TYPE_HASH( TEXTE_MODULE ), TYPE_HASH( BOARD_ITEM ) );
propMgr.InheritsAfter( TYPE_HASH( TEXTE_MODULE ), TYPE_HASH( EDA_TEXT ) );
REGISTER_TYPE( FP_TEXT );
propMgr.AddTypeCast( new TYPE_CAST<FP_TEXT, BOARD_ITEM> );
propMgr.AddTypeCast( new TYPE_CAST<FP_TEXT, EDA_TEXT> );
propMgr.InheritsAfter( TYPE_HASH( FP_TEXT ), TYPE_HASH( BOARD_ITEM ) );
propMgr.InheritsAfter( TYPE_HASH( FP_TEXT ), TYPE_HASH( EDA_TEXT ) );
}
} _TEXTE_MODULE_DESC;

View File

@ -22,14 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file class_text_mod.h
* @brief Footprint text class description.
*/
#ifndef TEXT_MODULE_H_
#define TEXT_MODULE_H_
#ifndef FP_TEXT_H
#define FP_TEXT_H
#include <eda_text.h>
@ -46,7 +40,7 @@ class SHAPE;
#define UMBILICAL_COLOR LIGHTBLUE
class TEXTE_MODULE : public BOARD_ITEM, public EDA_TEXT
class FP_TEXT : public BOARD_ITEM, public EDA_TEXT
{
public:
/** Text module type: there must be only one (and only one) for each
@ -62,12 +56,12 @@ public:
TEXT_is_DIVERS = 2
};
TEXTE_MODULE( MODULE* parent, TEXT_TYPE text_type = TEXT_is_DIVERS );
FP_TEXT( MODULE* parent, TEXT_TYPE text_type = TEXT_is_DIVERS );
// Do not create a copy constructor & operator=.
// The ones generated by the compiler are adequate.
~TEXTE_MODULE();
~FP_TEXT();
static inline bool ClassOf( const EDA_ITEM* aItem )
{
@ -152,7 +146,7 @@ public:
* Function SetEffects
* sets the text effects from another instance.
*/
void SetEffects( const TEXTE_MODULE& aSrc )
void SetEffects( const FP_TEXT& aSrc )
{
EDA_TEXT::SetEffects( aSrc );
SetLocalCoord();
@ -163,7 +157,7 @@ public:
* Function SwapEffects
* swaps the text effects of the two involved instances.
*/
void SwapEffects( TEXTE_MODULE& aTradingPartner )
void SwapEffects( FP_TEXT& aTradingPartner )
{
EDA_TEXT::SwapEffects( aTradingPartner );
SetLocalCoord();
@ -249,4 +243,4 @@ private:
};
#endif // TEXT_MODULE_H_
#endif // FP_TEXT_H

View File

@ -34,9 +34,9 @@
#include <class_board.h>
#include <class_module.h>
#include <class_pcb_text.h>
#include <class_drawsegment.h>
#include <class_edge_mod.h>
#include <pcb_text.h>
#include <pcb_shape.h>
#include <fp_shape.h>
#include <gpcb_plugin.h>
#include <wx/dir.h>
@ -462,16 +462,16 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
aLineReader->LineNumber(), 0 );
}
EDGE_MODULE* drawSeg = new EDGE_MODULE( module.get() );
drawSeg->SetLayer( F_SilkS );
drawSeg->SetShape( S_SEGMENT );
drawSeg->SetStart0( wxPoint( parseInt( parameters[2], conv_unit ),
parseInt( parameters[3], conv_unit ) ) );
drawSeg->SetEnd0( wxPoint( parseInt( parameters[4], conv_unit ),
parseInt( parameters[5], conv_unit ) ) );
drawSeg->SetWidth( parseInt( parameters[6], conv_unit ) );
drawSeg->SetDrawCoord();
module->Add( drawSeg );
FP_SHAPE* shape = new FP_SHAPE( module.get() );
shape->SetLayer( F_SilkS );
shape->SetShape( S_SEGMENT );
shape->SetStart0( wxPoint( parseInt( parameters[2], conv_unit ),
parseInt( parameters[3], conv_unit ) ) );
shape->SetEnd0( wxPoint( parseInt( parameters[4], conv_unit ),
parseInt( parameters[5], conv_unit ) ) );
shape->SetWidth( parseInt( parameters[6], conv_unit ) );
shape->SetDrawCoord();
module->Add( shape );
continue;
}
@ -486,10 +486,10 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
}
// Pcbnew does know ellipse so we must have Width = Height
EDGE_MODULE* drawSeg = new EDGE_MODULE( module.get() );
drawSeg->SetLayer( F_SilkS );
drawSeg->SetShape( S_ARC );
module->Add( drawSeg );
FP_SHAPE* shape = new FP_SHAPE( module.get() );
shape->SetLayer( F_SilkS );
shape->SetShape( S_ARC );
module->Add( shape );
// for and arc: ibuf[3] = ibuf[4]. Pcbnew does not know ellipses
int radius = ( parseInt( parameters[4], conv_unit ) +
@ -498,7 +498,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
wxPoint centre( parseInt( parameters[2], conv_unit ),
parseInt( parameters[3], conv_unit ) );
drawSeg->SetStart0( centre );
shape->SetStart0( centre );
// Pcbnew start angles are inverted and 180 degrees from Geda PCB angles.
double start_angle = parseInt( parameters[6], -10.0 ) + 1800.0;
@ -508,18 +508,18 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
// Geda PCB does not support circles.
if( sweep_angle == -3600.0 )
drawSeg->SetShape( S_CIRCLE );
shape->SetShape( S_CIRCLE );
// Angle value is clockwise in gpcb and Pcbnew.
drawSeg->SetAngle( sweep_angle );
drawSeg->SetEnd0( wxPoint( radius, 0 ) );
shape->SetAngle( sweep_angle );
shape->SetEnd0( wxPoint( radius, 0 ) );
// Calculate start point coordinate of arc
wxPoint arcStart( drawSeg->GetEnd0() );
wxPoint arcStart( shape->GetEnd0() );
RotatePoint( &arcStart, -start_angle );
drawSeg->SetEnd0( centre + arcStart );
drawSeg->SetWidth( parseInt( parameters[8], conv_unit ) );
drawSeg->SetDrawCoord();
shape->SetEnd0( centre + arcStart );
shape->SetWidth( parseInt( parameters[8], conv_unit ) );
shape->SetDrawCoord();
continue;
}

View File

@ -26,8 +26,8 @@
#include <reporter.h>
#include <board_commit.h>
#include <cleanup_item.h>
#include <class_drawsegment.h>
#include <class_edge_mod.h>
#include <pcb_shape.h>
#include <fp_shape.h>
#include <graphics_cleaner.h>
@ -64,7 +64,7 @@ void GRAPHICS_CLEANER::CleanupBoard( bool aDryRun, std::vector<std::shared_ptr<C
}
bool GRAPHICS_CLEANER::isNullSegment( DRAWSEGMENT* aSegment )
bool GRAPHICS_CLEANER::isNullSegment( PCB_SHAPE* aSegment )
{
switch( aSegment->GetShape() )
{
@ -87,47 +87,47 @@ bool GRAPHICS_CLEANER::isNullSegment( DRAWSEGMENT* aSegment )
return aSegment->GetBezierPoints().empty();
default:
wxFAIL_MSG( "GRAPHICS_CLEANER::isNullSegment unsupported DRAWSEGMENT shape: "
wxFAIL_MSG( "GRAPHICS_CLEANER::isNullSegment unsupported PCB_SHAPE shape: "
+ PCB_SHAPE_TYPE_T_asString( aSegment->GetShape()) );
return false;
}
}
bool GRAPHICS_CLEANER::areEquivalent( DRAWSEGMENT* aSegment1, DRAWSEGMENT* aSegment2 )
bool GRAPHICS_CLEANER::areEquivalent( PCB_SHAPE* aShape1, PCB_SHAPE* aShape2 )
{
if( aSegment1->GetShape() != aSegment2->GetShape()
|| aSegment1->GetLayer() != aSegment2->GetLayer()
|| aSegment1->GetWidth() != aSegment2->GetWidth() )
if( aShape1->GetShape() != aShape2->GetShape()
|| aShape1->GetLayer() != aShape2->GetLayer()
|| aShape1->GetWidth() != aShape2->GetWidth() )
{
return false;
}
switch( aSegment1->GetShape() )
switch( aShape1->GetShape() )
{
case S_SEGMENT:
case S_RECT:
case S_CIRCLE:
return aSegment1->GetStart() == aSegment2->GetStart()
&& aSegment1->GetEnd() == aSegment2->GetEnd();
return aShape1->GetStart() == aShape2->GetStart()
&& aShape1->GetEnd() == aShape2->GetEnd();
case S_ARC:
return aSegment1->GetCenter() == aSegment2->GetCenter()
&& aSegment1->GetArcStart() == aSegment2->GetArcStart()
&& aSegment1->GetAngle() == aSegment2->GetAngle();
return aShape1->GetCenter() == aShape2->GetCenter()
&& aShape1->GetArcStart() == aShape2->GetArcStart()
&& aShape1->GetAngle() == aShape2->GetAngle();
case S_POLYGON:
// TODO
return false;
case S_CURVE:
return aSegment1->GetBezControl1() == aSegment2->GetBezControl1()
&& aSegment1->GetBezControl2() == aSegment2->GetBezControl2()
&& aSegment1->GetBezierPoints() == aSegment2->GetBezierPoints();
return aShape1->GetBezControl1() == aShape2->GetBezControl1()
&& aShape1->GetBezControl2() == aShape2->GetBezControl2()
&& aShape1->GetBezierPoints() == aShape2->GetBezierPoints();
default:
wxFAIL_MSG( "GRAPHICS_CLEANER::areEquivalent unsupported DRAWSEGMENT shape: "
+ PCB_SHAPE_TYPE_T_asString( aSegment1->GetShape()) );
wxFAIL_MSG( "GRAPHICS_CLEANER::areEquivalent unsupported PCB_SHAPE shape: "
+ PCB_SHAPE_TYPE_T_asString( aShape1->GetShape()) );
return false;
}
}
@ -138,7 +138,7 @@ void GRAPHICS_CLEANER::cleanupSegments()
// Remove duplicate segments (2 superimposed identical segments):
for( auto it = m_drawings.begin(); it != m_drawings.end(); it++ )
{
DRAWSEGMENT* segment = dynamic_cast<DRAWSEGMENT*>( *it );
PCB_SHAPE* segment = dynamic_cast<PCB_SHAPE*>( *it );
if( !segment || segment->GetShape() != S_SEGMENT || segment->HasFlag( IS_DELETED ) )
continue;
@ -157,7 +157,7 @@ void GRAPHICS_CLEANER::cleanupSegments()
for( auto it2 = it + 1; it2 != m_drawings.end(); it2++ )
{
DRAWSEGMENT* segment2 = dynamic_cast<DRAWSEGMENT*>( *it2 );
PCB_SHAPE* segment2 = dynamic_cast<PCB_SHAPE*>( *it2 );
if( !segment2 || segment2->HasFlag( IS_DELETED ) )
continue;
@ -182,18 +182,18 @@ void GRAPHICS_CLEANER::mergeRects()
{
struct SIDE_CANDIDATE
{
SIDE_CANDIDATE( DRAWSEGMENT* aSeg ) :
start( aSeg->GetStart() ),
end( aSeg->GetEnd() ),
seg( aSeg )
SIDE_CANDIDATE( PCB_SHAPE* aShape ) :
start( aShape->GetStart() ),
end( aShape->GetEnd() ),
shape( aShape )
{
if( start.x > end.x || start.y > end.y )
std::swap( start, end );
}
wxPoint start;
wxPoint end;
DRAWSEGMENT* seg;
wxPoint start;
wxPoint end;
PCB_SHAPE* shape;
};
std::vector<SIDE_CANDIDATE*> sides;
@ -202,14 +202,14 @@ void GRAPHICS_CLEANER::mergeRects()
// First load all the candidates into the side vector and layer maps
for( BOARD_ITEM* item : m_drawings )
{
DRAWSEGMENT* seg = dynamic_cast<DRAWSEGMENT*>( item );
PCB_SHAPE* shape = dynamic_cast<PCB_SHAPE*>( item );
if( !seg || seg->GetShape() != S_SEGMENT )
if( !shape || shape->GetShape() != S_SEGMENT )
continue;
if( seg->GetStart().x == seg->GetEnd().x || seg->GetStart().y == seg->GetEnd().y )
if( shape->GetStart().x == shape->GetEnd().x || shape->GetStart().y == shape->GetEnd().y )
{
sides.emplace_back( new SIDE_CANDIDATE( seg ) );
sides.emplace_back( new SIDE_CANDIDATE( shape ) );
ptMap[ sides.back()->start ].push_back( sides.back() );
}
}
@ -217,7 +217,7 @@ void GRAPHICS_CLEANER::mergeRects()
// Now go through the sides and try and match lines into rectangles
for( SIDE_CANDIDATE* side : sides )
{
if( side->seg->HasFlag( IS_DELETED ) )
if( side->shape->HasFlag( IS_DELETED ) )
continue;
SIDE_CANDIDATE* left = nullptr;
@ -227,9 +227,9 @@ void GRAPHICS_CLEANER::mergeRects()
auto viable = [&]( SIDE_CANDIDATE* aCandidate ) -> bool
{
return aCandidate->seg->GetLayer() == side->seg->GetLayer()
&& aCandidate->seg->GetWidth() == side->seg->GetWidth()
&& !aCandidate->seg->HasFlag( IS_DELETED );
return aCandidate->shape->GetLayer() == side->shape->GetLayer()
&& aCandidate->shape->GetWidth() == side->shape->GetWidth()
&& !aCandidate->shape->HasFlag( IS_DELETED );
};
if( side->start.x == side->end.x )
@ -287,35 +287,35 @@ void GRAPHICS_CLEANER::mergeRects()
if( right && bottom && right->end == bottom->end )
{
left->seg->SetFlags( IS_DELETED );
top->seg->SetFlags( IS_DELETED );
right->seg->SetFlags( IS_DELETED );
bottom->seg->SetFlags( IS_DELETED );
left->shape->SetFlags( IS_DELETED );
top->shape->SetFlags( IS_DELETED );
right->shape->SetFlags( IS_DELETED );
bottom->shape->SetFlags( IS_DELETED );
std::shared_ptr<CLEANUP_ITEM> item( new CLEANUP_ITEM( CLEANUP_LINES_TO_RECT ) );
item->SetItems( left->seg, top->seg, right->seg, bottom->seg );
item->SetItems( left->shape, top->shape, right->shape, bottom->shape );
m_itemsList->push_back( item );
if( !m_dryRun )
{
DRAWSEGMENT* rect;
PCB_SHAPE* rect;
if( m_parentModule )
rect = new EDGE_MODULE( m_parentModule );
rect = new FP_SHAPE( m_parentModule );
else
rect = new DRAWSEGMENT();
rect = new PCB_SHAPE();
rect->SetShape( S_RECT );
rect->SetStart( top->start );
rect->SetEnd( bottom->end );
rect->SetLayer( top->seg->GetLayer() );
rect->SetWidth( top->seg->GetWidth() );
rect->SetLayer( top->shape->GetLayer() );
rect->SetWidth( top->shape->GetWidth() );
m_commit.Add( rect );
m_commit.Remove( left->seg );
m_commit.Remove( top->seg );
m_commit.Remove( right->seg );
m_commit.Remove( bottom->seg );
m_commit.Remove( left->shape );
m_commit.Remove( top->shape );
m_commit.Remove( right->shape );
m_commit.Remove( bottom->shape );
}
}
}

View File

@ -46,8 +46,8 @@ public:
bool aDeleteRedundant );
private:
bool isNullSegment( DRAWSEGMENT* aSegment );
bool areEquivalent( DRAWSEGMENT* aSegment1, DRAWSEGMENT* aSegment2 );
bool isNullSegment( PCB_SHAPE* aShape );
bool areEquivalent( PCB_SHAPE* aShape1, PCB_SHAPE* aShape2 );
void cleanupSegments();
void mergeRects();

View File

@ -29,8 +29,6 @@
#include <pcb_layer_box_selector.h>
#include <wildcards_and_files_ext.h>
#include <class_board.h>
#include <class_edge_mod.h>
#include <class_text_mod.h>
#include <memory>

View File

@ -36,10 +36,6 @@
#include <trigo.h>
#include <macros.h>
#include <class_board.h>
#include <class_drawsegment.h>
#include <class_edge_mod.h>
#include <class_pcb_text.h>
#include <class_text_mod.h>
#include "common.h"

View File

@ -26,9 +26,9 @@
#include "graphics_importer_pcbnew.h"
#include <class_board.h>
#include <class_edge_mod.h>
#include <class_pcb_text.h>
#include <class_text_mod.h>
#include <fp_shape.h>
#include <pcb_text.h>
#include <fp_text.h>
#include <memory>
#include <tuple>
@ -61,7 +61,7 @@ int GRAPHICS_IMPORTER_PCBNEW::MapLineWidth( double aLineWidth )
void GRAPHICS_IMPORTER_PCBNEW::AddLine( const VECTOR2D& aOrigin, const VECTOR2D& aEnd, double aWidth )
{
std::unique_ptr<DRAWSEGMENT> line( createDrawing() );
std::unique_ptr<PCB_SHAPE> line( createDrawing() );
line->SetShape( S_SEGMENT );
line->SetLayer( GetLayer() );
line->SetWidth( MapLineWidth( aWidth ) );
@ -69,7 +69,7 @@ void GRAPHICS_IMPORTER_PCBNEW::AddLine( const VECTOR2D& aOrigin, const VECTOR2D&
line->SetEnd( MapCoordinate( aEnd ) );
if( line->Type() == PCB_FP_SHAPE_T )
static_cast<EDGE_MODULE*>( line.get() )->SetLocalCoord();
static_cast<FP_SHAPE*>( line.get() )->SetLocalCoord();
addItem( std::move( line ) );
}
@ -77,7 +77,7 @@ void GRAPHICS_IMPORTER_PCBNEW::AddLine( const VECTOR2D& aOrigin, const VECTOR2D&
void GRAPHICS_IMPORTER_PCBNEW::AddCircle( const VECTOR2D& aCenter, double aRadius, double aWidth )
{
std::unique_ptr<DRAWSEGMENT> circle( createDrawing() );
std::unique_ptr<PCB_SHAPE> circle( createDrawing() );
circle->SetShape( S_CIRCLE );
circle->SetLayer( GetLayer() );
circle->SetWidth( MapLineWidth( aWidth ) );
@ -85,7 +85,7 @@ void GRAPHICS_IMPORTER_PCBNEW::AddCircle( const VECTOR2D& aCenter, double aRadiu
circle->SetArcStart( MapCoordinate( VECTOR2D( aCenter.x + aRadius, aCenter.y ) ) );
if( circle->Type() == PCB_FP_SHAPE_T )
static_cast<EDGE_MODULE*>( circle.get() )->SetLocalCoord();
static_cast<FP_SHAPE*>( circle.get() )->SetLocalCoord();
addItem( std::move( circle ) );
}
@ -94,7 +94,7 @@ void GRAPHICS_IMPORTER_PCBNEW::AddCircle( const VECTOR2D& aCenter, double aRadiu
void GRAPHICS_IMPORTER_PCBNEW::AddArc( const VECTOR2D& aCenter, const VECTOR2D& aStart,
double aAngle, double aWidth )
{
std::unique_ptr<DRAWSEGMENT> arc( createDrawing() );
std::unique_ptr<PCB_SHAPE> arc( createDrawing() );
arc->SetShape( S_ARC );
arc->SetLayer( GetLayer() );
arc->SetWidth( MapLineWidth( aWidth ) );
@ -103,7 +103,7 @@ void GRAPHICS_IMPORTER_PCBNEW::AddArc( const VECTOR2D& aCenter, const VECTOR2D&
arc->SetAngle( aAngle * 10.0 ); // Pcbnew uses the decidegree
if( arc->Type() == PCB_FP_SHAPE_T )
static_cast<EDGE_MODULE*>( arc.get() )->SetLocalCoord();
static_cast<FP_SHAPE*>( arc.get() )->SetLocalCoord();
addItem( std::move( arc ) );
}
@ -117,13 +117,13 @@ void GRAPHICS_IMPORTER_PCBNEW::AddPolygon( const std::vector< VECTOR2D >& aVerti
for( const VECTOR2D& precisePoint : aVertices )
convertedPoints.emplace_back( MapCoordinate( precisePoint ) );
std::unique_ptr<DRAWSEGMENT> polygon( createDrawing() );
std::unique_ptr<PCB_SHAPE> polygon( createDrawing() );
polygon->SetShape( S_POLYGON );
polygon->SetLayer( GetLayer() );
polygon->SetPolyPoints( convertedPoints );
if( polygon->Type() == PCB_FP_SHAPE_T )
static_cast<EDGE_MODULE*>( polygon.get() )->SetLocalCoord();
static_cast<FP_SHAPE*>( polygon.get() )->SetLocalCoord();
polygon->SetWidth( MapLineWidth( aWidth ) );
addItem( std::move( polygon ) );
@ -148,7 +148,7 @@ void GRAPHICS_IMPORTER_PCBNEW::AddText( const VECTOR2D& aOrigin, const wxString&
textItem->SetText( aText );
if( boardItem->Type() == PCB_FP_TEXT_T )
static_cast<TEXTE_MODULE*>( boardItem.get() )->SetLocalCoord();
static_cast<FP_TEXT*>( boardItem.get() )->SetLocalCoord();
addItem( std::move( boardItem ) );
}
@ -157,7 +157,7 @@ void GRAPHICS_IMPORTER_PCBNEW::AddText( const VECTOR2D& aOrigin, const wxString&
void GRAPHICS_IMPORTER_PCBNEW::AddSpline( const VECTOR2D& aStart, const VECTOR2D& BezierControl1,
const VECTOR2D& BezierControl2, const VECTOR2D& aEnd, double aWidth )
{
std::unique_ptr<DRAWSEGMENT> spline( createDrawing() );
std::unique_ptr<PCB_SHAPE> spline( createDrawing() );
spline->SetShape( S_CURVE );
spline->SetLayer( GetLayer() );
spline->SetWidth( MapLineWidth( aWidth ) );
@ -168,33 +168,33 @@ void GRAPHICS_IMPORTER_PCBNEW::AddSpline( const VECTOR2D& aStart, const VECTOR2D
spline->RebuildBezierToSegmentsPointsList( aWidth );
if( spline->Type() == PCB_FP_SHAPE_T )
static_cast<EDGE_MODULE*>( spline.get() )->SetLocalCoord();
static_cast<FP_SHAPE*>( spline.get() )->SetLocalCoord();
addItem( std::move( spline ) );
}
std::unique_ptr<DRAWSEGMENT> GRAPHICS_IMPORTER_BOARD::createDrawing()
std::unique_ptr<PCB_SHAPE> GRAPHICS_IMPORTER_BOARD::createDrawing()
{
return std::make_unique<DRAWSEGMENT>( m_board );
return std::make_unique<PCB_SHAPE>( m_board );
}
std::pair<std::unique_ptr<BOARD_ITEM>, EDA_TEXT*> GRAPHICS_IMPORTER_BOARD::createText()
{
TEXTE_PCB* text = new TEXTE_PCB( m_board );
PCB_TEXT* text = new PCB_TEXT( m_board );
return make_pair( std::unique_ptr<BOARD_ITEM>( text ), static_cast<EDA_TEXT*>( text ) );
}
std::unique_ptr<DRAWSEGMENT> GRAPHICS_IMPORTER_MODULE::createDrawing()
std::unique_ptr<PCB_SHAPE> GRAPHICS_IMPORTER_MODULE::createDrawing()
{
return std::unique_ptr<DRAWSEGMENT>( new EDGE_MODULE( m_module ) );
return std::unique_ptr<PCB_SHAPE>( new FP_SHAPE( m_module ) );
}
std::pair<std::unique_ptr<BOARD_ITEM>, EDA_TEXT*> GRAPHICS_IMPORTER_MODULE::createText()
{
TEXTE_MODULE* text = new TEXTE_MODULE( m_module );
FP_TEXT* text = new FP_TEXT( m_module );
return make_pair( std::unique_ptr<BOARD_ITEM>( text ), static_cast<EDA_TEXT*>( text ) );
}

View File

@ -33,7 +33,7 @@
class BOARD_ITEM;
class BOARD;
class MODULE;
class DRAWSEGMENT;
class PCB_SHAPE;
class EDA_TEXT;
class GRAPHICS_IMPORTER_PCBNEW : public GRAPHICS_IMPORTER
@ -89,7 +89,7 @@ public:
protected:
///> Create an object representing a graphical shape.
virtual std::unique_ptr<DRAWSEGMENT> createDrawing() = 0;
virtual std::unique_ptr<PCB_SHAPE> createDrawing() = 0;
///> Create an object representing a text. Both pointers point to different parts of the
///> same object, the EDA_TEXT pointer is simply for convenience.
@ -109,7 +109,7 @@ public:
}
protected:
std::unique_ptr<DRAWSEGMENT> createDrawing() override;
std::unique_ptr<PCB_SHAPE> createDrawing() override;
std::pair<std::unique_ptr<BOARD_ITEM>, EDA_TEXT*> createText() override;
BOARD* m_board;
@ -125,7 +125,7 @@ public:
}
protected:
std::unique_ptr<DRAWSEGMENT> createDrawing() override;
std::unique_ptr<PCB_SHAPE> createDrawing() override;
std::pair<std::unique_ptr<BOARD_ITEM>, EDA_TEXT*> createText() override;
MODULE* m_module;

View File

@ -27,9 +27,9 @@
#include <build_version.h>
#include <class_board.h>
#include <class_track.h>
#include <class_drawsegment.h>
#include <class_pcb_text.h>
#include <class_text_mod.h>
#include <pcb_shape.h>
#include <pcb_text.h>
#include <fp_text.h>
#include <common.h>
#include <netinfo.h>
#include <pcb_parser.h>
@ -105,8 +105,8 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected, bool isModE
BOARD_ITEM* clone = static_cast<BOARD_ITEM*>( item->Clone() );
// Do not add reference/value - convert them to the common type
if( TEXTE_MODULE* text = dyn_cast<TEXTE_MODULE*>( clone ) )
text->SetType( TEXTE_MODULE::TEXT_is_DIVERS );
if( FP_TEXT* text = dyn_cast<FP_TEXT*>( clone ) )
text->SetType( FP_TEXT::TEXT_is_DIVERS );
// If it is only a module, clear the nets from the pads
if( D_PAD* pad = dyn_cast<D_PAD*>( clone ) )
@ -151,25 +151,25 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected, bool isModE
if( item->Type() == PCB_FP_SHAPE_T )
{
// Convert to PCB_SHAPE_T
copy = (BOARD_ITEM*) reinterpret_cast<DRAWSEGMENT*>( item )->Clone();
copy = (BOARD_ITEM*) reinterpret_cast<PCB_SHAPE*>( item )->Clone();
copy->SetLayer( item->GetLayer() );
}
else if( item->Type() == PCB_FP_TEXT_T )
{
// Convert to PCB_TEXT_T
MODULE* mod = static_cast<MODULE*>( item->GetParent() );
TEXTE_MODULE* mod_text = static_cast<TEXTE_MODULE*>( item );
TEXTE_PCB* pcb_text = new TEXTE_PCB( m_board );
MODULE* mod = static_cast<MODULE*>( item->GetParent() );
FP_TEXT* fp_text = static_cast<FP_TEXT*>( item );
PCB_TEXT* pcb_text = new PCB_TEXT( m_board );
if( mod_text->GetText() == "${VALUE}" )
if( fp_text->GetText() == "${VALUE}" )
pcb_text->SetText( mod->GetValue() );
else if( mod_text->GetText() == "${REFERENCE}" )
else if( fp_text->GetText() == "${REFERENCE}" )
pcb_text->SetText( mod->GetReference() );
else
pcb_text->CopyText( *mod_text );
pcb_text->CopyText( *fp_text );
pcb_text->SetEffects( *mod_text );
pcb_text->SetLayer( mod_text->GetLayer() );
pcb_text->SetEffects( *fp_text );
pcb_text->SetLayer( fp_text->GetLayer() );
copy = pcb_text;
}
else if( item->Type() == PCB_PAD_T )

View File

@ -29,13 +29,13 @@
#include <trace_helpers.h>
#include <class_board.h>
#include <class_module.h>
#include <class_pcb_text.h>
#include <pcb_text.h>
#include <class_dimension.h>
#include <class_track.h>
#include <class_zone.h>
#include <class_drawsegment.h>
#include <pcb_shape.h>
#include <class_pcb_target.h>
#include <class_edge_mod.h>
#include <fp_shape.h>
#include <confirm.h>
#include <zones.h>
#include <kicad_plugin.h>
@ -400,11 +400,11 @@ void PCB_IO::Format( BOARD_ITEM* aItem, int aNestLevel ) const
break;
case PCB_SHAPE_T:
format( static_cast<DRAWSEGMENT*>( aItem ), aNestLevel );
format( static_cast<PCB_SHAPE*>( aItem ), aNestLevel );
break;
case PCB_FP_SHAPE_T:
format( static_cast<EDGE_MODULE*>( aItem ), aNestLevel );
format( static_cast<FP_SHAPE*>( aItem ), aNestLevel );
break;
case PCB_TARGET_T:
@ -420,11 +420,11 @@ void PCB_IO::Format( BOARD_ITEM* aItem, int aNestLevel ) const
break;
case PCB_TEXT_T:
format( static_cast<TEXTE_PCB*>( aItem ), aNestLevel );
format( static_cast<PCB_TEXT*>( aItem ), aNestLevel );
break;
case PCB_FP_TEXT_T:
format( static_cast<TEXTE_MODULE*>( aItem ), aNestLevel );
format( static_cast<FP_TEXT*>( aItem ), aNestLevel );
break;
case PCB_GROUP_T:
@ -756,43 +756,43 @@ void PCB_IO::format( DIMENSION* aDimension, int aNestLevel ) const
}
void PCB_IO::format( DRAWSEGMENT* aSegment, int aNestLevel ) const
void PCB_IO::format( PCB_SHAPE* aShape, int aNestLevel ) const
{
switch( aSegment->GetShape() )
switch( aShape->GetShape() )
{
case S_SEGMENT: // Line
m_out->Print( aNestLevel, "(gr_line (start %s) (end %s)",
FormatInternalUnits( aSegment->GetStart() ).c_str(),
FormatInternalUnits( aSegment->GetEnd() ).c_str() );
FormatInternalUnits( aShape->GetStart() ).c_str(),
FormatInternalUnits( aShape->GetEnd() ).c_str() );
if( aSegment->GetAngle() != 0.0 )
m_out->Print( 0, " (angle %s)", FormatAngle( aSegment->GetAngle() ).c_str() );
if( aShape->GetAngle() != 0.0 )
m_out->Print( 0, " (angle %s)", FormatAngle( aShape->GetAngle() ).c_str() );
break;
case S_RECT: // Rectangle
m_out->Print( aNestLevel, "(gr_rect (start %s) (end %s)",
FormatInternalUnits( aSegment->GetStart() ).c_str(),
FormatInternalUnits( aSegment->GetEnd() ).c_str() );
FormatInternalUnits( aShape->GetStart() ).c_str(),
FormatInternalUnits( aShape->GetEnd() ).c_str() );
break;
case S_CIRCLE: // Circle
m_out->Print( aNestLevel, "(gr_circle (center %s) (end %s)",
FormatInternalUnits( aSegment->GetStart() ).c_str(),
FormatInternalUnits( aSegment->GetEnd() ).c_str() );
FormatInternalUnits( aShape->GetStart() ).c_str(),
FormatInternalUnits( aShape->GetEnd() ).c_str() );
break;
case S_ARC: // Arc
m_out->Print( aNestLevel, "(gr_arc (start %s) (end %s) (angle %s)",
FormatInternalUnits( aSegment->GetStart() ).c_str(),
FormatInternalUnits( aSegment->GetEnd() ).c_str(),
FormatAngle( aSegment->GetAngle() ).c_str() );
FormatInternalUnits( aShape->GetStart() ).c_str(),
FormatInternalUnits( aShape->GetEnd() ).c_str(),
FormatAngle( aShape->GetAngle() ).c_str() );
break;
case S_POLYGON: // Polygon
if( aSegment->IsPolyShapeValid() )
if( aShape->IsPolyShapeValid() )
{
SHAPE_POLY_SET& poly = aSegment->GetPolyShape();
SHAPE_POLY_SET& poly = aShape->GetPolyShape();
SHAPE_LINE_CHAIN& outline = poly.Outline( 0 );
int pointsCount = outline.PointCount();
@ -824,29 +824,29 @@ void PCB_IO::format( DRAWSEGMENT* aSegment, int aNestLevel ) const
case S_CURVE: // Bezier curve
m_out->Print( aNestLevel, "(gr_curve (pts (xy %s) (xy %s) (xy %s) (xy %s))",
FormatInternalUnits( aSegment->GetStart() ).c_str(),
FormatInternalUnits( aSegment->GetBezControl1() ).c_str(),
FormatInternalUnits( aSegment->GetBezControl2() ).c_str(),
FormatInternalUnits( aSegment->GetEnd() ).c_str() );
FormatInternalUnits( aShape->GetStart() ).c_str(),
FormatInternalUnits( aShape->GetBezControl1() ).c_str(),
FormatInternalUnits( aShape->GetBezControl2() ).c_str(),
FormatInternalUnits( aShape->GetEnd() ).c_str() );
break;
default:
wxFAIL_MSG( "PCB_IO::format cannot format unknown DRAWSEGMENT shape:"
+ PCB_SHAPE_TYPE_T_asString( aSegment->GetShape()) );
wxFAIL_MSG( "PCB_IO::format cannot format unknown PCB_SHAPE shape:"
+ PCB_SHAPE_TYPE_T_asString( aShape->GetShape()) );
return;
};
formatLayer( aSegment );
formatLayer( aShape );
m_out->Print( 0, " (width %s)", FormatInternalUnits( aSegment->GetWidth() ).c_str() );
m_out->Print( 0, " (width %s)", FormatInternalUnits( aShape->GetWidth() ).c_str() );
m_out->Print( 0, " (tstamp %s)", TO_UTF8( aSegment->m_Uuid.AsString() ) );
m_out->Print( 0, " (tstamp %s)", TO_UTF8( aShape->m_Uuid.AsString() ) );
m_out->Print( 0, ")\n" );
}
void PCB_IO::format( EDGE_MODULE* aModuleDrawing, int aNestLevel ) const
void PCB_IO::format( FP_SHAPE* aModuleDrawing, int aNestLevel ) const
{
switch( aModuleDrawing->GetShape() )
{
@ -916,7 +916,7 @@ void PCB_IO::format( EDGE_MODULE* aModuleDrawing, int aNestLevel ) const
break;
default:
wxFAIL_MSG( "PCB_IO::format cannot format unknown EDGE_MODULE shape:"
wxFAIL_MSG( "PCB_IO::format cannot format unknown FP_SHAPE shape:"
+ PCB_SHAPE_TYPE_T_asString( aModuleDrawing->GetShape()) );
return;
};
@ -1443,7 +1443,7 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
int nested_level = aNestLevel+2;
// Output all basic shapes
for( const std::shared_ptr<DRAWSEGMENT>& primitive : aPad->GetPrimitives() )
for( const std::shared_ptr<PCB_SHAPE>& primitive : aPad->GetPrimitives() )
{
m_out->Print( 0, "\n");
@ -1532,7 +1532,7 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
}
void PCB_IO::format( TEXTE_PCB* aText, int aNestLevel ) const
void PCB_IO::format( PCB_TEXT* aText, int aNestLevel ) const
{
m_out->Print( aNestLevel, "(gr_text %s (at %s",
m_out->Quotew( aText->GetText() ).c_str(),
@ -1582,15 +1582,15 @@ void PCB_IO::format( PCB_GROUP* aGroup, int aNestLevel ) const
}
void PCB_IO::format( TEXTE_MODULE* aText, int aNestLevel ) const
void PCB_IO::format( FP_TEXT* aText, int aNestLevel ) const
{
std::string type;
switch( aText->GetType() )
{
case TEXTE_MODULE::TEXT_is_REFERENCE: type = "reference"; break;
case TEXTE_MODULE::TEXT_is_VALUE: type = "value"; break;
case TEXTE_MODULE::TEXT_is_DIVERS: type = "user";
case FP_TEXT::TEXT_is_REFERENCE: type = "reference"; break;
case FP_TEXT::TEXT_is_VALUE: type = "value"; break;
case FP_TEXT::TEXT_is_DIVERS: type = "user";
}
m_out->Print( aNestLevel, "(fp_text %s %s (at %s",
@ -1607,7 +1607,7 @@ void PCB_IO::format( TEXTE_MODULE* aText, int aNestLevel ) const
if( parent )
{
// GetTextAngle() is always in -360..+360 range because of
// TEXTE_MODULE::SetTextAngle(), but summing that angle with an
// FP_TEXT::SetTextAngle(), but summing that angle with an
// additional board angle could kick sum up >= 360 or <= -360, so to have
// consistent results, normalize again for the BOARD save. A footprint
// save does not use this code path since parent is NULL.

View File

@ -36,15 +36,15 @@ class PCB_PARSER;
class NETINFO_MAPPING;
class BOARD_DESIGN_SETTINGS;
class DIMENSION;
class EDGE_MODULE;
class DRAWSEGMENT;
class FP_SHAPE;
class PCB_SHAPE;
class PCB_TARGET;
class D_PAD;
class TEXTE_MODULE;
class FP_TEXT;
class PCB_GROUP;
class TRACK;
class ZONE_CONTAINER;
class TEXTE_PCB;
class PCB_TEXT;
/// Current s-expression file format version. 2 was the last legacy format version.
@ -57,7 +57,7 @@ class TEXTE_PCB;
//#define SEXPR_BOARD_FILE_VERSION 20170920 // long pad names and custom pad shape
//#define SEXPR_BOARD_FILE_VERSION 20170922 // Keepout zones can exist on multiple layers
//#define SEXPR_BOARD_FILE_VERSION 20171114 // Save 3D model offset in mm, instead of inches
//#define SEXPR_BOARD_FILE_VERSION 20171125 // Locked/unlocked TEXTE_MODULE
//#define SEXPR_BOARD_FILE_VERSION 20171125 // Locked/unlocked FP_TEXT
//#define SEXPR_BOARD_FILE_VERSION 20171130 // 3D model offset written using "offset" parameter
//#define SEXPR_BOARD_FILE_VERSION 20190331 // hatched zones and chamfered round rect pads
//#define SEXPR_BOARD_FILE_VERSION 20190421 // curves in custom pads
@ -260,11 +260,11 @@ private:
void format( DIMENSION* aDimension, int aNestLevel = 0 ) const;
void format( EDGE_MODULE* aModuleDrawing, int aNestLevel = 0 ) const;
void format( FP_SHAPE* aModuleDrawing, int aNestLevel = 0 ) const;
void format( PCB_GROUP* aGroup, int aNestLevel = 0 ) const;
void format( DRAWSEGMENT* aSegment, int aNestLevel = 0 ) const;
void format( PCB_SHAPE* aSegment, int aNestLevel = 0 ) const;
void format( PCB_TARGET* aTarget, int aNestLevel = 0 ) const;
@ -272,9 +272,9 @@ private:
void format( D_PAD* aPad, int aNestLevel = 0 ) const;
void format( TEXTE_PCB* aText, int aNestLevel = 0 ) const;
void format( PCB_TEXT* aText, int aNestLevel = 0 ) const;
void format( TEXTE_MODULE* aText, int aNestLevel = 0 ) const;
void format( FP_TEXT* aText, int aNestLevel = 0 ) const;
void format( TRACK* aTrack, int aNestLevel = 0 ) const;

View File

@ -74,12 +74,12 @@
#include <class_board.h>
#include <class_module.h>
#include <class_track.h>
#include <class_pcb_text.h>
#include <pcb_text.h>
#include <class_zone.h>
#include <class_dimension.h>
#include <class_drawsegment.h>
#include <pcb_shape.h>
#include <class_pcb_target.h>
#include <class_edge_mod.h>
#include <fp_shape.h>
#include <3d_cache/3d_info.h>
#include <pcb_plot_params.h>
#include <pcb_plot_params_parser.h>
@ -1207,25 +1207,25 @@ void LEGACY_PLUGIN::loadMODULE( MODULE* aModule )
// e.g. "T1 6940 -16220 350 300 900 60 M I 20 N "CFCARD"\r\n"
int tnum = intParse( line + SZ( "T" ) );
TEXTE_MODULE* textm = nullptr;
FP_TEXT* text = nullptr;
switch( tnum )
{
case TEXTE_MODULE::TEXT_is_REFERENCE:
textm = &aModule->Reference();
case FP_TEXT::TEXT_is_REFERENCE:
text = &aModule->Reference();
break;
case TEXTE_MODULE::TEXT_is_VALUE:
textm = &aModule->Value();
case FP_TEXT::TEXT_is_VALUE:
text = &aModule->Value();
break;
// All other fields greater than 1.
default:
textm = new TEXTE_MODULE( aModule );
aModule->Add( textm );
text = new FP_TEXT( aModule );
aModule->Add( text );
}
loadMODULE_TEXT( textm );
loadMODULE_TEXT( text );
}
else if( TESTLINE( "Po" ) )
@ -1647,7 +1647,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule )
case 'A': shape = S_ARC; break;
case 'P': shape = S_POLYGON; break;
default:
m_error.Printf( _( "Unknown EDGE_MODULE type:'%c=0x%02x' on line:%d of footprint:\"%s\"" ),
m_error.Printf( _( "Unknown FP_SHAPE type:'%c=0x%02x' on line:%d of footprint:\"%s\"" ),
(unsigned char) line[1],
(unsigned char) line[1],
m_reader->LineNumber(),
@ -1656,7 +1656,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule )
THROW_IO_ERROR( m_error );
}
unique_ptr<EDGE_MODULE> dwg( new EDGE_MODULE( aModule, shape ) ); // a drawing
unique_ptr<FP_SHAPE> dwg( new FP_SHAPE( aModule, shape ) ); // a drawing
const char* data;
@ -1759,17 +1759,17 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule )
dwg->SetWidth( width );
dwg->SetLayer( leg_layer2new( m_cu_count, layer ) );
EDGE_MODULE* em = dwg.release();
FP_SHAPE* fpShape = dwg.release();
aModule->Add( em );
aModule->Add( fpShape );
// this had been done at the MODULE level before, presumably because the
// EDGE_MODULE needs to be already added to a module before this function will work.
em->SetDrawCoord();
// FP_SHAPE needs to be already added to a module before this function will work.
fpShape->SetDrawCoord();
}
void LEGACY_PLUGIN::loadMODULE_TEXT( TEXTE_MODULE* aText )
void LEGACY_PLUGIN::loadMODULE_TEXT( FP_TEXT* aText )
{
const char* data;
const char* txt_end;
@ -1817,11 +1817,11 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( TEXTE_MODULE* aText )
char* hjust = strtok_r( (char*) txt_end, delims, (char**) &data );
char* vjust = strtok_r( NULL, delims, (char**) &data );
if( type != TEXTE_MODULE::TEXT_is_REFERENCE
&& type != TEXTE_MODULE::TEXT_is_VALUE )
type = TEXTE_MODULE::TEXT_is_DIVERS;
if( type != FP_TEXT::TEXT_is_REFERENCE
&& type != FP_TEXT::TEXT_is_VALUE )
type = FP_TEXT::TEXT_is_DIVERS;
aText->SetType( static_cast<TEXTE_MODULE::TEXT_TYPE>( type ) );
aText->SetType( static_cast<FP_TEXT::TEXT_TYPE>( type ) );
aText->SetPos0( wxPoint( pos0_x, pos0_y ) );
aText->SetTextSize( wxSize( size0_x, size0_y ) );
@ -1921,7 +1921,7 @@ void LEGACY_PLUGIN::loadPCB_LINE()
$EndDRAWSEGMENT
*/
unique_ptr<DRAWSEGMENT> dseg( new DRAWSEGMENT( m_board ) );
unique_ptr<PCB_SHAPE> dseg( new PCB_SHAPE( m_board ) );
char* line;
char* saveptr;
@ -2113,7 +2113,7 @@ void LEGACY_PLUGIN::loadPCB_TEXT()
char text[1024];
// maybe someday a constructor that takes all this data in one call?
TEXTE_PCB* pcbtxt = new TEXTE_PCB( m_board );
PCB_TEXT* pcbtxt = new PCB_TEXT( m_board );
m_board->Add( pcbtxt, ADD_MODE::APPEND );
char* line;

View File

@ -40,9 +40,6 @@
class PCB_TARGET;
class MODULE;
class DRAWSEGMENT;
class NETINFO;
class TEXTE_PCB;
class TRACK;
class NETCLASS;
class NETCLASSES;
@ -50,8 +47,7 @@ class ZONE_CONTAINER;
class DIMENSION;
class NETINFO_ITEM;
class NETINFO_MAPPING;
class TEXTE_MODULE;
class EDGE_MODULE;
class FP_TEXT;
class TRACK;
class D_PAD;
struct LP_CACHE;
@ -196,7 +192,7 @@ protected:
void load3D( MODULE* aModule );
void loadPAD( MODULE* aModule );
void loadMODULE_TEXT( TEXTE_MODULE* aText );
void loadMODULE_TEXT( FP_TEXT* aText );
void loadMODULE_EDGE( MODULE* aModule );
void loadPCB_LINE();

View File

@ -26,7 +26,7 @@
#include <base_units.h>
#include <board_commit.h>
#include <class_pad.h>
#include <class_edge_mod.h>
#include <fp_shape.h>
#include <class_module.h>
#include <confirm.h>
#include <dialog_text_entry.h>
@ -424,16 +424,16 @@ MODULE* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN& aIn
// Generate segments
for( unsigned jj = 1; jj < buffer.size(); jj++ )
{
EDGE_MODULE* PtSegm;
PtSegm = new EDGE_MODULE( module );
PtSegm->SetStart( buffer[jj - 1] );
PtSegm->SetEnd( buffer[jj] );
PtSegm->SetWidth( aInductorPattern.m_Width );
PtSegm->SetLayer( module->GetLayer() );
PtSegm->SetShape( S_SEGMENT );
PtSegm->SetStart0( PtSegm->GetStart() - module->GetPosition() );
PtSegm->SetEnd0( PtSegm->GetEnd() - module->GetPosition() );
module->Add( PtSegm );
FP_SHAPE* seg;
seg = new FP_SHAPE( module );
seg->SetStart( buffer[jj - 1] );
seg->SetEnd( buffer[jj] );
seg->SetWidth( aInductorPattern.m_Width );
seg->SetLayer( module->GetLayer() );
seg->SetShape( S_SEGMENT );
seg->SetStart0( seg->GetStart() - module->GetPosition() );
seg->SetEnd0( seg->GetEnd() - module->GetPosition() );
module->Add( seg );
}
// Place a pad on each end of coil.

View File

@ -37,7 +37,7 @@
#include <dialog_text_entry.h>
#include <class_board.h>
#include <class_module.h>
#include <class_edge_mod.h>
#include <fp_shape.h>
#include <microwave/microwave_tool.h>
#include <pcbnew.h>
#include <math/util.h> // for KiROUND
@ -239,11 +239,11 @@ void MWAVE_POLYGONAL_SHAPE_DLG::ReadDataShapeDescr( wxCommandEvent& event )
MODULE* MICROWAVE_TOOL::createPolygonShape()
{
D_PAD* pad1, * pad2;
MODULE* module;
wxString cmp_name;
int pad_count = 2;
EDGE_MODULE* edge;
D_PAD* pad1, * pad2;
MODULE* module;
wxString cmp_name;
int pad_count = 2;
FP_SHAPE* shape;
PCB_EDIT_FRAME& editFrame = *getEditFrame<PCB_EDIT_FRAME>();
@ -295,11 +295,11 @@ MODULE* MICROWAVE_TOOL::createPolygonShape()
pad2->SetX( pad2->GetPos0().x );
// Add a polygonal edge (corners will be added later) on copper layer
edge = new EDGE_MODULE( module );
edge->SetShape( S_POLYGON );
edge->SetLayer( F_Cu );
shape = new FP_SHAPE( module );
shape->SetShape( S_POLYGON );
shape->SetLayer( F_Cu );
module->Add( edge, ADD_MODE::INSERT );
module->Add( shape, ADD_MODE::INSERT );
// Get the corner buffer of the polygonal edge
std::vector<wxPoint> polyPoints;
@ -338,10 +338,10 @@ MODULE* MICROWAVE_TOOL::createPolygonShape()
break;
}
edge->SetPolyPoints( polyPoints );
shape->SetPolyPoints( polyPoints );
// Set the polygon outline thickness to 0, only the polygonal shape is filled
// without extra thickness
edge->SetWidth( 0 );
shape->SetWidth( 0 );
PolyEdges.clear();
module->CalculateBoundingBox();

View File

@ -29,7 +29,7 @@
#include <class_board.h>
#include <class_board_item.h>
#include <class_drawsegment.h>
#include <pcb_shape.h>
#include <class_pad.h>
#include <convert_basic_shapes_to_polygon.h>
#include <geometry/shape_rect.h>
@ -59,7 +59,7 @@ void D_PAD::AddPrimitivePoly( const SHAPE_POLY_SET& aPoly, int aThickness )
void D_PAD::AddPrimitivePoly( const std::vector<wxPoint>& aPoly, int aThickness )
{
DRAWSEGMENT* item = new DRAWSEGMENT();
PCB_SHAPE* item = new PCB_SHAPE();
item->SetShape( S_POLYGON );
item->SetPolyPoints( aPoly );
item->SetWidth( aThickness );
@ -70,7 +70,7 @@ void D_PAD::AddPrimitivePoly( const std::vector<wxPoint>& aPoly, int aThickness
void D_PAD::AddPrimitiveSegment( const wxPoint& aStart, const wxPoint& aEnd, int aThickness )
{
DRAWSEGMENT* item = new DRAWSEGMENT();
PCB_SHAPE* item = new PCB_SHAPE();
item->SetStart( aStart );
item->SetEnd( aEnd );
item->SetWidth( aThickness );
@ -82,7 +82,7 @@ void D_PAD::AddPrimitiveSegment( const wxPoint& aStart, const wxPoint& aEnd, int
void D_PAD::AddPrimitiveArc( const wxPoint& aCenter, const wxPoint& aStart, int aArcAngle,
int aThickness )
{
DRAWSEGMENT* item = new DRAWSEGMENT();
PCB_SHAPE* item = new PCB_SHAPE();
item->SetShape( S_ARC );
item->SetCenter( aCenter );
item->SetArcStart( aStart );
@ -96,7 +96,7 @@ void D_PAD::AddPrimitiveArc( const wxPoint& aCenter, const wxPoint& aStart, int
void D_PAD::AddPrimitiveCurve( const wxPoint& aStart, const wxPoint& aEnd, const wxPoint& aCtrl1,
const wxPoint& aCtrl2, int aThickness )
{
DRAWSEGMENT* item = new DRAWSEGMENT();
PCB_SHAPE* item = new PCB_SHAPE();
item->SetShape( S_CURVE );
item->SetStart( aStart );
item->SetEnd( aEnd );
@ -110,7 +110,7 @@ void D_PAD::AddPrimitiveCurve( const wxPoint& aStart, const wxPoint& aEnd, const
void D_PAD::AddPrimitiveCircle( const wxPoint& aCenter, int aRadius, int aThickness )
{
DRAWSEGMENT* item = new DRAWSEGMENT();
PCB_SHAPE* item = new PCB_SHAPE();
item->SetShape( S_CIRCLE );
item->SetStart( aCenter );
item->SetEnd( wxPoint( aCenter.x + aRadius, aCenter.y ) );
@ -122,7 +122,7 @@ void D_PAD::AddPrimitiveCircle( const wxPoint& aCenter, int aRadius, int aThickn
void D_PAD::AddPrimitiveRect( const wxPoint& aStart, const wxPoint& aEnd, int aThickness )
{
DRAWSEGMENT* item = new DRAWSEGMENT();
PCB_SHAPE* item = new PCB_SHAPE();
item->SetShape( S_RECT );
item->SetStart( aStart );
item->SetEnd( aEnd );
@ -132,7 +132,7 @@ void D_PAD::AddPrimitiveRect( const wxPoint& aStart, const wxPoint& aEnd, int aT
}
void D_PAD::ReplacePrimitives( const std::vector<std::shared_ptr<DRAWSEGMENT>>& aPrimitivesList )
void D_PAD::ReplacePrimitives( const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList )
{
// clear old list
DeletePrimitivesList();
@ -145,17 +145,17 @@ void D_PAD::ReplacePrimitives( const std::vector<std::shared_ptr<DRAWSEGMENT>>&
}
void D_PAD::AppendPrimitives( const std::vector<std::shared_ptr<DRAWSEGMENT>>& aPrimitivesList )
void D_PAD::AppendPrimitives( const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList )
{
// Add duplicates of aPrimitivesList to the pad primitives list:
for( const std::shared_ptr<DRAWSEGMENT>& prim : aPrimitivesList )
AddPrimitive( new DRAWSEGMENT( *prim ) );
for( const std::shared_ptr<PCB_SHAPE>& prim : aPrimitivesList )
AddPrimitive( new PCB_SHAPE( *prim ) );
m_shapesDirty = true;
}
void D_PAD::AddPrimitive( DRAWSEGMENT* aPrimitive )
void D_PAD::AddPrimitive( PCB_SHAPE* aPrimitive )
{
m_editPrimitives.emplace_back( aPrimitive );
@ -177,7 +177,7 @@ void D_PAD::addPadPrimitivesToPolygon( SHAPE_POLY_SET* aMergedPolygon, PCB_LAYER
{
SHAPE_POLY_SET polyset;
for( const std::shared_ptr<DRAWSEGMENT>& primitive : m_editPrimitives )
for( const std::shared_ptr<PCB_SHAPE>& primitive : m_editPrimitives )
primitive->TransformShapeWithClearanceToPolygon( polyset, aLayer, 0, aError );
polyset.Simplify( SHAPE_POLY_SET::PM_FAST );

View File

@ -29,11 +29,11 @@
#include <wx/wx.h>
#include <common.h>
#include <math/util.h> // for KiROUND
#include <trigo.h>
#include <fp_shape.h>
#include <pcb_arc.h>
#include <pcb_shape.h>
namespace PCAD2KICAD {
@ -160,7 +160,7 @@ void PCB_ARC::AddToModule( MODULE* aModule )
{
if( IsNonCopperLayer( m_KiCadLayer ) )
{
EDGE_MODULE* arc = new EDGE_MODULE( aModule, ( IsCircle() ? S_CIRCLE : S_ARC ) );
FP_SHAPE* arc = new FP_SHAPE( aModule, ( IsCircle() ? S_CIRCLE : S_ARC ) );
aModule->Add( arc );
arc->m_Start0 = wxPoint( m_positionX, m_positionY );
@ -180,16 +180,16 @@ void PCB_ARC::AddToModule( MODULE* aModule )
void PCB_ARC::AddToBoard()
{
DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board );
PCB_SHAPE* arc = new PCB_SHAPE( m_board );
m_board->Add( dseg, ADD_MODE::APPEND );
m_board->Add( arc, ADD_MODE::APPEND );
dseg->SetShape( IsCircle() ? S_CIRCLE : S_ARC );
dseg->SetLayer( m_KiCadLayer );
dseg->SetStart( wxPoint( m_positionX, m_positionY ) );
dseg->SetEnd( wxPoint( m_startX, m_startY ) );
dseg->SetAngle( -m_angle );
dseg->SetWidth( m_width );
arc->SetShape( IsCircle() ? S_CIRCLE : S_ARC );
arc->SetLayer( m_KiCadLayer );
arc->SetStart( wxPoint( m_positionX, m_positionY ) );
arc->SetEnd( wxPoint( m_startX, m_startY ) );
arc->SetAngle( -m_angle );
arc->SetWidth( m_width );
}

View File

@ -38,9 +38,7 @@
#include <class_board.h>
#include <class_module.h>
#include <class_track.h>
#include <class_edge_mod.h>
#include <class_zone.h>
#include <class_pcb_text.h>
namespace PCAD2KICAD {

View File

@ -30,7 +30,8 @@
#include <wx/wx.h>
#include <common.h>
#include <fp_shape.h>
#include <pcb_shape.h>
#include <pcb_line.h>
namespace PCAD2KICAD {
@ -118,7 +119,7 @@ void PCB_LINE::AddToModule( MODULE* aModule )
{
if( IsNonCopperLayer( m_KiCadLayer ) )
{
EDGE_MODULE* segment = new EDGE_MODULE( aModule, S_SEGMENT );
FP_SHAPE* segment = new FP_SHAPE( aModule, S_SEGMENT );
aModule->Add( segment );
segment->m_Start0 = wxPoint( m_positionX, m_positionY );
@ -149,13 +150,13 @@ void PCB_LINE::AddToBoard()
}
else
{
DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board );
m_board->Add( dseg, ADD_MODE::APPEND );
PCB_SHAPE* segment = new PCB_SHAPE( m_board );
m_board->Add( segment, ADD_MODE::APPEND );
dseg->SetLayer( m_KiCadLayer );
dseg->SetStart( wxPoint( m_positionX, m_positionY ) );
dseg->SetEnd( wxPoint( m_toX, m_toY ) );
dseg->SetWidth( m_width );
segment->SetLayer( m_KiCadLayer );
segment->SetStart( wxPoint( m_positionX, m_positionY ) );
segment->SetEnd( wxPoint( m_toX, m_toY ) );
segment->SetWidth( m_width );
}
}

View File

@ -23,14 +23,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file pcb_module.cpp
*/
#include <wx/wx.h>
#include <common.h>
#include <pcb_arc.h>
#include <pcb_copper_pour.h>
#include <pcb_cutout.h>
@ -39,7 +33,7 @@
#include <pcb_module.h>
#include <pcb_pad.h>
#include <pcb_polygon.h>
#include <pcb_text.h>
#include <pcad2kicadpcb_plugin/pcb_text.h>
#include <pcb_via.h>
#include <trigo.h>
@ -521,10 +515,10 @@ void PCB_MODULE::AddToBoard()
module->SetFPID( fpID );
// reference text
TEXTE_MODULE* ref_text = &module->Reference();
FP_TEXT* ref_text = &module->Reference();
ref_text->SetText( ValidateReference( m_name.text ) );
ref_text->SetType( TEXTE_MODULE::TEXT_is_REFERENCE );
ref_text->SetType( FP_TEXT::TEXT_is_REFERENCE );
ref_text->SetPos0( wxPoint( m_name.correctedPositionX, m_name.correctedPositionY ) );
if( m_name.isTrueType )
@ -548,10 +542,10 @@ void PCB_MODULE::AddToBoard()
ref_text->SetDrawCoord();
// value text
TEXTE_MODULE* val_text = &module->Value();
FP_TEXT* val_text = &module->Value();
val_text->SetText( m_value.text );
val_text->SetType( TEXTE_MODULE::TEXT_is_VALUE );
val_text->SetType( FP_TEXT::TEXT_is_VALUE );
val_text->SetPos0( wxPoint( m_value.correctedPositionX, m_value.correctedPositionY ) );
if( m_value.isTrueType )

View File

@ -31,7 +31,7 @@
#include <common.h>
#include <math/util.h> // for KiROUND
#include <fp_shape.h>
#include <pcb_polygon.h>
namespace PCAD2KICAD {
@ -159,7 +159,7 @@ void PCB_POLYGON::AddToModule( MODULE* aModule )
{
if( IsNonCopperLayer( m_KiCadLayer ) )
{
EDGE_MODULE* dwg = new EDGE_MODULE( aModule, S_POLYGON );
FP_SHAPE* dwg = new FP_SHAPE( aModule, S_POLYGON );
aModule->Add( dwg );
dwg->SetWidth( 0 );

View File

@ -23,15 +23,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file pcb_text.cpp
*/
#include <wx/wx.h>
#include <common.h>
#include <pcb_text.h>
#include <pcad2kicadpcb_plugin/pcb_text.h>
namespace PCAD2KICAD {
@ -104,7 +100,7 @@ void PCB_TEXT::AddToBoard()
m_name.textPositionY = m_positionY;
m_name.textRotation = m_rotation;
TEXTE_PCB* pcbtxt = new TEXTE_PCB( m_board );
::PCB_TEXT* pcbtxt = new ::PCB_TEXT( m_board );
m_board->Add( pcbtxt, ADD_MODE::APPEND );
pcbtxt->SetText( m_name.text );

View File

@ -37,7 +37,6 @@
#include <pcbnew_id.h>
#include <class_board.h>
#include <class_module.h>
#include <class_drawsegment.h>
#include <collectors.h>
#include <pcb_draw_panel_gal.h>
#include <math/vector2d.h>

View File

@ -36,20 +36,16 @@ class PCB_SCREEN;
class BOARD;
class BOARD_COMMIT;
class BOARD_ITEM_CONTAINER;
class TEXTE_PCB;
class MODULE;
class TRACK;
class VIA;
class D_PAD;
class TEXTE_MODULE;
class PCB_TARGET;
class PCB_GROUP;
class DIMENSION;
class EDGE_MODULE;
class DRC;
class DIALOG_PLOT;
class ZONE_CONTAINER;
class DRAWSEGMENT;
class GENERAL_COLLECTOR;
class GENERAL_COLLECTORS_GUIDE;
class SELECTION;

View File

@ -28,9 +28,9 @@
#include <class_pcb_group.h>
#include <class_module.h>
#include <class_pad.h>
#include <class_drawsegment.h>
#include <pcb_shape.h>
#include <class_zone.h>
#include <class_pcb_text.h>
#include <pcb_text.h>
#include <class_marker_pcb.h>
#include <class_dimension.h>
#include <class_pcb_target.h>
@ -414,15 +414,15 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
case PCB_SHAPE_T:
case PCB_FP_SHAPE_T:
draw( static_cast<const DRAWSEGMENT*>( item ), aLayer );
draw( static_cast<const PCB_SHAPE*>( item ), aLayer );
break;
case PCB_TEXT_T:
draw( static_cast<const TEXTE_PCB*>( item ), aLayer );
draw( static_cast<const PCB_TEXT*>( item ), aLayer );
break;
case PCB_FP_TEXT_T:
draw( static_cast<const TEXTE_MODULE*>( item ), aLayer );
draw( static_cast<const FP_TEXT*>( item ), aLayer );
break;
case PCB_MODULE_T:
@ -985,13 +985,13 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
}
void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer )
void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
{
const COLOR4D& color = m_pcbSettings.GetColor( aSegment, aSegment->GetLayer() );
const COLOR4D& color = m_pcbSettings.GetColor( aShape, aShape->GetLayer() );
bool sketch = m_pcbSettings.m_sketchGraphics;
int thickness = getLineThickness( aSegment->GetWidth() );
VECTOR2D start( aSegment->GetStart() );
VECTOR2D end( aSegment->GetEnd() );
int thickness = getLineThickness( aShape->GetWidth() );
VECTOR2D start( aShape->GetStart() );
VECTOR2D end( aShape->GetEnd() );
m_gal->SetIsFill( !sketch );
m_gal->SetIsStroke( sketch );
@ -999,7 +999,7 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer )
m_gal->SetStrokeColor( color );
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
switch( aSegment->GetShape() )
switch( aShape->GetShape() )
{
case S_SEGMENT:
m_gal->DrawSegment( start, end, thickness );
@ -1007,9 +1007,9 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer )
case S_RECT:
{
std::vector<wxPoint> pts = aSegment->GetRectCorners();
std::vector<wxPoint> pts = aShape->GetRectCorners();
if( aSegment->GetWidth() > 0 )
if( aShape->GetWidth() > 0 )
{
m_gal->DrawSegment( pts[0], pts[1], thickness );
m_gal->DrawSegment( pts[1], pts[2], thickness );
@ -1030,30 +1030,30 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer )
break;
case S_ARC:
m_gal->DrawArcSegment( start, aSegment->GetRadius(),
DECIDEG2RAD( aSegment->GetArcAngleStart() ),
DECIDEG2RAD( aSegment->GetArcAngleStart() + aSegment->GetAngle() ), // Change this
m_gal->DrawArcSegment( start, aShape->GetRadius(),
DECIDEG2RAD( aShape->GetArcAngleStart() ),
DECIDEG2RAD( aShape->GetArcAngleStart() + aShape->GetAngle() ), // Change this
thickness );
break;
case S_CIRCLE:
if( sketch )
{
m_gal->DrawCircle( start, aSegment->GetRadius() - thickness / 2 );
m_gal->DrawCircle( start, aSegment->GetRadius() + thickness / 2 );
m_gal->DrawCircle( start, aShape->GetRadius() - thickness / 2 );
m_gal->DrawCircle( start, aShape->GetRadius() + thickness / 2 );
}
else
{
m_gal->SetLineWidth( thickness );
m_gal->SetIsFill( aSegment->GetWidth() == 0 );
m_gal->SetIsStroke( aSegment->GetWidth() > 0 );
m_gal->DrawCircle( start, aSegment->GetRadius() );
m_gal->SetIsFill( aShape->GetWidth() == 0 );
m_gal->SetIsStroke( aShape->GetWidth() > 0 );
m_gal->DrawCircle( start, aShape->GetRadius() );
}
break;
case S_POLYGON:
{
SHAPE_POLY_SET& shape = const_cast<DRAWSEGMENT*>( aSegment )->GetPolyShape();
SHAPE_POLY_SET& shape = const_cast<PCB_SHAPE*>( aShape )->GetPolyShape();
if( shape.OutlineCount() == 0 )
break;
@ -1069,7 +1069,7 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer )
m_gal->Save();
if( MODULE* module = aSegment->GetParentModule() )
if( MODULE* module = aShape->GetParentModule() )
{
m_gal->Translate( module->GetPosition() );
m_gal->Rotate( -module->GetOrientationRadians() );
@ -1080,7 +1080,7 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer )
if( sketch )
m_gal->SetIsFill( false );
else
m_gal->SetIsFill( aSegment->IsPolygonFilled() );
m_gal->SetIsFill( aShape->IsPolygonFilled() );
m_gal->SetIsStroke( true );
m_gal->DrawPolygon( shape );
@ -1095,10 +1095,10 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer )
m_gal->SetLineWidth( thickness );
// Use thickness as filter value to convert the curve to polyline
// when the curve is not supported
m_gal->DrawCurve( VECTOR2D( aSegment->GetStart() ),
VECTOR2D( aSegment->GetBezControl1() ),
VECTOR2D( aSegment->GetBezControl2() ),
VECTOR2D( aSegment->GetEnd() ), thickness );
m_gal->DrawCurve( VECTOR2D( aShape->GetStart() ),
VECTOR2D( aShape->GetBezControl1() ),
VECTOR2D( aShape->GetBezControl2() ),
VECTOR2D( aShape->GetEnd() ), thickness );
break;
case S_LAST:
@ -1107,7 +1107,7 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer )
}
void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer )
void PCB_PAINTER::draw( const PCB_TEXT* aText, int aLayer )
{
wxString shownText( aText->GetShownText() );
@ -1136,7 +1136,7 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer )
}
void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
void PCB_PAINTER::draw( const FP_TEXT* aText, int aLayer )
{
wxString shownText( aText->GetShownText() );
@ -1379,8 +1379,8 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension, int aLayer )
}
}
// Draw text
TEXTE_PCB& text = aDimension->Text();
VECTOR2D position( text.GetTextPos().x, text.GetTextPos().y );
PCB_TEXT& text = aDimension->Text();
VECTOR2D position( text.GetTextPos().x, text.GetTextPos().y );
if( m_pcbSettings.m_sketchText )
{

View File

@ -41,12 +41,12 @@ class BOARD;
class VIA;
class TRACK;
class D_PAD;
class DRAWSEGMENT;
class PCB_SHAPE;
class PCB_GROUP;
class MODULE;
class ZONE_CONTAINER;
class TEXTE_PCB;
class TEXTE_MODULE;
class PCB_TEXT;
class FP_TEXT;
class DIMENSION;
class PCB_TARGET;
class MARKER_PCB;
@ -285,9 +285,9 @@ protected:
void draw( const ARC* aArc, int aLayer );
void draw( const VIA* aVia, int aLayer );
void draw( const D_PAD* aPad, int aLayer );
void draw( const DRAWSEGMENT* aSegment, int aLayer );
void draw( const TEXTE_PCB* aText, int aLayer );
void draw( const TEXTE_MODULE* aText, int aLayer );
void draw( const PCB_SHAPE* aSegment, int aLayer );
void draw( const PCB_TEXT* aText, int aLayer );
void draw( const FP_TEXT* aText, int aLayer );
void draw( const MODULE* aModule, int aLayer );
void draw( const PCB_GROUP* aGroup, int aLayer );
void draw( const ZONE_CONTAINER* aZone, int aLayer );

View File

@ -37,8 +37,8 @@
#include <advanced_config.h>
#include <class_board.h>
#include <class_dimension.h>
#include <class_drawsegment.h>
#include <class_edge_mod.h>
#include <pcb_shape.h>
#include <fp_shape.h>
#include <class_pcb_group.h>
#include <class_pcb_target.h>
#include <class_module.h>
@ -597,11 +597,11 @@ BOARD* PCB_PARSER::parseBOARD_unchecked()
case T_gr_rect:
case T_gr_line:
case T_gr_poly:
m_board->Add( parseDRAWSEGMENT(), ADD_MODE::APPEND );
m_board->Add( parsePCB_SHAPE(), ADD_MODE::APPEND );
break;
case T_gr_text:
m_board->Add( parseTEXTE_PCB(), ADD_MODE::APPEND );
m_board->Add( parsePCB_TEXT(), ADD_MODE::APPEND );
break;
case T_dimension:
@ -2086,20 +2086,20 @@ void PCB_PARSER::parseNETCLASS()
}
DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT( bool aAllowCirclesZeroWidth )
PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE( bool aAllowCirclesZeroWidth )
{
wxCHECK_MSG( CurTok() == T_gr_arc || CurTok() == T_gr_circle || CurTok() == T_gr_curve ||
CurTok() == T_gr_rect || CurTok() == T_gr_line || CurTok() == T_gr_poly, NULL,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as DRAWSEGMENT." ) );
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_SHAPE." ) );
T token;
wxPoint pt;
std::unique_ptr< DRAWSEGMENT > segment( new DRAWSEGMENT( NULL ) );
std::unique_ptr<PCB_SHAPE> shape( new PCB_SHAPE( NULL ) );
switch( CurTok() )
{
case T_gr_arc:
segment->SetShape( S_ARC );
shape->SetShape( S_ARC );
NeedLEFT();
token = NextTok();
@ -2110,7 +2110,7 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT( bool aAllowCirclesZeroWidth )
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetCenter( pt );
shape->SetCenter( pt );
NeedRIGHT();
NeedLEFT();
token = NextTok();
@ -2120,12 +2120,12 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT( bool aAllowCirclesZeroWidth )
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetArcStart( pt );
shape->SetArcStart( pt );
NeedRIGHT();
break;
case T_gr_circle:
segment->SetShape( S_CIRCLE );
shape->SetShape( S_CIRCLE );
NeedLEFT();
token = NextTok();
@ -2134,7 +2134,7 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT( bool aAllowCirclesZeroWidth )
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetCenter( pt );
shape->SetCenter( pt );
NeedRIGHT();
NeedLEFT();
@ -2145,27 +2145,27 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT( bool aAllowCirclesZeroWidth )
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetEnd( pt );
shape->SetEnd( pt );
NeedRIGHT();
break;
case T_gr_curve:
segment->SetShape( S_CURVE );
shape->SetShape( S_CURVE );
NeedLEFT();
token = NextTok();
if( token != T_pts )
Expecting( T_pts );
segment->SetStart( parseXY() );
segment->SetBezControl1( parseXY() );
segment->SetBezControl2( parseXY() );
segment->SetEnd( parseXY() );
shape->SetStart( parseXY() );
shape->SetBezControl1( parseXY() );
shape->SetBezControl2( parseXY() );
shape->SetEnd( parseXY() );
NeedRIGHT();
break;
case T_gr_rect:
segment->SetShape( S_RECT );
shape->SetShape( S_RECT );
NeedLEFT();
token = NextTok();
@ -2174,7 +2174,7 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT( bool aAllowCirclesZeroWidth )
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetStart( pt );
shape->SetStart( pt );
NeedRIGHT();
NeedLEFT();
token = NextTok();
@ -2184,12 +2184,12 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT( bool aAllowCirclesZeroWidth )
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetEnd( pt );
shape->SetEnd( pt );
NeedRIGHT();
break;
case T_gr_line:
// Default DRAWSEGMENT type is S_SEGMENT.
// Default PCB_SHAPE type is S_SEGMENT.
NeedLEFT();
token = NextTok();
@ -2198,7 +2198,7 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT( bool aAllowCirclesZeroWidth )
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetStart( pt );
shape->SetStart( pt );
NeedRIGHT();
NeedLEFT();
token = NextTok();
@ -2208,14 +2208,14 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT( bool aAllowCirclesZeroWidth )
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetEnd( pt );
shape->SetEnd( pt );
NeedRIGHT();
break;
case T_gr_poly:
{
segment->SetShape( S_POLYGON );
segment->SetWidth( 0 ); // this is the default value. will be (perhaps) modified later
shape->SetShape( S_POLYGON );
shape->SetWidth( 0 ); // this is the default value. will be (perhaps) modified later
NeedLEFT();
token = NextTok();
@ -2227,7 +2227,7 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT( bool aAllowCirclesZeroWidth )
while( (token = NextTok()) != T_RIGHT )
pts.push_back( parseXY() );
segment->SetPolyPoints( pts );
shape->SetPolyPoints( pts );
}
break;
@ -2245,25 +2245,25 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT( bool aAllowCirclesZeroWidth )
switch( token )
{
case T_angle:
segment->SetAngle( parseDouble( "segment angle" ) * 10.0 );
shape->SetAngle( parseDouble( "segment angle" ) * 10.0 );
break;
case T_layer:
segment->SetLayer( parseBoardItemLayer() );
shape->SetLayer( parseBoardItemLayer() );
break;
case T_width:
segment->SetWidth( parseBoardUnits( T_width ) );
shape->SetWidth( parseBoardUnits( T_width ) );
break;
case T_tstamp:
NextTok();
const_cast<KIID&>( segment->m_Uuid ) = CurStrToKIID();
const_cast<KIID&>( shape->m_Uuid ) = CurStrToKIID();
break;
/// We continue to parse the status field but it is no longer written
case T_status:
segment->SetStatus( static_cast<STATUS_FLAGS>( parseHex() ) );
shape->SetStatus( static_cast<STATUS_FLAGS>( parseHex() ) );
break;
default:
@ -2277,24 +2277,24 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT( bool aAllowCirclesZeroWidth )
// This is not permitted in KiCad but some external tools generate invalid
// files.
// However in custom pad shapes, zero-line width is allowed for filled circles
if( segment->GetShape() != S_POLYGON && segment->GetWidth() == 0 &&
!( segment->GetShape() == S_CIRCLE && aAllowCirclesZeroWidth ) )
if( shape->GetShape() != S_POLYGON && shape->GetWidth() == 0 &&
!( shape->GetShape() == S_CIRCLE && aAllowCirclesZeroWidth ) )
{
segment->SetWidth( Millimeter2iu( DEFAULT_LINE_WIDTH ) );
shape->SetWidth( Millimeter2iu( DEFAULT_LINE_WIDTH ) );
}
return segment.release();
return shape.release();
}
TEXTE_PCB* PCB_PARSER::parseTEXTE_PCB()
PCB_TEXT* PCB_PARSER::parsePCB_TEXT()
{
wxCHECK_MSG( CurTok() == T_gr_text, NULL,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as TEXTE_PCB." ) );
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_TEXT." ) );
T token;
std::unique_ptr<TEXTE_PCB> text( new TEXTE_PCB( m_board ) );
std::unique_ptr<PCB_TEXT> text( new PCB_TEXT( m_board ) );
NeedSYMBOLorNUMBER();
text->SetText( FromUTF8() );
@ -2434,7 +2434,7 @@ DIMENSION* PCB_PARSER::parseDIMENSION()
case T_gr_text:
{
TEXTE_PCB* text = parseTEXTE_PCB();
PCB_TEXT* text = parsePCB_TEXT();
dimension->Text() = *text;
// The text is part of the dimension and shares its uuid
@ -2979,7 +2979,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
case T_fp_text:
{
TEXTE_MODULE* text = parseTEXTE_MODULE();
FP_TEXT* text = parseFP_TEXT();
text->SetParent( module.get() );
double orientation = text->GetTextAngle();
orientation -= module->GetOrientation();
@ -2988,13 +2988,13 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
switch( text->GetType() )
{
case TEXTE_MODULE::TEXT_is_REFERENCE:
case FP_TEXT::TEXT_is_REFERENCE:
module->Reference() = *text;
const_cast<KIID&>( module->Reference().m_Uuid ) = text->m_Uuid;
delete text;
break;
case TEXTE_MODULE::TEXT_is_VALUE:
case FP_TEXT::TEXT_is_VALUE:
module->Value() = *text;
const_cast<KIID&>( module->Value().m_Uuid ) = text->m_Uuid;
delete text;
@ -3008,17 +3008,17 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
case T_fp_arc:
{
EDGE_MODULE* em = parseEDGE_MODULE();
FP_SHAPE* shape = parseFP_SHAPE();
// Drop 0 and NaN angles as these can corrupt/crash the schematic
if( std::isnormal( em->GetAngle() ) )
if( std::isnormal( shape->GetAngle() ) )
{
em->SetParent( module.get() );
em->SetDrawCoord();
module->Add( em, ADD_MODE::APPEND );
shape->SetParent( module.get() );
shape->SetDrawCoord();
module->Add( shape, ADD_MODE::APPEND );
}
else
delete em;
delete shape;
}
break;
@ -3028,10 +3028,10 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
case T_fp_line:
case T_fp_poly:
{
EDGE_MODULE* em = parseEDGE_MODULE();
em->SetParent( module.get() );
em->SetDrawCoord();
module->Add( em, ADD_MODE::APPEND );
FP_SHAPE* shape = parseFP_SHAPE();
shape->SetParent( module.get() );
shape->SetDrawCoord();
module->Add( shape, ADD_MODE::APPEND );
}
break;
@ -3099,25 +3099,25 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
}
TEXTE_MODULE* PCB_PARSER::parseTEXTE_MODULE()
FP_TEXT* PCB_PARSER::parseFP_TEXT()
{
wxCHECK_MSG( CurTok() == T_fp_text, NULL,
wxString::Format( wxT( "Cannot parse %s as TEXTE_MODULE at line %d, offset %d." ),
wxString::Format( wxT( "Cannot parse %s as FP_TEXT at line %d, offset %d." ),
GetChars( GetTokenString( CurTok() ) ),
CurLineNumber(), CurOffset() ) );
T token = NextTok();
std::unique_ptr<TEXTE_MODULE> text( new TEXTE_MODULE( NULL ) );
std::unique_ptr<FP_TEXT> text( new FP_TEXT( NULL ) );
switch( token )
{
case T_reference:
text->SetType( TEXTE_MODULE::TEXT_is_REFERENCE );
text->SetType( FP_TEXT::TEXT_is_REFERENCE );
break;
case T_value:
text->SetType( TEXTE_MODULE::TEXT_is_VALUE );
text->SetType( FP_TEXT::TEXT_is_VALUE );
break;
case T_user:
@ -3200,21 +3200,21 @@ TEXTE_MODULE* PCB_PARSER::parseTEXTE_MODULE()
}
EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE()
FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
{
wxCHECK_MSG( CurTok() == T_fp_arc || CurTok() == T_fp_circle || CurTok() == T_fp_curve ||
CurTok() == T_fp_rect || CurTok() == T_fp_line || CurTok() == T_fp_poly, NULL,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as EDGE_MODULE." ) );
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as FP_SHAPE." ) );
wxPoint pt;
T token;
std::unique_ptr< EDGE_MODULE > segment( new EDGE_MODULE( NULL ) );
std::unique_ptr<FP_SHAPE> shape( new FP_SHAPE( NULL ) );
switch( CurTok() )
{
case T_fp_arc:
segment->SetShape( S_ARC );
shape->SetShape( S_ARC );
NeedLEFT();
token = NextTok();
@ -3225,7 +3225,7 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE()
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetStart0( pt );
shape->SetStart0( pt );
NeedRIGHT();
NeedLEFT();
token = NextTok();
@ -3235,7 +3235,7 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE()
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetEnd0( pt );
shape->SetEnd0( pt );
NeedRIGHT();
NeedLEFT();
token = NextTok();
@ -3245,12 +3245,12 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE()
// Setting angle will set m_ThirdPoint0, so must be done after setting
// m_Start0 and m_End0
segment->SetAngle( parseDouble( "segment angle" ) * 10.0 );
shape->SetAngle( parseDouble( "segment angle" ) * 10.0 );
NeedRIGHT();
break;
case T_fp_circle:
segment->SetShape( S_CIRCLE );
shape->SetShape( S_CIRCLE );
NeedLEFT();
token = NextTok();
@ -3259,7 +3259,7 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE()
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetStart0( pt );
shape->SetStart0( pt );
NeedRIGHT();
NeedLEFT();
token = NextTok();
@ -3269,27 +3269,27 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE()
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetEnd0( pt );
shape->SetEnd0( pt );
NeedRIGHT();
break;
case T_fp_curve:
segment->SetShape( S_CURVE );
shape->SetShape( S_CURVE );
NeedLEFT();
token = NextTok();
if( token != T_pts )
Expecting( T_pts );
segment->SetStart0( parseXY() );
segment->SetBezier0_C1( parseXY() );
segment->SetBezier0_C2( parseXY() );
segment->SetEnd0( parseXY() );
shape->SetStart0( parseXY() );
shape->SetBezier0_C1( parseXY() );
shape->SetBezier0_C2( parseXY() );
shape->SetEnd0( parseXY() );
NeedRIGHT();
break;
case T_fp_rect:
segment->SetShape( S_RECT );
shape->SetShape( S_RECT );
NeedLEFT();
token = NextTok();
@ -3298,7 +3298,7 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE()
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetStart0( pt );
shape->SetStart0( pt );
NeedRIGHT();
NeedLEFT();
@ -3309,12 +3309,12 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE()
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetEnd0( pt );
shape->SetEnd0( pt );
NeedRIGHT();
break;
case T_fp_line:
// Default DRAWSEGMENT type is S_SEGMENT.
// Default PCB_SHAPE type is S_SEGMENT.
NeedLEFT();
token = NextTok();
@ -3323,7 +3323,7 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE()
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetStart0( pt );
shape->SetStart0( pt );
NeedRIGHT();
NeedLEFT();
@ -3334,13 +3334,13 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE()
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetEnd0( pt );
shape->SetEnd0( pt );
NeedRIGHT();
break;
case T_fp_poly:
{
segment->SetShape( S_POLYGON );
shape->SetShape( S_POLYGON );
NeedLEFT();
token = NextTok();
@ -3352,7 +3352,7 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE()
while( (token = NextTok()) != T_RIGHT )
pts.push_back( parseXY() );
segment->SetPolyPoints( pts );
shape->SetPolyPoints( pts );
}
break;
@ -3370,21 +3370,21 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE()
switch( token )
{
case T_layer:
segment->SetLayer( parseBoardItemLayer() );
shape->SetLayer( parseBoardItemLayer() );
break;
case T_width:
segment->SetWidth( parseBoardUnits( T_width ) );
shape->SetWidth( parseBoardUnits( T_width ) );
break;
case T_tstamp:
NextTok();
const_cast<KIID&>( segment->m_Uuid ) = CurStrToKIID();
const_cast<KIID&>( shape->m_Uuid ) = CurStrToKIID();
break;
/// We continue to parse the status field but it is no longer written
case T_status:
segment->SetStatus( static_cast<STATUS_FLAGS>( parseHex() ) );
shape->SetStatus( static_cast<STATUS_FLAGS>( parseHex() ) );
break;
default:
@ -3396,15 +3396,15 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE()
// Only filled shapes may have a zero-line width. While not permitted in KiCad, some
// external tools generate invalid files.
if( segment->GetShape() != S_RECT
&& segment->GetShape() != S_CIRCLE
&& segment->GetShape() != S_POLYGON
&& segment->GetWidth() == 0 )
if( shape->GetShape() != S_RECT
&& shape->GetShape() != S_CIRCLE
&& shape->GetShape() != S_POLYGON
&& shape->GetWidth() == 0 )
{
segment->SetWidth( Millimeter2iu( DEFAULT_LINE_WIDTH ) );
shape->SetWidth( Millimeter2iu( DEFAULT_LINE_WIDTH ) );
}
return segment.release();
return shape.release();
}
@ -3790,47 +3790,47 @@ D_PAD* PCB_PARSER::parseD_PAD( MODULE* aParent )
token = NextTok();
// Currently, I am using parseDRAWSEGMENT() to read basic shapes parameters,
// because they are the same as a DRAWSEGMENT.
// because they are the same as a PCB_SHAPE.
// However it could be better to write a specific parser, to avoid possible issues
// if the DRAWSEGMENT parser is modified.
DRAWSEGMENT* dummysegm = NULL;
// if the PCB_SHAPE parser is modified.
PCB_SHAPE* dummysegm = NULL;
switch( token )
{
case T_gr_arc:
dummysegm = parseDRAWSEGMENT();
dummysegm = parsePCB_SHAPE();
pad->AddPrimitiveArc( dummysegm->GetCenter(), dummysegm->GetArcStart(),
dummysegm->GetAngle(), dummysegm->GetWidth() );
break;
case T_gr_line:
dummysegm = parseDRAWSEGMENT();
dummysegm = parsePCB_SHAPE();
pad->AddPrimitiveSegment( dummysegm->GetStart(), dummysegm->GetEnd(),
dummysegm->GetWidth() );
break;
case T_gr_circle:
dummysegm = parseDRAWSEGMENT( true ); // Circles with 0 thickness are allowed
dummysegm = parsePCB_SHAPE( true ); // Circles with 0 thickness are allowed
// ( filled circles )
pad->AddPrimitiveCircle( dummysegm->GetCenter(), dummysegm->GetRadius(),
dummysegm->GetWidth() );
break;
case T_gr_rect:
dummysegm = parseDRAWSEGMENT( true );
dummysegm = parsePCB_SHAPE( true );
pad->AddPrimitiveRect( dummysegm->GetStart(), dummysegm->GetEnd(),
dummysegm->GetWidth() );
break;
case T_gr_poly:
dummysegm = parseDRAWSEGMENT();
dummysegm = parsePCB_SHAPE();
pad->AddPrimitivePoly( dummysegm->BuildPolyPointsList(),
dummysegm->GetWidth() );
break;
case T_gr_curve:
dummysegm = parseDRAWSEGMENT();
dummysegm = parsePCB_SHAPE();
pad->AddPrimitiveCurve( dummysegm->GetStart(), dummysegm->GetEnd(),
dummysegm->GetBezControl1(),
dummysegm->GetBezControl2(),

View File

@ -46,11 +46,11 @@ class BOARD_ITEM_CONTAINER;
class D_PAD;
class BOARD_DESIGN_SETTINGS;
class DIMENSION;
class DRAWSEGMENT;
class PCB_SHAPE;
class EDA_TEXT;
class EDGE_MODULE;
class TEXTE_MODULE;
class TEXTE_PCB;
class FP_SHAPE;
class FP_TEXT;
class PCB_TEXT;
class TRACK;
class MODULE;
class PCB_GROUP;
@ -157,12 +157,12 @@ class PCB_PARSER : public PCB_LEXER
void parseNETINFO_ITEM();
void parseNETCLASS();
/** Read a DRAWSEGMENT description.
/** Read a PCB_SHAPE description.
* @param aAllowCirclesZeroWidth = true to allow items with 0 width
* Only used in custom pad shapes for filled circles.
*/
DRAWSEGMENT* parseDRAWSEGMENT( bool aAllowCirclesZeroWidth = false );
TEXTE_PCB* parseTEXTE_PCB();
PCB_SHAPE* parsePCB_SHAPE( bool aAllowCirclesZeroWidth = false );
PCB_TEXT* parsePCB_TEXT();
DIMENSION* parseDIMENSION();
/**
@ -170,8 +170,8 @@ class PCB_PARSER : public PCB_LEXER
* Parse a module, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically.
*/
MODULE* parseMODULE_unchecked( wxArrayString* aInitialComments = 0 );
TEXTE_MODULE* parseTEXTE_MODULE();
EDGE_MODULE* parseEDGE_MODULE();
FP_TEXT* parseFP_TEXT();
FP_SHAPE* parseFP_SHAPE();
D_PAD* parseD_PAD( MODULE* aParent = NULL );
// Parse only the (option ...) inside a pad description
bool parseD_PAD_option( D_PAD* aPad );

View File

@ -30,7 +30,7 @@
#include <pcb_edit_frame.h>
#include <class_board.h>
#include <class_module.h>
#include <class_drawsegment.h>
#include <pcb_shape.h>
#include <base_units.h>
#include <geometry/shape_simple.h>
#include <geometry/shape_segment.h>
@ -41,7 +41,7 @@
#include <settings/settings_manager.h>
DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* aParent, KICAD_T idtype ) :
PCB_SHAPE::PCB_SHAPE( BOARD_ITEM* aParent, KICAD_T idtype ) :
BOARD_ITEM( aParent, idtype )
{
m_Type = 0;
@ -52,18 +52,18 @@ DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* aParent, KICAD_T idtype ) :
}
DRAWSEGMENT::~DRAWSEGMENT()
PCB_SHAPE::~PCB_SHAPE()
{
}
void DRAWSEGMENT::SetPosition( const wxPoint& aPos )
void PCB_SHAPE::SetPosition( const wxPoint& aPos )
{
m_Start = aPos;
}
wxPoint DRAWSEGMENT::GetPosition() const
wxPoint PCB_SHAPE::GetPosition() const
{
if( m_Shape == S_POLYGON )
return (wxPoint) m_Poly.CVertex( 0 );
@ -72,7 +72,7 @@ wxPoint DRAWSEGMENT::GetPosition() const
}
double DRAWSEGMENT::GetLength() const
double PCB_SHAPE::GetLength() const
{
double length = 0.0;
@ -99,7 +99,7 @@ double DRAWSEGMENT::GetLength() const
break;
default:
wxASSERT_MSG( false, "DRAWSEGMENT::GetLength not implemented for shape"
wxASSERT_MSG( false, "PCB_SHAPE::GetLength not implemented for shape"
+ ShowShape( GetShape() ) );
break;
}
@ -108,7 +108,7 @@ double DRAWSEGMENT::GetLength() const
}
void DRAWSEGMENT::Move( const wxPoint& aMoveVector )
void PCB_SHAPE::Move( const wxPoint& aMoveVector )
{
// Move vector should not affect start/end for polygon since it will
// be applied directly to polygon outline.
@ -143,7 +143,7 @@ void DRAWSEGMENT::Move( const wxPoint& aMoveVector )
}
void DRAWSEGMENT::Scale( double aScale )
void PCB_SHAPE::Scale( double aScale )
{
auto scalePt = [&]( wxPoint& pt )
{
@ -189,7 +189,7 @@ void DRAWSEGMENT::Scale( double aScale )
}
void DRAWSEGMENT::Rotate( const wxPoint& aRotCentre, double aAngle )
void PCB_SHAPE::Rotate( const wxPoint& aRotCentre, double aAngle )
{
switch( m_Shape )
{
@ -237,14 +237,14 @@ void DRAWSEGMENT::Rotate( const wxPoint& aRotCentre, double aAngle )
break;
default:
wxFAIL_MSG( "DRAWSEGMENT::Rotate not implemented for "
wxFAIL_MSG( "PCB_SHAPE::Rotate not implemented for "
+ PCB_SHAPE_TYPE_T_asString( m_Shape ) );
break;
}
}
void DRAWSEGMENT::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
void PCB_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
{
if( aFlipLeftRight )
{
@ -293,18 +293,18 @@ void DRAWSEGMENT::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
break;
default:
wxFAIL_MSG( "DRAWSEGMENT::Flip not implemented for "
wxFAIL_MSG( "PCB_SHAPE::Flip not implemented for "
+ PCB_SHAPE_TYPE_T_asString( m_Shape ) );
break;
}
// DRAWSEGMENT items are not allowed on copper layers, so
// PCB_SHAPE items are not allowed on copper layers, so
// copper layers count is not taken in account in Flip transform
SetLayer( FlipLayer( GetLayer() ) );
}
void DRAWSEGMENT::RebuildBezierToSegmentsPointsList( int aMinSegLen )
void PCB_SHAPE::RebuildBezierToSegmentsPointsList( int aMinSegLen )
{
// Has meaning only for S_CURVE DRAW_SEGMENT shape
if( m_Shape != S_CURVE )
@ -317,7 +317,7 @@ void DRAWSEGMENT::RebuildBezierToSegmentsPointsList( int aMinSegLen )
}
const std::vector<wxPoint> DRAWSEGMENT::buildBezierToSegmentsPointsList( int aMinSegLen ) const
const std::vector<wxPoint> PCB_SHAPE::buildBezierToSegmentsPointsList( int aMinSegLen ) const
{
std::vector<wxPoint> bezierPoints;
@ -330,7 +330,7 @@ const std::vector<wxPoint> DRAWSEGMENT::buildBezierToSegmentsPointsList( int aMi
}
wxPoint DRAWSEGMENT::GetCenter() const
wxPoint PCB_SHAPE::GetCenter() const
{
wxPoint c;
@ -353,7 +353,7 @@ wxPoint DRAWSEGMENT::GetCenter() const
break;
default:
wxFAIL_MSG( "DRAWSEGMENT::GetCentre not implemented for "
wxFAIL_MSG( "PCB_SHAPE::GetCentre not implemented for "
+ PCB_SHAPE_TYPE_T_asString( m_Shape ) );
break;
}
@ -362,7 +362,7 @@ wxPoint DRAWSEGMENT::GetCenter() const
}
wxPoint DRAWSEGMENT::GetArcEnd() const
wxPoint PCB_SHAPE::GetArcEnd() const
{
wxPoint endPoint( m_End ); // start of arc
@ -380,7 +380,7 @@ wxPoint DRAWSEGMENT::GetArcEnd() const
}
wxPoint DRAWSEGMENT::GetArcMid() const
wxPoint PCB_SHAPE::GetArcMid() const
{
wxPoint endPoint( m_End );
@ -402,7 +402,7 @@ wxPoint DRAWSEGMENT::GetArcMid() const
}
double DRAWSEGMENT::GetArcAngleStart() const
double PCB_SHAPE::GetArcAngleStart() const
{
// due to the Y axis orient atan2 needs - y value
double angleStart = ArcTangente( GetArcStart().y - GetCenter().y,
@ -416,7 +416,7 @@ double DRAWSEGMENT::GetArcAngleStart() const
return angleStart;
}
double DRAWSEGMENT::GetArcAngleEnd() const
double PCB_SHAPE::GetArcAngleEnd() const
{
// due to the Y axis orient atan2 needs - y value
double angleStart = ArcTangente( GetArcEnd().y - GetCenter().y,
@ -431,7 +431,7 @@ double DRAWSEGMENT::GetArcAngleEnd() const
}
void DRAWSEGMENT::SetAngle( double aAngle )
void PCB_SHAPE::SetAngle( double aAngle )
{
// Mark as depreciated.
// m_Angle does not define the arc anymore
@ -442,7 +442,7 @@ void DRAWSEGMENT::SetAngle( double aAngle )
}
MODULE* DRAWSEGMENT::GetParentModule() const
MODULE* PCB_SHAPE::GetParentModule() const
{
if( !m_Parent || m_Parent->Type() != PCB_MODULE_T )
return NULL;
@ -451,7 +451,7 @@ MODULE* DRAWSEGMENT::GetParentModule() const
}
void DRAWSEGMENT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
void PCB_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{
EDA_UNITS units = aFrame->GetUserUnits();
ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms();
@ -556,7 +556,7 @@ void DRAWSEGMENT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL
}
const EDA_RECT DRAWSEGMENT::GetBoundingBox() const
const EDA_RECT PCB_SHAPE::GetBoundingBox() const
{
EDA_RECT bbox;
@ -616,7 +616,7 @@ const EDA_RECT DRAWSEGMENT::GetBoundingBox() const
break;
default:
wxFAIL_MSG( "DRAWSEGMENT::GetBoundingBox not implemented for "
wxFAIL_MSG( "PCB_SHAPE::GetBoundingBox not implemented for "
+ PCB_SHAPE_TYPE_T_asString( m_Shape ) );
break;
}
@ -628,7 +628,7 @@ const EDA_RECT DRAWSEGMENT::GetBoundingBox() const
}
bool DRAWSEGMENT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
bool PCB_SHAPE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
int maxdist = aAccuracy + ( m_Width / 2 );
@ -693,7 +693,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
break;
case S_CURVE:
((DRAWSEGMENT*)this)->RebuildBezierToSegmentsPointsList( m_Width );
( (PCB_SHAPE*) this)->RebuildBezierToSegmentsPointsList( m_Width );
for( unsigned int i= 1; i < m_BezierPoints.size(); i++)
{
@ -748,7 +748,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
break;
default:
wxFAIL_MSG( "DRAWSEGMENT::HitTest (point) not implemented for "
wxFAIL_MSG( "PCB_SHAPE::HitTest (point) not implemented for "
+ PCB_SHAPE_TYPE_T_asString( m_Shape ) );
break;
}
@ -757,7 +757,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
}
bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
bool PCB_SHAPE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{
EDA_RECT arect = aRect;
arect.Normalize();
@ -905,7 +905,7 @@ bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
default:
wxFAIL_MSG( "DRAWSEGMENT::HitTest (rect) not implemented for "
wxFAIL_MSG( "PCB_SHAPE::HitTest (rect) not implemented for "
+ PCB_SHAPE_TYPE_T_asString( m_Shape ) );
break;
}
@ -914,7 +914,7 @@ bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
}
wxString DRAWSEGMENT::GetSelectMenuText( EDA_UNITS aUnits ) const
wxString PCB_SHAPE::GetSelectMenuText( EDA_UNITS aUnits ) const
{
return wxString::Format( _( "%s on %s" ),
ShowShape( m_Shape ),
@ -922,19 +922,19 @@ wxString DRAWSEGMENT::GetSelectMenuText( EDA_UNITS aUnits ) const
}
BITMAP_DEF DRAWSEGMENT::GetMenuImage() const
BITMAP_DEF PCB_SHAPE::GetMenuImage() const
{
return add_dashed_line_xpm;
}
EDA_ITEM* DRAWSEGMENT::Clone() const
EDA_ITEM* PCB_SHAPE::Clone() const
{
return new DRAWSEGMENT( *this );
return new PCB_SHAPE( *this );
}
const BOX2I DRAWSEGMENT::ViewBBox() const
const BOX2I PCB_SHAPE::ViewBBox() const
{
// For arcs - do not include the center point in the bounding box,
// it is redundant for displaying an arc
@ -950,7 +950,7 @@ const BOX2I DRAWSEGMENT::ViewBBox() const
}
std::vector<wxPoint> DRAWSEGMENT::GetRectCorners() const
std::vector<wxPoint> PCB_SHAPE::GetRectCorners() const
{
std::vector<wxPoint> pts;
MODULE* module = GetParentModule();
@ -987,7 +987,7 @@ std::vector<wxPoint> DRAWSEGMENT::GetRectCorners() const
}
void DRAWSEGMENT::computeArcBBox( EDA_RECT& aBBox ) const
void PCB_SHAPE::computeArcBBox( EDA_RECT& aBBox ) const
{
// Do not include the center, which is not necessarily
// inside the BB of a arc with a small angle
@ -1051,7 +1051,7 @@ void DRAWSEGMENT::computeArcBBox( EDA_RECT& aBBox ) const
}
void DRAWSEGMENT::SetPolyPoints( const std::vector<wxPoint>& aPoints )
void PCB_SHAPE::SetPolyPoints( const std::vector<wxPoint>& aPoints )
{
m_Poly.RemoveAllContours();
m_Poly.NewOutline();
@ -1061,7 +1061,7 @@ void DRAWSEGMENT::SetPolyPoints( const std::vector<wxPoint>& aPoints )
}
std::vector<SHAPE*> DRAWSEGMENT::MakeEffectiveShapes() const
std::vector<SHAPE*> PCB_SHAPE::MakeEffectiveShapes() const
{
std::vector<SHAPE*> effectiveShapes;
@ -1158,7 +1158,7 @@ std::vector<SHAPE*> DRAWSEGMENT::MakeEffectiveShapes() const
break;
default:
wxFAIL_MSG( "DRAWSEGMENT::MakeEffectiveShapes unsupported DRAWSEGMENT shape: "
wxFAIL_MSG( "PCB_SHAPE::MakeEffectiveShapes unsupported PCB_SHAPE shape: "
+ PCB_SHAPE_TYPE_T_asString( m_Shape ) );
break;
}
@ -1167,13 +1167,13 @@ std::vector<SHAPE*> DRAWSEGMENT::MakeEffectiveShapes() const
}
std::shared_ptr<SHAPE> DRAWSEGMENT::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
std::shared_ptr<SHAPE> PCB_SHAPE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
{
return std::shared_ptr<SHAPE>( new SHAPE_COMPOUND( MakeEffectiveShapes() ) );
}
const std::vector<wxPoint> DRAWSEGMENT::BuildPolyPointsList() const
const std::vector<wxPoint> PCB_SHAPE::BuildPolyPointsList() const
{
std::vector<wxPoint> rv;
@ -1190,7 +1190,7 @@ const std::vector<wxPoint> DRAWSEGMENT::BuildPolyPointsList() const
}
bool DRAWSEGMENT::IsPolyShapeValid() const
bool PCB_SHAPE::IsPolyShapeValid() const
{
// return true if the polygonal shape is valid (has more than 2 points)
if( GetPolyShape().OutlineCount() == 0 )
@ -1202,7 +1202,7 @@ bool DRAWSEGMENT::IsPolyShapeValid() const
}
int DRAWSEGMENT::GetPointCount() const
int PCB_SHAPE::GetPointCount() const
{
// return the number of corners of the polygonal shape
// this shape is expected to be only one polygon without hole
@ -1213,9 +1213,9 @@ int DRAWSEGMENT::GetPointCount() const
}
void DRAWSEGMENT::SwapData( BOARD_ITEM* aImage )
void PCB_SHAPE::SwapData( BOARD_ITEM* aImage )
{
DRAWSEGMENT* image = dynamic_cast<DRAWSEGMENT*>( aImage );
PCB_SHAPE* image = dynamic_cast<PCB_SHAPE*>( aImage );
assert( image );
std::swap( m_Width, image->m_Width );
@ -1237,7 +1237,7 @@ void DRAWSEGMENT::SwapData( BOARD_ITEM* aImage )
}
bool DRAWSEGMENT::cmp_drawings::operator()( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const
bool PCB_SHAPE::cmp_drawings::operator()( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const
{
if( aFirst->Type() != aSecond->Type() )
return aFirst->Type() < aSecond->Type();
@ -1247,8 +1247,8 @@ bool DRAWSEGMENT::cmp_drawings::operator()( const BOARD_ITEM* aFirst, const BOAR
if( aFirst->Type() == PCB_SHAPE_T )
{
const DRAWSEGMENT* dwgA = static_cast<const DRAWSEGMENT*>( aFirst );
const DRAWSEGMENT* dwgB = static_cast<const DRAWSEGMENT*>( aSecond );
const PCB_SHAPE* dwgA = static_cast<const PCB_SHAPE*>( aFirst );
const PCB_SHAPE* dwgB = static_cast<const PCB_SHAPE*>( aSecond );
if( dwgA->GetShape() != dwgB->GetShape() )
return dwgA->GetShape() < dwgB->GetShape();
@ -1263,19 +1263,19 @@ static struct DRAWSEGMENT_DESC
DRAWSEGMENT_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( DRAWSEGMENT );
propMgr.InheritsAfter( TYPE_HASH( DRAWSEGMENT ), TYPE_HASH( BOARD_ITEM ) );
REGISTER_TYPE( PCB_SHAPE );
propMgr.InheritsAfter( TYPE_HASH( PCB_SHAPE ), TYPE_HASH( BOARD_ITEM ) );
propMgr.AddProperty( new PROPERTY<DRAWSEGMENT, int>( _( "Thickness" ),
&DRAWSEGMENT::SetWidth, &DRAWSEGMENT::GetWidth, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<PCB_SHAPE, int>( _( "Thickness" ),
&PCB_SHAPE::SetWidth, &PCB_SHAPE::GetWidth, PROPERTY_DISPLAY::DISTANCE ) );
// TODO show certain properties depending on the shape
propMgr.AddProperty( new PROPERTY<DRAWSEGMENT, double>( _( "Angle" ),
&DRAWSEGMENT::SetAngle, &DRAWSEGMENT::GetAngle, PROPERTY_DISPLAY::DECIDEGREE ) );
propMgr.AddProperty( new PROPERTY<PCB_SHAPE, double>( _( "Angle" ),
&PCB_SHAPE::SetAngle, &PCB_SHAPE::GetAngle, PROPERTY_DISPLAY::DECIDEGREE ) );
// TODO or may have different names (arcs)
// TODO type?
propMgr.AddProperty( new PROPERTY<DRAWSEGMENT, int>( _( "End X" ),
&DRAWSEGMENT::SetEndX, &DRAWSEGMENT::GetEndX, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<DRAWSEGMENT, int>( _( "End Y" ),
&DRAWSEGMENT::SetEndY, &DRAWSEGMENT::GetEndY, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<PCB_SHAPE, int>( _( "End X" ),
&PCB_SHAPE::SetEndX, &PCB_SHAPE::GetEndX, PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<PCB_SHAPE, int>( _( "End Y" ),
&PCB_SHAPE::SetEndY, &PCB_SHAPE::GetEndY, PROPERTY_DISPLAY::DISTANCE ) );
}
} _DRAWSEGMENT_DESC;

View File

@ -22,13 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file class_drawsegment.h
* @brief Class to handle a graphic segment.
*/
#ifndef CLASS_DRAWSEGMENT_H_
#define CLASS_DRAWSEGMENT_H_
#ifndef PCB_SHAPE_H
#define PCB_SHAPE_H
#include <class_board_item.h>
#include <common.h>
@ -45,7 +40,7 @@ class MODULE;
class MSG_PANEL_ITEM;
class DRAWSEGMENT : public BOARD_ITEM
class PCB_SHAPE : public BOARD_ITEM
{
protected:
int m_Width; // thickness of lines ...
@ -68,12 +63,12 @@ protected:
const std::vector<wxPoint> buildBezierToSegmentsPointsList( int aMinSegLen ) const;
public:
DRAWSEGMENT( BOARD_ITEM* aParent = NULL, KICAD_T idtype = PCB_SHAPE_T );
PCB_SHAPE( BOARD_ITEM* aParent = NULL, KICAD_T idtype = PCB_SHAPE_T );
// Do not create a copy constructor & operator=.
// The ones generated by the compiler are adequate.
~DRAWSEGMENT();
~PCB_SHAPE();
static inline bool ClassOf( const EDA_ITEM* aItem )
{
@ -224,7 +219,7 @@ public:
/**
* Function GetParentModule
* returns a pointer to the parent module, or NULL if DRAWSEGMENT does not
* returns a pointer to the parent module, or NULL if PCB_SHAPE does not
* belong to a module.
* @return MODULE* - pointer to the parent module or NULL.
*/
@ -273,7 +268,7 @@ public:
void SetPolyPoints( const std::vector<wxPoint>& aPoints );
/**
* Makes a set of SHAPE objects representing the DRAWSEGMENT. Caller owns the objects.
* Makes a set of SHAPE objects representing the PCB_SHAPE. Caller owns the objects.
*/
std::vector<SHAPE*> MakeEffectiveShapes() const; // fixme: move to shape_compound
virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override;
@ -287,7 +282,7 @@ public:
wxString GetClass() const override
{
return wxT( "DRAWSEGMENT" );
return wxT( "PCB_SHAPE" );
}
/**
@ -340,4 +335,4 @@ public:
#endif
};
#endif // CLASS_DRAWSEGMENT_H_
#endif // PCB_SHAPE_H

View File

@ -28,13 +28,13 @@
#include <base_units.h>
#include <bitmaps.h>
#include <class_board.h>
#include <class_pcb_text.h>
#include <pcb_text.h>
#include <pcb_painter.h>
using KIGFX::PCB_RENDER_SETTINGS;
TEXTE_PCB::TEXTE_PCB( BOARD_ITEM* parent ) :
PCB_TEXT::PCB_TEXT( BOARD_ITEM* parent ) :
BOARD_ITEM( parent, PCB_TEXT_T ),
EDA_TEXT()
{
@ -42,12 +42,12 @@ TEXTE_PCB::TEXTE_PCB( BOARD_ITEM* parent ) :
}
TEXTE_PCB::~TEXTE_PCB()
PCB_TEXT::~PCB_TEXT()
{
}
wxString TEXTE_PCB::GetShownText( int aDepth ) const
wxString PCB_TEXT::GetShownText( int aDepth ) const
{
BOARD* board = dynamic_cast<BOARD*>( GetParent() );
@ -96,17 +96,17 @@ wxString TEXTE_PCB::GetShownText( int aDepth ) const
}
void TEXTE_PCB::SetTextAngle( double aAngle )
void PCB_TEXT::SetTextAngle( double aAngle )
{
EDA_TEXT::SetTextAngle( NormalizeAngle360Min( aAngle ) );
}
void TEXTE_PCB::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
void PCB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{
wxString msg;
wxCHECK_RET( m_Parent != NULL, wxT( "TEXTE_PCB::GetMsgPanelInfo() m_Parent is NULL." ) );
wxCHECK_RET( m_Parent != NULL, wxT( "PCB_TEXT::GetMsgPanelInfo() m_Parent is NULL." ) );
aList.emplace_back( _( "PCB Text" ), GetShownText(), DARKGREEN );
@ -131,7 +131,7 @@ void TEXTE_PCB::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
}
const EDA_RECT TEXTE_PCB::GetBoundingBox() const
const EDA_RECT PCB_TEXT::GetBoundingBox() const
{
EDA_RECT rect = GetTextBox();
@ -142,7 +142,7 @@ const EDA_RECT TEXTE_PCB::GetBoundingBox() const
}
void TEXTE_PCB::Rotate( const wxPoint& aRotCentre, double aAngle )
void PCB_TEXT::Rotate( const wxPoint& aRotCentre, double aAngle )
{
wxPoint pt = GetTextPos();
RotatePoint( &pt, aRotCentre, aAngle );
@ -152,7 +152,7 @@ void TEXTE_PCB::Rotate( const wxPoint& aRotCentre, double aAngle )
}
void TEXTE_PCB::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
void PCB_TEXT::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
{
double angle = GetTextAngle();
bool vertical = KiROUND( angle ) % 1800 == 900;
@ -210,33 +210,33 @@ void TEXTE_PCB::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
}
wxString TEXTE_PCB::GetSelectMenuText( EDA_UNITS aUnits ) const
wxString PCB_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
{
return wxString::Format( _( "PCB Text '%s' on %s"), ShortenedShownText(), GetLayerName() );
}
BITMAP_DEF TEXTE_PCB::GetMenuImage() const
BITMAP_DEF PCB_TEXT::GetMenuImage() const
{
return text_xpm;
}
EDA_ITEM* TEXTE_PCB::Clone() const
EDA_ITEM* PCB_TEXT::Clone() const
{
return new TEXTE_PCB( *this );
return new PCB_TEXT( *this );
}
void TEXTE_PCB::SwapData( BOARD_ITEM* aImage )
void PCB_TEXT::SwapData( BOARD_ITEM* aImage )
{
assert( aImage->Type() == PCB_TEXT_T );
std::swap( *((TEXTE_PCB*) this), *((TEXTE_PCB*) aImage) );
std::swap( *((PCB_TEXT*) this), *((PCB_TEXT*) aImage) );
}
std::shared_ptr<SHAPE> TEXTE_PCB::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
std::shared_ptr<SHAPE> PCB_TEXT::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
{
return GetEffectiveTextShape();
}
@ -247,10 +247,10 @@ static struct TEXTE_PCB_DESC
TEXTE_PCB_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( TEXTE_PCB );
propMgr.AddTypeCast( new TYPE_CAST<TEXTE_PCB, BOARD_ITEM> );
propMgr.AddTypeCast( new TYPE_CAST<TEXTE_PCB, EDA_TEXT> );
propMgr.InheritsAfter( TYPE_HASH( TEXTE_PCB ), TYPE_HASH( BOARD_ITEM ) );
propMgr.InheritsAfter( TYPE_HASH( TEXTE_PCB ), TYPE_HASH( EDA_TEXT ) );
REGISTER_TYPE( PCB_TEXT );
propMgr.AddTypeCast( new TYPE_CAST<PCB_TEXT, BOARD_ITEM> );
propMgr.AddTypeCast( new TYPE_CAST<PCB_TEXT, EDA_TEXT> );
propMgr.InheritsAfter( TYPE_HASH( PCB_TEXT ), TYPE_HASH( BOARD_ITEM ) );
propMgr.InheritsAfter( TYPE_HASH( PCB_TEXT ), TYPE_HASH( EDA_TEXT ) );
}
} _TEXTE_PCB_DESC;

View File

@ -22,13 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file class_pcb_text.h
* @brief TEXTE_PCB class definition.
*/
#ifndef CLASS_PCB_TEXT_H
#define CLASS_PCB_TEXT_H
#ifndef PCB_TEXT_H
#define PCB_TEXT_H
#include <eda_text.h>
#include <class_board_item.h>
@ -38,15 +33,15 @@ class LINE_READER;
class MSG_PANEL_ITEM;
class TEXTE_PCB : public BOARD_ITEM, public EDA_TEXT
class PCB_TEXT : public BOARD_ITEM, public EDA_TEXT
{
public:
TEXTE_PCB( BOARD_ITEM* parent );
PCB_TEXT( BOARD_ITEM* parent );
// Do not create a copy constructor & operator=.
// The ones generated by the compiler are adequate.
~TEXTE_PCB();
~PCB_TEXT();
static inline bool ClassOf( const EDA_ITEM* aItem )
{
@ -146,4 +141,4 @@ public:
#endif
};
#endif // #define CLASS_PCB_TEXT_H
#endif // #define PCB_TEXT_H

View File

@ -39,14 +39,14 @@
#include <wx/filename.h>
class PLOTTER;
class TEXTE_PCB;
class PCB_TEXT;
class D_PAD;
class DRAWSEGMENT;
class PCB_SHAPE;
class DIMENSION;
class MODULE;
class EDGE_MODULE;
class FP_SHAPE;
class PCB_TARGET;
class TEXTE_MODULE;
class FP_TEXT;
class ZONE_CONTAINER;
class BOARD;
class REPORTER;
@ -91,8 +91,8 @@ public:
// Basic functions to plot a board item
void SetLayerSet( LSET aLayerMask ) { m_layerMask = aLayerMask; }
void PlotFootprintGraphicItems( MODULE* aModule );
void PlotFootprintGraphicItem( EDGE_MODULE* aEdge );
void PlotFootprintTextItem( TEXTE_MODULE* aTextMod, COLOR4D aColor );
void PlotFootprintGraphicItem( FP_SHAPE* aShape );
void PlotFootprintTextItem( FP_TEXT* aText, COLOR4D aColor );
/*
* Reference, Value, and other fields are plotted only if the corresponding option is enabled.
@ -103,8 +103,8 @@ public:
void PlotDimension( DIMENSION* Dimension );
void PlotPcbTarget( PCB_TARGET* PtMire );
void PlotFilledAreas( ZONE_CONTAINER* aZone, SHAPE_POLY_SET& aPolysList );
void PlotTextePcb( TEXTE_PCB* pt_texte );
void PlotDrawSegment( DRAWSEGMENT* PtSegm );
void PlotPcbText( PCB_TEXT* aText );
void PlotPcbShape( PCB_SHAPE* aShape );
/**
* Plot a pad.

View File

@ -38,10 +38,10 @@
#include <class_board.h>
#include <class_module.h>
#include <class_track.h>
#include <class_edge_mod.h>
#include <class_pcb_text.h>
#include <fp_shape.h>
#include <pcb_text.h>
#include <class_zone.h>
#include <class_drawsegment.h>
#include <pcb_shape.h>
#include <class_pcb_target.h>
#include <class_dimension.h>
@ -783,7 +783,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
itemplotter.PlotFootprintTextItems( module );
if( item->Type() == PCB_FP_SHAPE_T && item->GetLayer() == layer )
itemplotter.PlotFootprintGraphicItem((EDGE_MODULE*) item );
itemplotter.PlotFootprintGraphicItem( (FP_SHAPE*) item );
}
}

Some files were not shown because too many files have changed in this diff Show More