48static std::vector<BOARD_ITEM*>
initTextTable( std::vector<std::vector<PCB_TEXT*>> aContent,
50 VECTOR2I* aTableSize,
bool aDrawFrame =
true )
55 int nbCols = aContent.size();
58 for(
const std::vector<PCB_TEXT*>& col : aContent )
59 nbRows = std::max( nbRows,
static_cast<int>( col.size() ) );
62 nbCols = std::min( nbCols, 99 );
63 nbRows = std::min( nbRows, 99 );
68 std::vector<BOARD_ITEM*> table;
87 for( i = 0; i < nbRows; i++ )
90 for( i = 0; i < nbCols; i++ )
96 for(
const std::vector<PCB_TEXT*>& col : aContent )
108 int height = cell->GetBoundingBox().GetHeight() + 2 * ymargin;
109 int width = cell->GetBoundingBox().GetWidth() + 2 * xmargin;
110 rowHeight[j] = rowHeight[j] > height ? rowHeight[j] : height;
111 colWidth[i] = colWidth[i] > width ? colWidth[i] : width;
119 int height = std::accumulate( rowHeight, rowHeight + nbRows, 0 );
120 int width = std::accumulate( colWidth, colWidth + nbCols, 0 );
122 aTableSize->
x = width;
123 aTableSize->
y = height;
131 for( i = 0; i < nbRows; i++ )
138 table.push_back( line );
145 table.push_back( line );
148 for( i = 0; i < nbCols; i++ )
155 table.push_back( line );
162 table.push_back( line );
167 VECTOR2I pos( origin.
x + xmargin, origin.
y + ymargin );
169 for( std::vector<PCB_TEXT*>& col : aContent )
176 pos.
y = origin.
y + ymargin;
183 cell->SetTextPos( pos );
184 cell->SetLayer( aLayer );
185 pos.
y = pos.
y + rowHeight[j];
186 table.push_back( cell );
190 pos.
x = pos.
x + colWidth[i];
206 std::vector<std::vector<PCB_TEXT*>> texts;
209 std::unique_ptr<PCB_TEXT> headStyle = std::make_unique<PCB_TEXT>(
footprint );
213 headStyle->SetItalic(
false );
214 headStyle->SetTextPos(
VECTOR2I( 0, 0 ) );
215 headStyle->SetText(
_(
"Layer" ) );
220 std::unique_ptr<PCB_TEXT> dataStyle = std::make_unique<PCB_TEXT>(
footprint );
224 dataStyle->SetItalic(
false );
225 dataStyle->SetTextPos(
VECTOR2I( 0, 0 ) );
226 dataStyle->SetText(
_(
"Layer" ) );
235 std::vector<BOARD_STACKUP_ITEM*> layers = stackup.
GetList();
237 std::vector<PCB_TEXT*> colLayer;
238 std::vector<PCB_TEXT*> colType;
239 std::vector<PCB_TEXT*> colMaterial;
240 std::vector<PCB_TEXT*> colThickness;
241 std::vector<PCB_TEXT*> colColor;
242 std::vector<PCB_TEXT*> colEpsilon;
243 std::vector<PCB_TEXT*> colTanD;
246 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
248 colLayer.push_back( t );
250 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
252 colType.push_back( t );
254 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
256 colMaterial.push_back( t );
258 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
262 case EDA_UNITS::MILLIMETRES: t->
SetText(
_(
"Thickness (mm)" ) );
break;
263 case EDA_UNITS::INCHES: t->
SetText(
_(
"Thickness (inches)" ) );
break;
264 case EDA_UNITS::MILS: t->
SetText(
_(
"Thickness (mils)" ) );
break;
265 default: wxFAIL_MSG( wxT(
"Unhandled unit type" ) );
268 colThickness.push_back( t );
270 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
272 colColor.push_back( t );
274 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
276 colEpsilon.push_back( t );
278 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
280 colTanD.push_back( t );
282 for(
int i = 0; i < stackup.
GetCount(); i++ )
286 for(
int sublayer_id = 0; sublayer_id < stackup_item->
GetSublayersCount(); sublayer_id++ )
288 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
302 ly_name =
_(
"Dielectric" );
311 colLayer.push_back( t );
313 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
315 colType.push_back( t );
317 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
319 colMaterial.push_back( t );
321 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
323 colThickness.push_back( t );
325 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
327 colColor.push_back( t );
329 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
331 stackup_item->
GetEpsilonR( sublayer_id ), false ) );
332 colEpsilon.push_back( t );
334 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
337 colTanD.push_back( t );
341 texts.push_back( colLayer );
342 texts.push_back( colType );
343 texts.push_back( colMaterial );
344 texts.push_back( colThickness );
345 texts.push_back( colColor );
346 texts.push_back( colEpsilon );
347 texts.push_back( colTanD );
348 std::vector<BOARD_ITEM*> table =
initTextTable( texts, aOrigin, aLayer, tableSize,
true );
355 commit.
Push(
_(
"Insert Board Stackup Table" ) );
368 std::vector<BOARD_ITEM*> objects;
375 std::unique_ptr<PCB_TEXT> headStyle =
380 headStyle->SetItalic(
false );
381 headStyle->SetTextPos(
VECTOR2I( 0, 0 ) );
386 std::unique_ptr<PCB_TEXT> dataStyle =
391 dataStyle->SetItalic(
false );
392 dataStyle->SetTextPos(
VECTOR2I( 0, 0 ) );
398 t =
static_cast<PCB_TEXT*
>( headStyle->Duplicate() );
399 t->
SetText(
_(
"BOARD CHARACTERISTICS" ) );
401 objects.push_back( t );
406 std::vector<std::vector<PCB_TEXT*>> texts;
407 std::vector<PCB_TEXT*> colLabel1;
408 std::vector<PCB_TEXT*> colData1;
409 std::vector<PCB_TEXT*> colbreak;
410 std::vector<PCB_TEXT*> colLabel2;
411 std::vector<PCB_TEXT*> colData2;
413 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
414 t->
SetText(
_(
"Copper Layer Count: " ) );
415 colLabel1.push_back( t );
417 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
420 colData1.push_back( t );
425 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
426 t->
SetText(
_(
"Board overall dimensions: " ) );
427 colLabel1.push_back( t );
429 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
430 t->
SetText( wxString::Format( wxT(
"%s x %s" ),
433 colData1.push_back( t );
435 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
436 t->
SetText(
_(
"Min track/spacing: " ) );
437 colLabel1.push_back( t );
439 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
440 t->
SetText( wxString::Format( wxT(
"%s / %s" ),
443 colData1.push_back( t );
445 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
446 t->
SetText(
_(
"Copper Finish: " ) );
447 colLabel1.push_back( t );
449 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
451 colData1.push_back( t );
453 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
454 t->
SetText(
_(
"Castellated pads: " ) );
455 colLabel1.push_back( t );
457 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
459 colData1.push_back( t );
461 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
462 t->
SetText(
_(
"Board Thickness: " ) );
463 colLabel2.push_back( t );
465 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
467 colData2.push_back( t );
470 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
471 colLabel2.push_back( t );
472 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
473 colData2.push_back( t );
475 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
476 t->
SetText(
_(
"Min hole diameter: " ) );
477 colLabel2.push_back( t );
478 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
482 colData2.push_back( t );
484 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
485 t->
SetText(
_(
"Impedance Control: " ) );
486 colLabel2.push_back( t );
488 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
490 colData2.push_back( t );
492 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
493 t->
SetText(
_(
"Plated Board Edge: " ) );
494 colLabel2.push_back( t );
496 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
498 colData2.push_back( t );
500 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
501 t->
SetText(
_(
"Edge card connectors: " ) );
502 colLabel1.push_back( t );
504 t =
static_cast<PCB_TEXT*
>( dataStyle->Duplicate() );
511 colData1.push_back( t );
513 texts.push_back( colLabel1 );
514 texts.push_back( colData1 );
515 texts.push_back( colbreak );
516 texts.push_back( colLabel2 );
517 texts.push_back( colData2 );
524 objects.push_back( item );
531 commit.
Push(
_(
"Board Characteristics" ) );
534 tableSize->
x = tableSize2.
x;
535 tableSize->
y = cursorPos.
y + tableSize2.
y
543 std::vector<BOARD_ITEM*>& aItems,
544 std::vector<BOARD_ITEM*>& aPreview,
550 bool cancelled =
false;
577 item->Move( cursorPosition - previousCursorPosition );
586 if( evt->IsCancelInteractive() )
592 else if( evt->IsMotion() )
597 item->Move( cursorPosition - previousCursorPosition );
601 previousCursorPosition = cursorPosition;
603 else if( evt->IsActivate() )
605 if( evt->IsMoveTool() )
624 if( aLayers !=
nullptr )
627 frame()->SelectOneLayer( PCB_LAYER_ID::PCB_LAYER_ID_COUNT, *aLayers,
632 if( destLayer == PCB_LAYER_ID::UNDEFINED_LAYER )
642 item->SetLayer( destLayer );
644 item->RunOnDescendants(
654 item->Move( cursorPosition );
657 item->RunOnDescendants(
660 commit.
Add( descendant );
664 commit.
Push(
_(
"Place Items" ) );
701 if( ( layerSet &
LSET( { layer } ) ).count() )
706 std::vector<BOARD_ITEM*> preview;
707 std::vector<BOARD_ITEM*> items;
721 line3->
SetEnd( tableSize );
724 line4->
SetEnd( tableSize );
731 preview.push_back( line1 );
732 preview.push_back( line2 );
733 preview.push_back( line3 );
734 preview.push_back( line4 );
737 group->SetName(
"group-boardCharacteristics");
739 for(
auto item : table )
764 if( ( layerSet &
LSET( { layer } ) ).count() )
773 std::vector<BOARD_ITEM*> preview;
774 std::vector<BOARD_ITEM*> items;
788 line3->
SetEnd( tableSize );
791 line4->
SetEnd( tableSize );
798 preview.push_back( line1 );
799 preview.push_back( line2 );
800 preview.push_back( line3 );
801 preview.push_back( line4 );
804 group->SetName(
"group-boardStackUp" );
807 group->AddItem( item );
constexpr EDA_IU_SCALE pcbIUScale
constexpr EDA_IU_SCALE unityScale
@ BS_EDGE_CONNECTOR_BEVELLED
@ BS_EDGE_CONNECTOR_IN_USE
@ BS_ITEM_TYPE_DIELECTRIC
BASE_SET & reset(size_t pos)
BASE_SET & set(size_t pos)
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
Container for design settings for a BOARD object.
int GetBoardThickness() const
The full thickness of the board including copper and masks.
BOARD_STACKUP & GetStackupDescriptor()
int GetCopperLayerCount() const
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Manage one layer needed to make a physical board.
wxString GetTypeName() const
int GetSublayersCount() const
double GetEpsilonR(int aDielectricSubLayer=0) const
wxString GetColor(int aDielectricSubLayer=0) const
wxString GetLayerName() const
PCB_LAYER_ID GetBrdLayerId() const
int GetThickness(int aDielectricSubLayer=0) const
BOARD_STACKUP_ITEM_TYPE GetType() const
wxString GetMaterial(int aDielectricSubLayer=0) const
double GetLossTangent(int aDielectricSubLayer=0) const
Manage layers needed to make a physical board.
bool m_CastellatedPads
True if castellated pads exist.
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
bool SynchronizeWithBoard(BOARD_DESIGN_SETTINGS *aSettings)
Synchronize the BOARD_STACKUP_ITEM* list with the board.
bool m_HasDielectricConstrains
True if some layers have impedance controlled tracks or have specific constrains for micro-wave appli...
bool m_EdgePlating
True if the edge board is plated.
BS_EDGE_CONNECTOR_CONSTRAINTS m_EdgeConnectorConstraints
If the board has edge connector cards, some constrains can be specified in job file: BS_EDGE_CONNECTO...
wxString m_FinishType
The name of external copper finish.
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr, bool aAllowUseArcsInPolygons=false, bool aIncludeNPTHAsOutlines=false)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
constexpr size_type GetWidth() const
constexpr size_type GetHeight() const
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
void SetStart(const VECTOR2I &aStart)
void SetEnd(const VECTOR2I &aEnd)
virtual void SetText(const wxString &aText)
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
void ShowPreview(bool aShow=true)
void AddToPreview(VIEW_ITEM *aItem, bool aTakeOwnership=true)
LSET is a set of PCB_LAYER_IDs.
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static TOOL_ACTION selectionClear
Clear the current selection.
virtual PCB_LAYER_ID GetActiveLayer() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
virtual BOARD_ITEM_CONTAINER * GetModel() const =0
virtual void SetActiveLayer(PCB_LAYER_ID aLayer)
A set of BOARD_ITEMs (i.e., without duplicates).
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
virtual void SetPosition(const VECTOR2I &aPos) override
RAII class that sets an value at construction and resets it to the original value at destruction.
Represent a set of closed polygons.
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
EDA_UNITS GetUserUnits() const
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aValue in internal units into a united string.
PCB_LAYER_ID
A quick note on layer IDs:
bool IsValidLayer(int aLayerId)
Test whether a given integer is a valid layer index, i.e.
KICOMMON_API double FromUserUnit(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnit, double aValue)
Return in internal units the value aValue given in a real unit such as "in", "mm",...
KICOMMON_API wxString StringFromValue(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Returns the string from aValue according to aUnits (inch, mm ...) for display.
Class to handle a set of BOARD_ITEMs.
constexpr int mmToIU(double mm) const
VECTOR2< int32_t > VECTOR2I