77 const BOX2D& aViewport,
bool aCurved )
83 if( aSource == aTarget )
89 bounds.
Merge( target );
113 std::unique_lock<KISPINLOCK> lock(
m_data->GetLock(), std::try_to_lock );
129 std::set<int> highlightedNets = rs->GetHighlightNetCodes();
130 const std::set<int>& hiddenNets = rs->GetHiddenNets();
135 const bool dimStatic =
m_data->GetLocalRatsnest().size() > 0 || highlightedNets.size() > 0;
137 std::map<int, KIGFX::COLOR4D>& netColors = rs->GetNetColorMap();
146 visibleLayers.
set( rs->GetPrimaryHighContrastLayer() );
154 visibleLayers.
set( layer );
159 [&](
COLOR4D& color_base,
double brightnessDelta,
double alpha )
164 return color_base.
Darkened( brightnessDelta ).
WithAlpha( std::min( alpha, 1.0 ) );
184 if( hiddenNets.count( l.netCode ) )
193 if(
m_data->HasNetNameForNetCode( l.netCode ) )
195 const wxString& netName =
m_data->GetNetNameForNetCode( l.netCode );
201 if( colorByNet && netColors.count( l.netCode ) )
202 color = netColors.at( l.netCode );
206 color = defaultColor;
209 color = defaultColor;
231 for(
int i = 1 ; i <
m_data->GetNetCount(); ++i )
233 if( hiddenNets.count( i ) )
238 if( !net ||
m_data->GetConnectivityAlgo()->IsNetDirty( i ) )
244 if(
m_data->HasNetNameForNetCode( i ) )
246 const wxString& netName =
m_data->GetNetNameForNetCode( i );
252 if( colorByNet && netColors.count( i ) )
253 color = netColors.at( i );
257 color = defaultColor;
260 color = defaultColor;
263 color = adjustColor( color, 0.0, color.
a / 2 );
266 if( highlightedNets.count( i ) )
275 if( !edge.IsVisible() )
278 const std::shared_ptr<const CN_ANCHOR>& sourceNode = edge.GetSourceNode();
279 const std::shared_ptr<const CN_ANCHOR>& targetNode = edge.GetTargetNode();
281 if( !sourceNode || sourceNode->Dirty() || !targetNode || targetNode->Dirty() )
285 const VECTOR2I target( targetNode->Pos() );
290 bool enable = !sourceNode->GetNoLine() && !targetNode->GetNoLine();
299 show = sourceNode->Parent()->GetLocalRatsnestVisible() &&
300 targetNode->Parent()->GetLocalRatsnestVisible();
304 show = sourceNode->Parent()->GetLocalRatsnestVisible() ||
305 targetNode->Parent()->GetLocalRatsnestVisible();
308 if( onlyVisibleLayers && show )
310 LSET sourceLayers = sourceNode->Parent()->GetLayerSet();
311 LSET targetLayers = targetNode->Parent()->GetLayerSet();
313 if( !( sourceLayers & visibleLayers ).
any() ||
314 !( targetLayers & visibleLayers ).
any() )
320 if ( enable && show )
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()
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr bool Intersects(const BOX2< Vec > &aRect) const
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...
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
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_ITEM objects.
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
Return the bounding box of the item covering all its layers.
static bool LineInViewport(const VECTOR2I &aSource, const VECTOR2I &aTarget, const BOX2D &aViewport, bool aCurved)
Return true when a ratsnest line between aSource and aTarget can contribute to aViewport.
static VECTOR2D CurveControlPoint(const VECTOR2D &aSource, const VECTOR2D &aTarget)
Return the doubled Bezier control point used to bow a curved ratsnest line.
RATSNEST_VIEW_ITEM(std::shared_ptr< CONNECTIVITY_DATA > aData)
std::shared_ptr< CONNECTIVITY_DATA > m_data
Object containing ratsnest data.
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
Draw the parts of the object belonging to layer aLayer.
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
Describe ratsnest for a single net.
const std::vector< CN_EDGE > & GetUnsortedEdges() const
Return the ratsnest edges in no particular order.
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.
static void drawCross(KIGFX::GAL *aGal, const VECTOR2D &aPos)
static constexpr double CURVE_BOW
static constexpr int CROSS_SIZE
Class that draws 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
VECTOR2< double > VECTOR2D