77 BOOST_CHECK_MESSAGE( color.
a > 0.0,
78 "Color for POINT layer should not be transparent (alpha was "
79 + std::to_string( color.
a ) +
")" );
81 BOOST_CHECK_MESSAGE( color == m_colorSettings.GetColor(
LAYER_POINTS ),
82 "POINT layer color should match LAYER_POINTS color" );
103 BOOST_CHECK_MESSAGE( color == expectedColor,
104 "POINT layer for " + std::to_string( boardLayer )
105 +
" should have LAYER_POINTS color" );
119 explicit RECORDING_GAL( KIGFX::GAL_DISPLAY_OPTIONS& aOptions ) :
124 int BeginGroup()
override
126 m_openGroup = m_nextGroup++;
127 m_groups[m_openGroup].clear();
131 void EndGroup()
override { m_openGroup = -1; }
133 void DeleteGroup(
int aGroupNumber )
override { m_groups.erase( aGroupNumber ); }
135 void ClearCache()
override { m_groups.clear(); }
137 void DrawCircle(
const VECTOR2D&,
double )
override { record(); }
139 void DrawArc(
const VECTOR2D&,
double,
const EDA_ANGLE&,
const EDA_ANGLE& )
override { record(); }
142 void ChangeGroupColor(
int aGroupNumber,
const KIGFX::COLOR4D& aNewColor )
override
144 auto it = m_groups.find( aGroupNumber );
146 if( it != m_groups.end() )
147 it->second.assign( it->second.size(), aNewColor );
150 bool HasGroupWith(
const KIGFX::COLOR4D& aFirst,
const KIGFX::COLOR4D& aSecond )
const
152 for(
const auto& [groupNumber, colors] : m_groups )
154 if( std::find( colors.begin(), colors.end(), aFirst ) != colors.end()
155 && std::find( colors.begin(), colors.end(), aSecond ) != colors.end() )
167 if( m_openGroup >= 0 )
168 m_groups[m_openGroup].push_back( GetIsFill() ? GetFillColor() : GetStrokeColor() );
171 std::map<int, std::vector<KIGFX::COLOR4D>> m_groups;
173 int m_openGroup = -1;
188 RECORDING_GAL gal( options );
209 via->SetStart( { 0, 0 } );
210 via->SetEnd( { 0, 0 } );
218 BOOST_REQUIRE_MESSAGE( gal.HasGroupWith( topColor, bottomColor ),
219 "painter did not emit a two colour via hole to begin with" );
223 BOOST_CHECK_MESSAGE( gal.HasGroupWith( topColor, bottomColor ),
224 "recolouring flattened the blind via hole to a single colour" );
234 RECORDING_GAL gal( options );
254 via->SetStart( { 0, 0 } );
255 via->SetEnd( { 0, 0 } );
258 via->SetSecondaryDrillSize( std::optional<int>(
pcbIUScale.mmToIU( 0.6 ) ) );
259 via->SetSecondaryDrillStartLayer(
F_Cu );
260 via->SetSecondaryDrillEndLayer(
In1_Cu );
266 BOOST_REQUIRE_MESSAGE( gal.HasGroupWith( startColor, endColor ),
267 "painter did not emit a two colour backdrill indicator to begin with" );
271 BOOST_CHECK_MESSAGE( gal.HasGroupWith( startColor, endColor ),
272 "recolouring flattened the backdrill indicator to a single colour" );
282 RECORDING_GAL gal( options );
300 board.
Add( footprint );
304 pad->SetPosition( { 0, 0 } );
311 pad->SetSecondaryDrillStartLayer(
F_Cu );
312 pad->SetSecondaryDrillEndLayer(
In1_Cu );
318 BOOST_REQUIRE_MESSAGE( gal.HasGroupWith( startColor, endColor ),
319 "painter did not emit a two colour pad backdrill to begin with" );
323 BOOST_CHECK_MESSAGE( gal.HasGroupWith( startColor, endColor ),
324 "recolouring flattened the pad backdrill indicator to a single colour" );
constexpr EDA_IU_SCALE pcbIUScale
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Information pertinent to a Pcbnew printed circuit board.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
void SetCopperLayerCount(int aCount)
Color settings are a bit different than most of the settings objects in that there can be more than o...
A color representation with 4 components: red, green, blue, alpha.
Abstract interface for drawing on a 2D-surface.
Contains methods for drawing PCB-specific items.
virtual PCB_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
PCB specific render settings.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
void SetLayerColor(int aLayer, const COLOR4D &aColor)
Change the color used to draw a layer.
void SetPainter(PAINTER *aPainter)
Set the painter object used by the view for drawing #VIEW_ITEMS.
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
void SetGAL(GAL *aGal)
Assign a rendering device for the VIEW.
void UpdateItems()
Iterate through the list of items that asked for updating and updates them.
@ NORMAL
Shape is the same on all layers.
static constexpr PCB_LAYER_ID ALL_LAYERS
! The layer identifier to use for the single defintion on normal padstacks
A PCB_POINT is a 0-dimensional point that is used to mark a position on a PCB, or more usually a foot...
COLOR_SETTINGS m_colorSettings
KIGFX::PCB_RENDER_SETTINGS m_settings
TEST_PCB_RENDER_SETTINGS_FIXTURE()
#define POINT_LAYER_FOR(boardLayer)
@ LAYER_POINTS
PCB reference/manual snap points visibility.
@ LAYER_VIA_HOLES
Draw via holes (pad holes do not use this layer).
PCB_LAYER_ID
A quick note on layer IDs:
void DrawArc(FOOTPRINT &aFootprint, const VECTOR2I &aCentre, const VECTOR2I &aStart, const EDA_ANGLE &aAngle, int aWidth, PCB_LAYER_ID aLayer)
Draw an arc on a footprint.
@ PTH
Plated through hole pad.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(PointLayerColorIsVisible)
Test that PCB_RENDER_SETTINGS::GetColor returns a visible color for POINT layers.
VECTOR2< double > VECTOR2D