61 std::unique_lock<KISPINLOCK> lock(
m_data->GetLock(), std::try_to_lock );
66 constexpr int CROSS_SIZE = 200000;
79 std::set<int> highlightedNets = rs->GetHighlightNetCodes();
80 const std::set<int>& hiddenNets = rs->GetHiddenNets();
85 const bool dimStatic =
m_data->GetLocalRatsnest().size() > 0 || highlightedNets.size() > 0;
87 std::map<int, KIGFX::COLOR4D>& netColors = rs->GetNetColorMap();
96 visibleLayers.
set( rs->GetPrimaryHighContrastLayer() );
104 visibleLayers.
set( layer );
109 [&](
COLOR4D& color_base,
double brightnessDelta,
double alpha )
114 return color_base.
Darkened( brightnessDelta ).
WithAlpha( std::min( alpha, 1.0 ) );
130 if( hiddenNets.count( l.netCode ) )
136 if(
m_data->HasNetNameForNetCode( l.netCode ) )
138 const wxString& netName =
m_data->GetNetNameForNetCode( l.netCode );
144 if( colorByNet && netColors.count( l.netCode ) )
145 color = netColors.at( l.netCode );
149 color = defaultColor;
152 color = defaultColor;
159 VECTOR2I( l.b.x + CROSS_SIZE, l.b.y + CROSS_SIZE ) );
161 VECTOR2I( l.b.x + CROSS_SIZE, l.b.y - CROSS_SIZE ) );
167 int dx = l.b.x - l.a.x;
168 int dy = l.b.y - l.a.y;
170 l.a.y + 0.5 * dy + 0.1 * dx );
180 for(
int i = 1 ; i <
m_data->GetNetCount(); ++i )
182 if( hiddenNets.count( i ) )
187 if( !net ||
m_data->GetConnectivityAlgo()->IsNetDirty( i ) )
193 if(
m_data->HasNetNameForNetCode( i ) )
195 const wxString& netName =
m_data->GetNetNameForNetCode( i );
201 if( colorByNet && netColors.count( i ) )
202 color = netColors.at( i );
206 color = defaultColor;
209 color = defaultColor;
212 color = adjustColor( color, 0.0, color.
a / 2 );
215 if( highlightedNets.count( i ) )
222 if( !edge.IsVisible() )
225 const std::shared_ptr<const CN_ANCHOR>& sourceNode = edge.GetSourceNode();
226 const std::shared_ptr<const CN_ANCHOR>& targetNode = edge.GetTargetNode();
228 if( !sourceNode || sourceNode->Dirty() || !targetNode || targetNode->Dirty() )
231 const VECTOR2I source( sourceNode->Pos() );
232 const VECTOR2I target( targetNode->Pos() );
234 bool enable = !sourceNode->GetNoLine() && !targetNode->GetNoLine();
243 show = sourceNode->Parent()->GetLocalRatsnestVisible() &&
244 targetNode->Parent()->GetLocalRatsnestVisible();
248 show = sourceNode->Parent()->GetLocalRatsnestVisible() ||
249 targetNode->Parent()->GetLocalRatsnestVisible();
252 if( onlyVisibleLayers && show )
254 LSET sourceLayers = sourceNode->Parent()->GetLayerSet();
255 LSET targetLayers = targetNode->Parent()->GetLayerSet();
257 if( !( sourceLayers & visibleLayers ).
any() ||
258 !( targetLayers & visibleLayers ).
any() )
264 if ( enable && show )
266 if ( source == target )
269 VECTOR2I( source.
x + CROSS_SIZE, source.
y + CROSS_SIZE ) );
271 VECTOR2I( source.
x + CROSS_SIZE, source.
y - CROSS_SIZE ) );
277 int dx = target.
x - source.
x;
278 int dy = target.
y - source.
y;
280 source.
y + 0.5 * dy + 0.1 * dx );
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
@ HIDDEN
Inactive layers are hidden.
@ OFF
Net (and netclass) colors are not shown.
@ VISIBLE
Ratsnest lines are drawn to items on visible layers only.
BASE_SET & set(size_t pos)
constexpr void SetMaximum()
CN_EDGE represents a point-to-point connection, whether realized or unrealized (ie: tracks etc.
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
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.
float GetLineWidth() const
Get the line width.
double GetWorldScale() const
Get the world scale.
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.
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
void RunOnLayers(const std::function< void(PCB_LAYER_ID)> &aFunction) const
Execute a function on each layer of the LSET.
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 ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
std::vector< int > ViewGetLayers() const override
Describe ratsnest for a single net.
const std::vector< CN_EDGE > & GetEdges() const
A type-safe container of any type.
@ 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