65 std::unique_lock<KISPINLOCK> lock(
m_data->GetLock(), std::try_to_lock );
70 constexpr int CROSS_SIZE = 200000;
83 std::set<int> highlightedNets = rs->GetHighlightNetCodes();
84 const std::set<int>& hiddenNets = rs->GetHiddenNets();
88 const bool colorByNet = rs->GetNetColorMode() != NET_COLOR_MODE::OFF;
89 const bool dimStatic =
m_data->GetLocalRatsnest().size() > 0 || highlightedNets.size() > 0;
91 std::map<int, KIGFX::COLOR4D>& netColors = rs->GetNetColorMap();
97 if( rs->m_ContrastModeDisplay == HIGH_CONTRAST_MODE::HIDDEN )
99 visibleLayers.
set( rs->GetPrimaryHighContrastLayer() );
107 visibleLayers.
set( layer );
112 [&](
COLOR4D& color_base,
double brightnessDelta,
double alpha )
117 return color_base.
Darkened( brightnessDelta ).
WithAlpha( std::min( alpha, 1.0 ) );
125 if( hiddenNets.count( l.netCode ) )
131 if(
m_data->HasNetNameForNetCode( l.netCode ) )
133 const wxString& netName =
m_data->GetNetNameForNetCode( l.netCode );
139 if( colorByNet && netColors.count( l.netCode ) )
140 color = netColors.at( l.netCode );
144 color = defaultColor;
146 if(
color == COLOR4D::UNSPECIFIED )
147 color = defaultColor;
154 VECTOR2I( l.b.x + CROSS_SIZE, l.b.y + CROSS_SIZE ) );
156 VECTOR2I( l.b.x + CROSS_SIZE, l.b.y - CROSS_SIZE ) );
162 int dx = l.b.x - l.a.x;
163 int dy = l.b.y - l.a.y;
165 l.a.y + 0.5 * dy + 0.1 * dx );
166 gal->
DrawCurve( l.a, center, center, l.b );
175 for(
int i = 1 ; i <
m_data->GetNetCount(); ++i )
177 if( hiddenNets.count( i ) )
182 if( !net ||
m_data->GetConnectivityAlgo()->IsNetDirty( i ) )
188 if(
m_data->HasNetNameForNetCode( i ) )
190 const wxString& netName =
m_data->GetNetNameForNetCode( i );
196 if( colorByNet && netColors.count( i ) )
197 color = netColors.at( i );
201 color = defaultColor;
203 if(
color == COLOR4D::UNSPECIFIED )
204 color = defaultColor;
210 if( highlightedNets.count( i ) )
217 if( !edge.IsVisible() )
220 const std::shared_ptr<const CN_ANCHOR>& sourceNode = edge.GetSourceNode();
221 const std::shared_ptr<const CN_ANCHOR>& targetNode = edge.GetTargetNode();
223 if( !sourceNode || sourceNode->Dirty() || !targetNode || targetNode->Dirty() )
226 const VECTOR2I source( sourceNode->Pos() );
227 const VECTOR2I target( targetNode->Pos() );
229 bool enable = !sourceNode->GetNoLine() && !targetNode->GetNoLine();
238 show = sourceNode->Parent()->GetLocalRatsnestVisible() &&
239 targetNode->Parent()->GetLocalRatsnestVisible();
243 show = sourceNode->Parent()->GetLocalRatsnestVisible() ||
244 targetNode->Parent()->GetLocalRatsnestVisible();
247 if( onlyVisibleLayers && show )
249 LSET sourceLayers = sourceNode->Parent()->GetLayerSet();
250 LSET targetLayers = targetNode->Parent()->GetLayerSet();
252 if( !( sourceLayers & visibleLayers ).any() ||
253 !( targetLayers & visibleLayers ).any() )
259 if ( enable && show )
261 if ( source == target )
264 VECTOR2I( source.
x + CROSS_SIZE, source.
y + CROSS_SIZE ) );
266 VECTOR2I( source.
x + CROSS_SIZE, source.
y - CROSS_SIZE ) );
272 int dx = target.
x - source.
x;
273 int dy = target.
y - source.
y;
275 source.
y + 0.5 * dy + 0.1 * dx );
276 gal->
DrawCurve( source, center, center, target );
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
BASE_SET & set(size_t pos)
constexpr void SetMaximum()
CN_EDGE represents a point-to-point connection, whether realized or unrealized (ie: tracks etc.
A base class for most all the KiCad significant classes used in schematics and boards.
APP_SETTINGS_BASE * KifaceSettings() const
A color representation with 4 components: red, green, blue, alpha.
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
COLOR4D Darkened(double aFactor) const
Return a color that is darker by a given factor, without modifying object.
COLOR4D Brightened(double aFactor) const
Return a color that is brighter by a given factor, without modifying object.
Abstract interface for drawing on a 2D-surface.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
virtual void DrawCurve(const VECTOR2D &startPoint, const VECTOR2D &controlPointA, const VECTOR2D &controlPointB, const VECTOR2D &endPoint, double aFilterValue=0.0)
Draw a cubic bezier spline.
double GetWorldScale() const
Get the world scale.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
PCB specific render settings.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
LSET is a set of PCB_LAYER_IDs.
void RunOnLayers(const std::function< void(PCB_LAYER_ID)> &aFunction) const
Execute a function on each layer of the LSET.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
A collection of nets and the parameters used to route or test these nets.
COLOR4D GetPcbColor(bool aIsForSave=false) const
NET_SETTINGS stores various net-related settings in a project context.
bool HasEffectiveNetClass(const wxString &aNetName) const
Determines if an effective netclass for the given net name has been cached.
std::shared_ptr< NETCLASS > GetCachedEffectiveNetClass(const wxString &aNetName) const
Returns an already cached effective netclass for the given net name.
DISPLAY_OPTIONS m_Display
const BOX2I ViewBBox() const override
RATSNEST_VIEW_ITEM(std::shared_ptr< CONNECTIVITY_DATA > aData)
Class that draws missing connections on a PCB.
std::shared_ptr< CONNECTIVITY_DATA > m_data
Object containing ratsnest data.
void ViewGetLayers(int aLayers[], int &aCount) const override
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
Describe ratsnest for a single net.
const std::vector< CN_EDGE > & GetEdges() const
@ LAYER_PCB_BACKGROUND
PCB background color.
PCB_LAYER_ID
A quick note on layer IDs:
Class that computes missing connections on a PCB.
RATSNEST_MODE m_RatsnestMode
bool m_DisplayRatsnestLinesCurved
bool m_ShowGlobalRatsnest
double m_RatsnestThickness
@ NOT_USED
the 3d code uses this value
VECTOR2< int32_t > VECTOR2I