KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_api_proto.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2024 Jon Evans <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#include <boost/test/unit_test.hpp>
22#include <memory>
23#include <limits>
24#include <import_export.h>
29
30#include <api/board/board_types.pb.h>
31#include <api/common/types/embedded_files.pb.h>
32
33#include <board.h>
34#include <embedded_files.h>
35#include <footprint.h>
36#include <pcb_barcode.h>
37#include <pcb_3d_body.h>
38#include <pcb_dimension.h>
39#include <pcb_drill_chart.h>
40#include <pcb_drill_map.h>
41#include <pcb_grid_item.h>
42#include <pad.h>
43#include <pcb_reference_image.h>
44#include <pcb_shape.h>
45#include <pcb_table.h>
46#include <pcb_text.h>
47#include <pcb_textbox.h>
48#include <pcb_track.h>
49#include <zone.h>
50
51
52BOOST_AUTO_TEST_SUITE( ApiProto )
53
62
63
65{
66 KI_TEST::LoadBoard( m_settingsManager, "api_kitchen_sink", m_board );
67
68 int barcodeCount = 0;
69 int drillChartCount = 0;
70 int drillMapCount = 0;
71 int referenceImageCount = 0;
72 int tableCount = 0;
73 int textCount = 0;
74 int textBoxCount = 0;
75 int shapeCount = 0;
76
77 for( PCB_TRACK* track : m_board->Tracks() )
78 {
79 switch( track->Type() )
80 {
81 case PCB_TRACE_T:
83 break;
84
85 case PCB_ARC_T:
87 m_board.get() );
88 break;
89
90 case PCB_VIA_T:
92 m_board.get() );
93 break;
94
95 default:
96 wxFAIL;
97 }
98 }
99
100 for( FOOTPRINT* footprint : m_board->Footprints() )
102
103 for( ZONE* zone : m_board->Zones() )
105
106 for( BOARD_ITEM* item : m_board->Drawings() )
107 {
108 switch( item->Type() )
109 {
112 static_cast<PCB_DIM_ALIGNED*>( item ), m_board.get() );
113 break;
114
117 static_cast<PCB_DIM_ORTHOGONAL*>( item ), m_board.get() );
118 break;
119
120 case PCB_DIM_CENTER_T:
122 static_cast<PCB_DIM_CENTER*>( item ), m_board.get() );
123 break;
124
125 case PCB_DIM_LEADER_T:
127 static_cast<PCB_DIM_LEADER*>( item ), m_board.get() );
128 break;
129
130 case PCB_DIM_RADIAL_T:
132 static_cast<PCB_DIM_RADIAL*>( item ), m_board.get() );
133 break;
134
135 case PCB_BARCODE_T:
137 static_cast<PCB_BARCODE*>( item ), m_board.get() );
138 ++barcodeCount;
139 break;
140
143 static_cast<PCB_REFERENCE_IMAGE*>( item ), m_board.get() );
144 ++referenceImageCount;
145 break;
146
149 static_cast<PCB_DRILL_CHART*>( item ), m_board.get() );
150 ++drillChartCount;
151 break;
152
153 case PCB_DRILL_MAP_T:
155 static_cast<PCB_DRILL_MAP*>( item ), m_board.get() );
156 ++drillMapCount;
157 break;
158
159 case PCB_TABLE_T:
160 testProtoFromKiCadObject<kiapi::board::types::Table>( static_cast<PCB_TABLE*>( item ), m_board.get() );
161 ++tableCount;
162 break;
163
164 case PCB_TEXT_T:
166 static_cast<PCB_TEXT*>( item ), m_board.get() );
167 ++textCount;
168 break;
169
170 case PCB_TEXTBOX_T:
172 static_cast<PCB_TEXTBOX*>( item ), m_board.get() );
173 ++textBoxCount;
174 break;
175
176 case PCB_SHAPE_T:
178 static_cast<PCB_SHAPE*>( item ), m_board.get() );
179 ++shapeCount;
180 break;
181
182 default: break;
183 }
184 }
185
186 BOOST_CHECK_GT( barcodeCount, 0 );
187 BOOST_CHECK_GT( drillChartCount, 0 );
188 BOOST_CHECK_GT( drillMapCount, 0 );
189 BOOST_CHECK_GT( referenceImageCount, 0 );
190 BOOST_CHECK_GT( tableCount, 0 );
191 BOOST_CHECK_GT( textCount, 0 );
192 BOOST_CHECK_GT( textBoxCount, 0 );
193 BOOST_CHECK_GT( shapeCount, 0 );
194}
195
196
197BOOST_AUTO_TEST_CASE( FootprintExcludeFromSimulationRoundTrip )
198{
199 BOARD board;
200 FOOTPRINT footprint( &board );
201
202 footprint.SetExcludedFromSim( true );
203
205}
206
207
208BOOST_AUTO_TEST_CASE( FootprintNetTieEscapedPadRoundTrip )
209{
210 BOARD board;
211 FOOTPRINT footprint( &board );
212
213 // The file format escapes a comma inside a pad number with a backslash
214 footprint.AddNetTiePadGroup( wxS( "A\\,B, C" ) );
215
216 kiapi::board::types::Footprint proto;
217 footprint.SerializeDefinition( &proto );
218
219 BOOST_REQUIRE_EQUAL( proto.net_ties_size(), 1 );
220 BOOST_REQUIRE_EQUAL( proto.net_ties( 0 ).pad_number_size(), 2 );
221 BOOST_CHECK_EQUAL( proto.net_ties( 0 ).pad_number( 0 ), "A,B" );
222 BOOST_CHECK_EQUAL( proto.net_ties( 0 ).pad_number( 1 ), "C" );
223
224 FOOTPRINT restored( &board );
225 BOOST_REQUIRE( restored.DeserializeDefinition( proto ) );
226
227 std::map<wxString, int> groups = restored.MapPadNumbersToNetTieGroups();
228
229 BOOST_CHECK( groups.contains( wxS( "A,B" ) ) && groups[wxS( "A,B" )] == 0 );
230 BOOST_CHECK( groups.contains( wxS( "C" ) ) && groups[wxS( "C" )] == 0 );
231}
232
233
235{
236 KI_TEST::LoadBoard( m_settingsManager, "api_kitchen_sink", m_board );
237
238 PCB_DRILL_CHART* chart = nullptr;
239
240 for( BOARD_ITEM* item : m_board->Drawings() )
241 {
242 if( item->Type() == PCB_DRILL_CHART_T )
243 {
244 chart = static_cast<PCB_DRILL_CHART*>( item );
245 break;
246 }
247 }
248
249 BOOST_REQUIRE( chart );
250
251 google::protobuf::Any any;
252 chart->Serialize( any );
253 kiapi::board::types::DrillChart proto;
254 BOOST_REQUIRE( any.UnpackTo( &proto ) );
255 BOOST_REQUIRE_GT( proto.columns_size(), 0 );
256 BOOST_CHECK_EQUAL( proto.columns( 0 ).width().value_nm(), 16000000 );
257
258 for( int64_t width : { int64_t( 0 ), int64_t( GENERATED_TABLE_MAX_COLUMN_WIDTH ) } )
259 {
260 proto.mutable_columns( 0 )->mutable_width()->set_value_nm( width );
261 (void) any.PackFrom( proto );
262 PCB_DRILL_CHART restored( m_board.get() );
263 BOOST_REQUIRE( restored.Deserialize( any ) );
264 BOOST_CHECK_EQUAL( restored.Columns().front().m_Width, width );
265 }
266
267 for( int64_t width : { int64_t( -1 ), int64_t( GENERATED_TABLE_MAX_COLUMN_WIDTH ) + 1,
268 std::numeric_limits<int64_t>::max() } )
269 {
270 proto.mutable_columns( 0 )->mutable_width()->set_value_nm( width );
271 (void) any.PackFrom( proto );
272 PCB_DRILL_CHART restored( m_board.get() );
273 BOOST_REQUIRE( restored.Deserialize( any ) );
274 BOOST_CHECK_EQUAL( restored.Columns().front().m_Width,
275 width < 0 ? 0 : GENERATED_TABLE_MAX_COLUMN_WIDTH );
276 }
277}
278
279
281{
282 KI_TEST::LoadBoard( m_settingsManager, "padstacks", m_board );
283
284 for( PCB_TRACK* track : m_board->Tracks() )
285 {
286 switch( track->Type() )
287 {
288 case PCB_VIA_T:
289 testProtoFromKiCadObject<kiapi::board::types::Via>( static_cast<PCB_VIA*>( track ), m_board.get() );
290 break;
291
292 default:
293 wxFAIL;
294 }
295 }
296
297 for( FOOTPRINT* footprint : m_board->Footprints() )
299}
300
301
303{
304 KI_TEST::LoadBoard( m_settingsManager, "api_kitchen_sink", m_board );
305
306 for( const FOOTPRINT* fp : m_board->Footprints() )
307 {
308 if( fp->EmbeddedFileMap().empty() )
309 continue;
310
311 BOOST_TEST_CONTEXT( wxString::Format( wxS( "Footprint %s embedded files" ), fp->m_Uuid.AsStdString() ) )
312 {
313 google::protobuf::Any any;
314 fp->Serialize( any );
315
316 kiapi::board::types::FootprintInstance proto;
317 BOOST_CHECK( any.UnpackTo( &proto ) );
318
319 BOOST_CHECK_GT( proto.embedded_files().files_size(), 0 );
320
321 const kiapi::common::types::EmbeddedFile& file = proto.embedded_files().files( 0 );
322 BOOST_CHECK( !file.data().empty() );
323
324 std::unique_ptr<FOOTPRINT> roundTripped = std::make_unique<FOOTPRINT>( m_board.get() );
325 BOOST_CHECK( roundTripped->Deserialize( any ) );
326
327 for( const auto& [name, expected] : fp->EmbeddedFileMap() )
328 {
329 const EMBEDDED_FILES::EMBEDDED_FILE* actual = roundTripped->GetEmbeddedFile( name );
330 BOOST_CHECK_MESSAGE( actual, wxString::Format( wxS( "Embedded file '%s' missing after round-trip" ), name ).c_str() );
331 BOOST_CHECK_EQUAL( magic_enum::enum_name( expected->type ), magic_enum::enum_name( actual->type ) );
332 BOOST_CHECK_EQUAL( expected->data_hash, actual->data_hash );
333 BOOST_CHECK_EQUAL( expected->compressedEncodedData, actual->compressedEncodedData );
334 }
335 }
336 }
337}
338
339
346BOOST_FIXTURE_TEST_CASE( CopperThievingZoneRoundTrip, PROTO_TEST_FIXTURE )
347{
348 m_board = std::make_unique<BOARD>();
349
350 ZONE* zone = new ZONE( m_board.get() );
351 zone->SetLayer( F_Cu );
352 zone->AppendCorner( VECTOR2I( 0, 0 ), -1 );
353 zone->AppendCorner( VECTOR2I( pcbIUScale.mmToIU( 5 ), 0 ), -1 );
354 zone->AppendCorner( VECTOR2I( pcbIUScale.mmToIU( 5 ), pcbIUScale.mmToIU( 5 ) ), -1 );
355 zone->AppendCorner( VECTOR2I( 0, pcbIUScale.mmToIU( 5 ) ), -1 );
357
358 THIEVING_SETTINGS thieving;
360 thieving.element_size = pcbIUScale.mmToIU( 0.75 );
361 thieving.gap = pcbIUScale.mmToIU( 2.0 );
362 thieving.line_width = pcbIUScale.mmToIU( 0.4 );
363 thieving.stagger = true;
364 thieving.orientation = EDA_ANGLE( 15.0, DEGREES_T );
365 zone->SetThievingSettings( thieving );
366
367 m_board->Add( zone );
368
369 google::protobuf::Any any;
370 BOOST_REQUIRE_NO_THROW( zone->Serialize( any ) );
371
372 kiapi::board::types::Zone proto;
373 BOOST_REQUIRE( any.UnpackTo( &proto ) );
374 BOOST_REQUIRE( proto.has_copper_settings() );
375 BOOST_REQUIRE( proto.copper_settings().has_thieving_settings() );
376
377 std::unique_ptr<ZONE> roundTripped = std::make_unique<ZONE>( m_board.get() );
378 BOOST_REQUIRE( roundTripped->Deserialize( any ) );
379
380 BOOST_CHECK( roundTripped->GetFillMode() == ZONE_FILL_MODE::COPPER_THIEVING );
381 // A board with no netinfo list returns GetNetCode() == -1 for an unbound zone.
382 // The invariant we want is "no real net assigned"; netcode > 0 would mean a leak.
383 BOOST_CHECK_LE( roundTripped->GetNetCode(), 0 );
384
385 const THIEVING_SETTINGS& loaded = roundTripped->GetThievingSettings();
387 BOOST_CHECK_EQUAL( loaded.element_size, thieving.element_size );
388 BOOST_CHECK_EQUAL( loaded.gap, thieving.gap );
389 BOOST_CHECK_EQUAL( loaded.line_width, thieving.line_width );
390 BOOST_CHECK_EQUAL( loaded.stagger, true );
391 BOOST_CHECK( loaded.orientation.GetAngle() == EDA_ANGLE( 15.0, DEGREES_T ) );
392}
393
394
396{
397 const auto makeGridItem =
398 []()
399 {
400 return std::make_unique<PCB_GRID_ITEM>( nullptr );
401 };
402
403 PCB_GRID_ITEM cartesian( nullptr );
405 cartesian.SetPosition( VECTOR2I( 1000000, -2000000 ) );
406 cartesian.SetOrientationDegrees( 30.0 );
407 cartesian.SetExtent( VECTOR2I( 5000000, 4000000 ) );
408 cartesian.SetSpacing( VECTOR2I( 250000, 500000 ) );
409 cartesian.SetAssignedPriority( 3 );
410 cartesian.SetTickInterval( 5 );
411 cartesian.SetAffectsRouting( false );
412 cartesian.SetLocked( true );
413
415
416 PCB_GRID_ITEM polar( nullptr );
418 polar.SetPosition( VECTOR2I( -750000, 125000 ) );
419 polar.SetRadiusExtent( 8000000 );
420 polar.SetRadiusSpacing( 1000000 );
421 polar.SetPhiExtentDegrees( 270.0 );
422 polar.SetPhiSpacingDegrees( 7.5 );
423 polar.SetAssignedPriority( 1 );
424 polar.SetAffectsCursor( false );
425 polar.SetAffectsPlacement( false );
426
428
429 // The polar half of the grid must survive, not just the shared linear fields.
430 google::protobuf::Any any;
431 polar.Serialize( any );
432
433 std::unique_ptr<PCB_GRID_ITEM> roundTripped = makeGridItem();
434 BOOST_REQUIRE( roundTripped->Deserialize( any ) );
435
436 BOOST_CHECK( roundTripped->GetGridItemType() == PCB_GRID_TYPE::POLAR );
437 BOOST_CHECK_EQUAL( roundTripped->GetRadiusExtent(), 8000000 );
438 BOOST_CHECK_EQUAL( roundTripped->GetRadiusSpacing(), 1000000 );
439 BOOST_CHECK( roundTripped->GetPhiExtent() == EDA_ANGLE( 270.0, DEGREES_T ) );
440 BOOST_CHECK( roundTripped->GetPhiSpacing() == EDA_ANGLE( 7.5, DEGREES_T ) );
441 BOOST_CHECK_EQUAL( roundTripped->GetAffectsCursor(), false );
442 BOOST_CHECK_EQUAL( roundTripped->GetAffectsRouting(), true );
443 BOOST_CHECK_EQUAL( roundTripped->GetAffectsPlacement(), false );
444 BOOST_CHECK_EQUAL( roundTripped->IsLocked(), false );
445}
446
447
449{
450 const auto makeBody =
451 []()
452 {
453 return std::make_unique<PCB_3D_BODY>();
454 };
455
456 // Populated body, including both layer sentinels
457 PCB_3D_BODY populated;
458 EXTRUDED_3D_BODY& extruded = *populated.MutableExtruded();
459 extruded.m_height = pcbIUScale.mmToIU( 2.5 );
460 extruded.m_standoff = pcbIUScale.mmToIU( 0.1 );
461 extruded.m_layer = F_CrtYd;
463 extruded.m_color = KIGFX::COLOR4D( 0.8, 0.4, 0.0, 0.9 );
464 extruded.m_offset = VECTOR3D( 1.0, -0.5, 0.2 );
465 extruded.m_scale = VECTOR3D( 1.5, 0.8, 2.0 );
466 extruded.m_rotation = VECTOR3D( 10.0, 20.0, 45.0 );
467 extruded.m_show = false;
468
470
471 PCB_3D_BODY autoLayer;
473
475
476 PCB_3D_BODY padBBox;
478
480
481 // No color set: the optional must stay absent across the round trip
482 google::protobuf::Any any;
483 autoLayer.Serialize( any );
484
485 kiapi::board::types::Body3D msg;
486 BOOST_REQUIRE( any.UnpackTo( &msg ) );
487 BOOST_CHECK( !msg.extruded().has_color() );
488
489 // A model-kind body is reserved and must be rejected on deserialize
490 msg.set_kind( kiapi::board::types::BDK_MODEL );
491 BOOST_REQUIRE( any.PackFrom( msg ) );
492
493 std::unique_ptr<PCB_3D_BODY> modelBody = makeBody();
494 BOOST_CHECK( !modelBody->Deserialize( any ) );
495
496 // A body whose parent names a different footprint is still imported as a child
497 BOARD board;
498 FOOTPRINT target( &board );
499
500 kiapi::board::types::Footprint definition;
501
502 msg.Clear();
503 msg.set_kind( kiapi::board::types::BDK_EXTRUDED );
504 msg.mutable_id()->set_value( KIID().AsStdString() );
505 msg.mutable_parent()->set_value( "00000000-0000-0000-0000-000000000001" );
506 msg.mutable_extruded()->mutable_height()->set_value_nm( pcbIUScale.mmToIU( 2 ) );
507 BOOST_REQUIRE( any.PackFrom( msg ) );
508 *definition.add_items() = any;
509
510 BOOST_CHECK( target.DeserializeDefinition( definition ) );
511 BOOST_CHECK( target.HasBody() );
512 BOOST_CHECK_EQUAL( target.GetBody()->GetParentFootprint(), &target );
513
514}
515
516BOOST_AUTO_TEST_CASE( PadCustomShapeProxyItems )
517{
518 BOARD board;
519 FOOTPRINT footprint( &board );
520 PAD pad( &footprint );
521
522 auto numberBox = std::make_shared<PCB_SHAPE>( &pad, SHAPE_T::RECTANGLE );
523 numberBox->SetIsProxyItem();
524
525 auto spokeTemplate = std::make_shared<PCB_SHAPE>( &pad, SHAPE_T::SEGMENT );
526 spokeTemplate->SetIsProxyItem();
527
528 auto plainShape = std::make_shared<PCB_SHAPE>( &pad, SHAPE_T::SEGMENT );
529
530 google::protobuf::Any numberBoxAny;
531 numberBox->Serialize( numberBoxAny );
532
533 kiapi::board::types::BoardGraphicShape numberBoxProto;
534 BOOST_REQUIRE( numberBoxAny.UnpackTo( &numberBoxProto ) );
535 BOOST_REQUIRE( numberBoxProto.has_pad_custom_shape_options() );
536 BOOST_CHECK( numberBoxProto.pad_custom_shape_options().is_number_box() );
537
538 google::protobuf::Any spokeAny;
539 spokeTemplate->Serialize( spokeAny );
540
541 kiapi::board::types::BoardGraphicShape spokeProto;
542 BOOST_REQUIRE( spokeAny.UnpackTo( &spokeProto ) );
543 BOOST_REQUIRE( spokeProto.has_pad_custom_shape_options() );
544 BOOST_CHECK( spokeProto.pad_custom_shape_options().is_thermal_spoke_template() );
545
546 google::protobuf::Any plainAny;
547 plainShape->Serialize( plainAny );
548
549 kiapi::board::types::BoardGraphicShape plainProto;
550 BOOST_REQUIRE( plainAny.UnpackTo( &plainProto ) );
551 BOOST_CHECK( !plainProto.has_pad_custom_shape_options() );
552
553 // A role arriving on a mismatched shape type is ignored
554 google::protobuf::Any mismatchedAny;
555 spokeTemplate->Serialize( mismatchedAny );
556
557 kiapi::board::types::BoardGraphicShape mismatchedProto;
558 BOOST_REQUIRE( mismatchedAny.UnpackTo( &mismatchedProto ) );
559 mismatchedProto.clear_shape();
560 mismatchedProto.mutable_shape()->mutable_rectangle()->mutable_top_left()->set_x_nm( 0 );
561 mismatchedProto.mutable_shape()->mutable_rectangle()->mutable_top_left()->set_y_nm( 0 );
562 mismatchedProto.mutable_shape()->mutable_rectangle()->mutable_bottom_right()->set_x_nm( 1 );
563 mismatchedProto.mutable_shape()->mutable_rectangle()->mutable_bottom_right()->set_y_nm( 1 );
564 BOOST_REQUIRE( mismatchedAny.PackFrom( mismatchedProto ) );
565
566 PCB_SHAPE mismatched( &pad, SHAPE_T::RECTANGLE );
567 BOOST_REQUIRE( mismatched.Deserialize( mismatchedAny ) );
568 BOOST_CHECK( !mismatched.IsProxyItem() );
569}
570
571
const char * name
void testProtoFromKiCadObject(KiCadClass *aInput, Factory &&aCreateOutput)
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:128
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:99
void SetLocked(bool aLocked) override
Definition board_item.h:441
FOOTPRINT * GetParentFootprint() const
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:411
EDA_ANGLE GetAngle() const
Definition eda_angle.h:557
KIGFX::COLOR4D m_color
Definition pcb_3d_body.h:46
VECTOR3D m_offset
Definition pcb_3d_body.h:52
PCB_LAYER_ID m_layer
Definition pcb_3d_body.h:45
VECTOR3D m_rotation
Definition pcb_3d_body.h:51
EXTRUSION_MATERIAL m_material
Definition pcb_3d_body.h:47
void SerializeDefinition(kiapi::board::types::Footprint *aOutput) const
void SetExcludedFromSim(bool aExclude=true)
Definition footprint.h:939
std::map< wxString, int > MapPadNumbersToNetTieGroups() const
const PCB_3D_BODY * GetBody() const
Definition footprint.h:427
bool DeserializeDefinition(const kiapi::board::types::Footprint &aInput)
void AddNetTiePadGroup(const wxString &aGroup)
Definition footprint.h:574
bool HasBody() const
Convenience accessors for now while we restrict to only one body per footprint.
Definition footprint.h:426
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
Definition kiid.h:46
Definition pad.h:61
A 3D body attached to a footprint (or, later, placed on a board).
Definition pcb_3d_body.h:93
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
EXTRUDED_3D_BODY * MutableExtruded()
For better understanding of the points that make a dimension:
Mark the center of a circle or arc with a cross shape.
A leader is a dimension-like object pointing to a specific point.
An orthogonal dimension is like an aligned dimension, but the extension lines are locked to the X or ...
A radial dimension indicates either the radius or diameter of an arc or circle.
A drill chart placed on the board, kept in step with the holes.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Turns on drill symbols at the holes, for one layer.
std::vector< GENERATED_TABLE_COLUMN > & Columns()
The columns the table shows, which are the columns of its cells.
void SetRadiusExtent(int aR)
void SetAffectsRouting(bool aOn)
void SetPosition(const VECTOR2I &aPos) override
void SetRadiusSpacing(int aR)
void SetGridItemType(PCB_GRID_TYPE aType)
void SetExtent(const VECTOR2I &aExtent)
void SetTickInterval(unsigned aInterval)
void SetOrientationDegrees(double aDeg)
void SetSpacing(const VECTOR2I &aSpacing)
void SetPhiExtentDegrees(double aDeg)
void SetAffectsPlacement(bool aOn)
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
void SetPhiSpacingDegrees(double aDeg)
void SetAssignedPriority(unsigned aPriority)
Priority 0 is reserved for the global background grid; user-assigned 0 is bumped to 1.
void SetAffectsCursor(bool aOn)
Object to handle a bitmap image that can be inserted in a PCB.
bool IsProxyItem() const override
Definition pcb_shape.h:155
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Handle a list of polygons defining a copper zone.
Definition zone.h:70
bool AppendCorner(const VECTOR2I &aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
Definition zone.cpp:1519
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition zone.cpp:677
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition zone.cpp:282
void SetFillMode(ZONE_FILL_MODE aFillMode)
Definition zone.cpp:683
void SetThievingSettings(const THIEVING_SETTINGS &aSettings)
Definition zone.h:352
A type-safe container of any type.
Definition ki_any.h:92
@ DEGREES_T
Definition eda_angle.h:30
@ SEGMENT
Definition eda_shape.h:57
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
Definition eda_shape.h:58
constexpr int GENERATED_TABLE_MAX_COLUMN_WIDTH
A column can be no wider than this.
@ F_CrtYd
Definition layer_ids.h:112
@ UNSELECTED_LAYER
Definition layer_ids.h:58
@ UNDEFINED_LAYER
Definition layer_ids.h:57
@ F_Cu
Definition layer_ids.h:60
void LoadBoard(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< BOARD > &aBoard)
BARCODE class definition.
std::unique_ptr< BOARD > m_board
SETTINGS_MANAGER m_settingsManager
Parameters that drive copper-thieving fill generation.
THIEVING_PATTERN pattern
EDA_ORIENTATION orientation
BOOST_FIXTURE_TEST_CASE(BoardTypes, PROTO_TEST_FIXTURE)
BOOST_AUTO_TEST_CASE(FootprintExcludeFromSimulationRoundTrip)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_CHECK(res.column_datatype(0)==SQL_NUMERIC||res.column_datatype(0)==SQL_DECIMAL)
BOOST_REQUIRE_EQUAL(rows.size(), 1)
BOOST_CHECK_EQUAL(std::any_cast< std::string >(rows[0].at("val")), "12345678901234567.89")
BOOST_REQUIRE(res.columns()==1)
BOOST_AUTO_TEST_SUITE_END()
VECTOR3I expected(15, 30, 45)
BOOST_TEST_CONTEXT("Test Clearance")
int actual
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition typeinfo.h:80
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition typeinfo.h:98
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition typeinfo.h:95
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition typeinfo.h:89
@ PCB_DRILL_MAP_T
class PCB_DRILL_MAP, drill symbols drawn at the holes
Definition typeinfo.h:240
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition typeinfo.h:96
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition typeinfo.h:85
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition typeinfo.h:84
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
Definition typeinfo.h:81
@ PCB_BARCODE_T
class PCB_BARCODE, a barcode (graphic item)
Definition typeinfo.h:93
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition typeinfo.h:94
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition typeinfo.h:90
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
Definition typeinfo.h:86
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition typeinfo.h:88
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition typeinfo.h:97
@ PCB_DRILL_CHART_T
class PCB_DRILL_CHART, a live drill chart derived from PCB_TABLE
Definition typeinfo.h:239
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708
VECTOR3< double > VECTOR3D
Definition vector3.h:230