KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ee_grid_helper.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) 2014 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 * @author Tomasz Wlostowski <[email protected]>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#include <functional>
27#include <macros.h>
29#include <sch_group.h>
30#include <sch_item.h>
31#include <sch_line.h>
32#include <sch_table.h>
33#include <sch_tablecell.h>
34#include <sch_painter.h>
35#include <tool/tool_manager.h>
36#include <sch_tool_base.h>
38#include <trigo.h>
39#include <view/view.h>
40#include "ee_grid_helper.h"
41
46
47
50{
51 if( !m_toolMgr )
52 return;
53
54 KIGFX::VIEW* view = m_toolMgr->GetView();
55
56 m_viewAxis.SetSize( 20000 );
58 m_viewAxis.SetColor( COLOR4D( 0.0, 0.1, 0.4, 0.8 ) );
59 m_viewAxis.SetDrawAtZero( true );
60 view->Add( &m_viewAxis );
61 view->SetVisible( &m_viewAxis, false );
62
64 m_viewSnapPoint.SetColor( COLOR4D( 0.0, 0.1, 0.4, 1.0 ) );
65 m_viewSnapPoint.SetDrawAtZero( true );
66 view->Add( &m_viewSnapPoint );
67 view->SetVisible( &m_viewSnapPoint, false );
68}
69
70
72{
73 if( !m_toolMgr )
74 return;
75
76 KIGFX::VIEW* view = m_toolMgr->GetView();
77
78 view->Remove( &m_viewAxis );
79 view->Remove( &m_viewSnapPoint );
80}
81
82
84 const SCH_SELECTION& aItems )
85{
87
88 // If we're working with any connectable objects, skip non-connectable objects
89 // since they are often off-grid, e.g. text anchors
90 bool hasConnectables = false;
91
92 for( EDA_ITEM* item : aItems )
93 {
94 GRID_HELPER_GRIDS grid = GetItemGrid( static_cast<SCH_ITEM*>( item ) );
96 {
97 hasConnectables = true;
98 break;
99 }
100 }
101
102 for( EDA_ITEM* item : aItems )
103 computeAnchors( static_cast<SCH_ITEM*>( item ), aMousePos, true, !hasConnectables );
104
105 double worldScale = m_toolMgr->GetView()->GetGAL()->GetWorldScale();
106 double lineSnapMinCornerDistance = 50.0 / worldScale;
107
108 ANCHOR* nearestOutline = nearestAnchor( aMousePos, OUTLINE, aGrid );
109 ANCHOR* nearestCorner = nearestAnchor( aMousePos, CORNER, aGrid );
110 ANCHOR* nearestOrigin = nearestAnchor( aMousePos, ORIGIN, aGrid );
111 ANCHOR* best = nullptr;
112 double minDist = std::numeric_limits<double>::max();
113
114 if( nearestOrigin )
115 {
116 minDist = nearestOrigin->Distance( aMousePos );
117 best = nearestOrigin;
118 }
119
120 if( nearestCorner )
121 {
122 double dist = nearestCorner->Distance( aMousePos );
123
124 if( dist < minDist )
125 {
126 minDist = dist;
127 best = nearestCorner;
128 }
129 }
130
131 if( nearestOutline )
132 {
133 double dist = nearestOutline->Distance( aMousePos );
134
135 if( minDist > lineSnapMinCornerDistance && dist < minDist )
136 best = nearestOutline;
137 }
138
139 return best ? best->pos : aMousePos;
140}
141
142
144 SCH_ITEM* aSkip )
145{
146 SCH_SELECTION skipItems;
147 skipItems.Add( aSkip );
148
149 return BestSnapAnchor( aOrigin, aGrid, skipItems );
150}
151
152
154 const SCH_SELECTION& aSkip )
155{
156 constexpr int snapRange = SNAP_RANGE * schIUScale.IU_PER_MILS;
157
158 VECTOR2I pt = aOrigin;
159 VECTOR2I snapDist( snapRange, snapRange );
160 bool gridChecked = false;
161 bool snappedToAnchor = false;
162
163 BOX2I bb( VECTOR2I( aOrigin.x - snapRange / 2, aOrigin.y - snapRange / 2 ),
164 VECTOR2I( snapRange, snapRange ) );
165
166 clearAnchors();
167 m_snapItem = std::nullopt;
168
169 for( SCH_ITEM* item : queryVisible( bb, aSkip ) )
170 computeAnchors( item, aOrigin );
171
172 ANCHOR* nearest = nearestAnchor( aOrigin, SNAPPABLE, aGrid );
173 VECTOR2I nearestGrid = Align( aOrigin, aGrid );
174
176 {
177 ad->ClearAnchors();
178 for( const ANCHOR& a : m_anchors )
179 ad->AddAnchor( a.pos );
180
181 ad->SetNearest( nearest ? OPT_VECTOR2I( nearest->pos ) : std::nullopt );
182 m_toolMgr->GetView()->Update( ad, KIGFX::GEOMETRY );
183 }
184
186
188 const VECTOR2D gridSize = GetGridSize( aGrid );
189
190 std::optional<VECTOR2I> guideSnap;
191
192 if( m_enableSnapLine )
193 guideSnap = SnapToConstructionLines( aOrigin, nearestGrid, gridSize, snapRange );
194
195 if( m_enableSnap && nearest && nearest->Distance( aOrigin ) < snapDist.EuclideanNorm() )
196 {
197
198 if( canUseGrid() && ( nearestGrid - aOrigin ).EuclideanNorm() < snapDist.EuclideanNorm() )
199 {
200 pt = nearestGrid;
201 snapDist.x = std::abs( nearestGrid.x - aOrigin.x );
202 snapDist.y = std::abs( nearestGrid.y - aOrigin.y );
203 gridChecked = true;
204 }
205 else
206 {
207 pt = nearest->pos;
208 snapDist.x = std::abs( nearest->pos.x - aOrigin.x );
209 snapDist.y = std::abs( nearest->pos.y - aOrigin.y );
210 snappedToAnchor = true;
211 gridChecked = true;
212 }
213 }
214
215 if( guideSnap && m_skipPoint != *guideSnap )
216 {
217 snapLineManager.SetSnapLineEnd( *guideSnap );
218 m_toolMgr->GetView()->SetVisible( &m_viewSnapPoint, false );
219 m_snapItem = std::nullopt;
220 return *guideSnap;
221 }
222
223 if( snappedToAnchor )
224 {
225 m_snapItem = *nearest;
226 m_viewSnapPoint.SetPosition( pt );
227
228 snapLineManager.SetSnapLineOrigin( pt );
229
230 if( m_toolMgr->GetView()->IsVisible( &m_viewSnapPoint ) )
231 m_toolMgr->GetView()->Update( &m_viewSnapPoint, KIGFX::GEOMETRY);
232 else
233 m_toolMgr->GetView()->SetVisible( &m_viewSnapPoint, true );
234 }
235
236 if( !snappedToAnchor )
237 m_snapItem = std::nullopt;
238
239 if( canUseGrid() && !gridChecked )
240 pt = nearestGrid;
241
242 snapLineManager.SetSnapLineEnd( std::nullopt );
243 m_toolMgr->GetView()->SetVisible( &m_viewSnapPoint, false );
244
245 return pt;
246}
247
248
250{
251 const GRID_SETTINGS& grid = m_toolMgr->GetSettings()->m_Window.grid;
252 int idx = -1;
253
254 VECTOR2D g = m_toolMgr->GetView()->GetGAL()->GetGridSize();
255
256 if( !grid.overrides_enabled )
257 return g;
258
259 switch( aGrid )
260 {
261 case GRID_CONNECTABLE:
262 if( grid.override_connected )
263 idx = grid.override_connected_idx;
264
265 break;
266
267 case GRID_WIRES:
268 if( grid.override_wires )
269 idx = grid.override_wires_idx;
270
271 break;
272
273 case GRID_TEXT:
274 if( grid.override_text )
275 idx = grid.override_text_idx;
276
277 break;
278
279 case GRID_GRAPHICS:
280 if( grid.override_graphics )
281 idx = grid.override_graphics_idx;
282
283 break;
284
285 default:
286 break;
287 }
288
289 if( idx >= 0 && idx < (int) grid.grids.size() )
290 g = grid.grids[idx].ToDouble( schIUScale );
291
292 return g;
293}
294
295
297{
298 if( !m_snapItem )
299 return nullptr;
300
301 if( m_snapItem->items.empty() )
302 return nullptr;
303
304 return static_cast<SCH_ITEM*>( m_snapItem->items[0] );
305}
306
307
308std::set<SCH_ITEM*> EE_GRID_HELPER::queryVisible( const BOX2I& aArea,
309 const SCH_SELECTION& aSkipList ) const
310{
311 std::set<SCH_ITEM*> items;
312 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;
313
314 EDA_DRAW_FRAME* frame = dynamic_cast<EDA_DRAW_FRAME*>( m_toolMgr->GetToolHolder() );
315 KIGFX::VIEW* view = m_toolMgr->GetView();
316
317 view->Query( aArea, selectedItems );
318
319 for( const KIGFX::VIEW::LAYER_ITEM_PAIR& it : selectedItems )
320 {
321 if( !it.first->IsSCH_ITEM() )
322 continue;
323
324 SCH_ITEM* item = static_cast<SCH_ITEM*>( it.first );
325
326 if( frame && frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) )
327 {
328 // If we are in the symbol editor, don't use the symbol itself
329 if( item->Type() == LIB_SYMBOL_T )
330 continue;
331 }
332 else
333 {
334 // If we are not in the symbol editor, don't use symbol-editor-private items
335 if( item->IsPrivate() )
336 continue;
337 }
338
339 // The item must be visible and on an active layer
340 if( view->IsVisible( item ) && item->ViewGetLOD( it.second, view ) < view->GetScale() )
341 items.insert ( item );
342 }
343
344 for( EDA_ITEM* skipItem : aSkipList )
345 items.erase( static_cast<SCH_ITEM*>( skipItem ) );
346
347 return items;
348}
349
350
352{
353 GRID_HELPER_GRIDS grid = GetItemGrid( aSelection.Front() );
354
355 // Find the largest grid of all the items and use that
356 for( EDA_ITEM* item : aSelection )
357 {
358 GRID_HELPER_GRIDS itemGrid = GetItemGrid( item );
359
360 if( GetGridSize( itemGrid ) > GetGridSize( grid ) )
361 grid = itemGrid;
362 }
363
364 return grid;
365}
366
367
369{
370 if( !aItem )
371 return GRID_CURRENT;
372
373 switch( aItem->Type() )
374 {
375 case LIB_SYMBOL_T:
376 case SCH_SYMBOL_T:
377 case SCH_PIN_T:
378 case SCH_SHEET_PIN_T:
379 case SCH_SHEET_T:
380 case SCH_NO_CONNECT_T:
382 case SCH_HIER_LABEL_T:
383 case SCH_LABEL_T:
385 case SCH_RULE_AREA_T:
386 return GRID_CONNECTABLE;
387
388 case SCH_FIELD_T:
389 case SCH_TEXT_T:
390 return GRID_TEXT;
391
392 case SCH_SHAPE_T:
393 // The text box's border lines are what need to be on the graphic grid
394 case SCH_TEXTBOX_T:
395 case SCH_BITMAP_T:
396 return GRID_GRAPHICS;
397
398 case SCH_JUNCTION_T:
399 return GRID_WIRES;
400
401 case SCH_LINE_T:
402 if( static_cast<const SCH_LINE*>( aItem )->IsConnectable() )
403 return GRID_WIRES;
404 else
405 return GRID_GRAPHICS;
406
409 return GRID_WIRES;
410
411 // Groups need to get the grid of their children
412 case SCH_GROUP_T:
413 {
414 const SCH_GROUP* group = static_cast<const SCH_GROUP*>( aItem );
415
416 // Shouldn't happen
417 if( group->GetItems().empty() )
418 return GRID_CURRENT;
419
420 GRID_HELPER_GRIDS grid = GetItemGrid( *group->GetItems().begin() );
421
422 for( EDA_ITEM* item : static_cast<const SCH_GROUP*>( aItem )->GetItems() )
423 {
424 GRID_HELPER_GRIDS itemGrid = GetItemGrid( item );
425
426 if( GetGridSize( itemGrid ) > GetGridSize( grid ) )
427 grid = itemGrid;
428 }
429
430 return grid;
431 }
432
433 default:
434 return GRID_CURRENT;
435 }
436}
437
438
439void EE_GRID_HELPER::computeAnchors( SCH_ITEM *aItem, const VECTOR2I &aRefPos, bool aFrom,
440 bool aIncludeText )
441{
442 bool isGraphicLine =
443 aItem->Type() == SCH_LINE_T && static_cast<SCH_LINE*>( aItem )->IsGraphicLine();
444
445 switch( aItem->Type() )
446 {
447 case SCH_TEXT_T:
448 case SCH_FIELD_T:
449 {
450 if( aIncludeText )
451 addAnchor( aItem->GetPosition(), ORIGIN, aItem );
452
453 break;
454 }
455
456 case SCH_TABLE_T:
457 {
458 if( aIncludeText )
459 {
460 addAnchor( aItem->GetPosition(), SNAPPABLE | CORNER, aItem );
461 addAnchor( static_cast<SCH_TABLE*>( aItem )->GetEnd(), SNAPPABLE | CORNER, aItem );
462 }
463
464 break;
465 }
466
467 case SCH_TEXTBOX_T:
468 case SCH_TABLECELL_T:
469 {
470 if( aIncludeText )
471 {
472 addAnchor( aItem->GetPosition(), SNAPPABLE | CORNER, aItem );
473 addAnchor( static_cast<SCH_SHAPE*>( aItem )->GetEnd(), SNAPPABLE | CORNER, aItem );
474 }
475
476 break;
477 }
478
479 case SCH_SYMBOL_T:
480 case SCH_SHEET_T:
481 addAnchor( aItem->GetPosition(), ORIGIN, aItem );
483
484 case SCH_JUNCTION_T:
485 case SCH_NO_CONNECT_T:
486 case SCH_LINE_T:
487 // Don't add anchors for graphic lines unless we're including text,
488 // they may be on a non-connectable grid
489 if( isGraphicLine && !aIncludeText )
490 break;
491
494 case SCH_HIER_LABEL_T:
495 case SCH_LABEL_T:
498 case SCH_SHEET_PIN_T:
499 {
500 std::vector<VECTOR2I> pts = aItem->GetConnectionPoints();
501
502 for( const VECTOR2I& pt : pts )
503 addAnchor( VECTOR2I( pt ), SNAPPABLE | CORNER, aItem );
504
505 break;
506 }
507 case SCH_PIN_T:
508 {
509 SCH_PIN* pin = static_cast<SCH_PIN*>( aItem );
510 addAnchor( pin->GetPosition(), SNAPPABLE | ORIGIN, aItem );
511 break;
512 }
513
514 case SCH_GROUP_T:
515 for( EDA_ITEM* item : static_cast<SCH_GROUP*>( aItem )->GetItems() )
516 {
517 computeAnchors( static_cast<SCH_ITEM*>( item ), aRefPos, aFrom, aIncludeText );
518 }
519
520 break;
521
522 default:
523 break;
524 }
525
526 // Don't add anchors for graphic lines unless we're including text,
527 // they may be on a non-connectable grid
528 if( aItem->Type() == SCH_LINE_T && ( aIncludeText || !isGraphicLine ) )
529 {
530 SCH_LINE* line = static_cast<SCH_LINE*>( aItem );
531 VECTOR2I pt = Align( aRefPos );
532
533 if( line->GetStartPoint().x == line->GetEndPoint().x )
534 {
535 VECTOR2I possible( line->GetStartPoint().x, pt.y );
536
537 if( TestSegmentHit( possible, line->GetStartPoint(), line->GetEndPoint(), 0 ) )
538 addAnchor( possible, SNAPPABLE | VERTICAL, aItem );
539 }
540 else if( line->GetStartPoint().y == line->GetEndPoint().y )
541 {
542 VECTOR2I possible( pt.x, line->GetStartPoint().y );
543
544 if( TestSegmentHit( possible, line->GetStartPoint(), line->GetEndPoint(), 0 ) )
545 addAnchor( possible, SNAPPABLE | HORIZONTAL, aItem );
546 }
547 }
548}
549
550
552 GRID_HELPER_GRIDS aGrid )
553{
554 double minDist = std::numeric_limits<double>::max();
555 ANCHOR* best = nullptr;
556
557 for( ANCHOR& a : m_anchors )
558 {
559 if( ( aFlags & a.flags ) != aFlags )
560 continue;
561
562 // A "virtual" anchor with no real items associated shouldn't be filtered out
563 if( !a.items.empty() )
564 {
565 // Filter using the first item
566 SCH_ITEM* item = static_cast<SCH_ITEM*>( a.items[0] );
567
568 if( aGrid == GRID_CONNECTABLE && !item->IsConnectable() )
569 continue;
570 else if( aGrid == GRID_GRAPHICS && item->IsConnectable() )
571 continue;
572 }
573
574 double dist = a.Distance( aPos );
575
576 if( dist < minDist )
577 {
578 minDist = dist;
579 best = &a;
580 }
581 }
582
583 return best;
584}
constexpr EDA_IU_SCALE schIUScale
Definition base_units.h:114
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
bool IsType(FRAME_T aType) const
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
virtual VECTOR2I GetPosition() const
Definition eda_item.h:272
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
GRID_HELPER_GRIDS GetSelectionGrid(const SELECTION &aItem) const override
Gets the coarsest grid that applies to a selecion of items.
~EE_GRID_HELPER() override
GRID_HELPER_GRIDS GetItemGrid(const EDA_ITEM *aItem) const override
Get the coarsest grid that applies to an item.
VECTOR2I BestDragOrigin(const VECTOR2I &aMousePos, GRID_HELPER_GRIDS aGrid, const SCH_SELECTION &aItems)
std::set< SCH_ITEM * > queryVisible(const BOX2I &aArea, const SCH_SELECTION &aSkipList) const
VECTOR2I BestSnapAnchor(const VECTOR2I &aOrigin, GRID_HELPER_GRIDS aGrid, SCH_ITEM *aSkip)
ANCHOR * nearestAnchor(const VECTOR2I &aPos, int aFlags, GRID_HELPER_GRIDS aGrid)
VECTOR2D GetGridSize(GRID_HELPER_GRIDS aGrid) const override
Return the size of the specified grid.
SCH_ITEM * GetSnapped() const
Function GetSnapped If the EE_GRID_HELPER has highlighted a snap point (target shown),...
void computeAnchors(SCH_ITEM *aItem, const VECTOR2I &aRefPos, bool aFrom=false, bool aIncludeText=false)
Insert the local anchor points in to the grid helper for the specified schematic item,...
std::optional< VECTOR2I > SnapToConstructionLines(const VECTOR2I &aPoint, const VECTOR2I &aNearestGrid, const VECTOR2D &aGrid, double aSnapRange) const
void addAnchor(const VECTOR2I &aPos, int aFlags, EDA_ITEM *aItem, int aPointTypes=POINT_TYPE::PT_NONE)
SNAP_MANAGER & getSnapManager()
VECTOR2I m_skipPoint
void showConstructionGeometry(bool aShow)
TOOL_MANAGER * m_toolMgr
bool m_enableSnapLine
bool m_enableSnap
bool canUseGrid() const
Check whether it is possible to use the grid – this depends both on local grid helper settings and gl...
void clearAnchors()
std::optional< ANCHOR > m_snapItem
KIGFX::ANCHOR_DEBUG * enableAndGetAnchorDebug()
Enable the anchor debug if permitted and return it.
KIGFX::SNAP_INDICATOR m_viewSnapPoint
virtual VECTOR2I Align(const VECTOR2I &aPoint, GRID_HELPER_GRIDS aGrid) const
Definition grid_helper.h:75
KIGFX::ORIGIN_VIEWITEM m_viewAxis
std::vector< ANCHOR > m_anchors
View item to draw debug items for anchors.
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:104
virtual double ViewGetLOD(int aLayer, const VIEW *aView) const
Return the level of detail (LOD) of the item.
Definition view_item.h:155
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:66
double GetScale() const
Definition view.h:276
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition view.cpp:298
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition view.cpp:341
int Query(const BOX2I &aRect, std::vector< LAYER_ITEM_PAIR > &aResult) const
Find all visible items that touch or are within the rectangle aRect.
Definition view.cpp:420
std::pair< VIEW_ITEM *, int > LAYER_ITEM_PAIR
Definition view.h:70
bool IsVisible(const VIEW_ITEM *aItem) const
Return information if the item is visible (or not).
Definition view.cpp:1655
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
Definition view.cpp:1612
A set of SCH_ITEMs (i.e., without duplicates).
Definition sch_group.h:52
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:167
virtual bool IsConnectable() const
Definition sch_item.h:505
bool IsPrivate() const
Definition sch_item.h:253
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition sch_item.h:520
Segment description base class to describe items which have 2 end points (track, wire,...
Definition sch_line.h:42
VECTOR2I GetEndPoint() const
Definition sch_line.h:148
VECTOR2I GetStartPoint() const
Definition sch_line.h:139
virtual void Add(EDA_ITEM *aItem)
Definition selection.cpp:42
EDA_ITEM * Front() const
Definition selection.h:177
void SetSnapLineOrigin(const VECTOR2I &aOrigin)
The snap point is a special point that is located at the last point the cursor snapped to.
void SetSnapLineEnd(const OPT_VECTOR2I &aSnapPoint)
Set the end point of the snap line.
SNAP_LINE_MANAGER & GetSnapLineManager()
Master controller class:
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
Definition vector2d.h:283
#define SNAP_RANGE
@ FRAME_SCH_SYMBOL_EDITOR
Definition frame_type.h:35
GRID_HELPER_GRIDS
Definition grid_helper.h:44
@ GRID_TEXT
Definition grid_helper.h:51
@ GRID_CURRENT
Definition grid_helper.h:46
@ GRID_GRAPHICS
Definition grid_helper.h:52
@ GRID_CONNECTABLE
Definition grid_helper.h:48
@ GRID_WIRES
Definition grid_helper.h:49
@ LAYER_SCHEMATIC_ANCHOR
Definition layer_ids.h:500
This file contains miscellaneous commonly used macros and functions.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition macros.h:83
@ GEOMETRY
Position or shape has changed.
Definition view_item.h:55
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition eda_angle.h:400
Class to handle a set of SCH_ITEMs.
std::optional< VECTOR2I > OPT_VECTOR2I
Definition seg.h:39
double Distance(const VECTOR2I &aP) const
bool TestSegmentHit(const VECTOR2I &aRefPoint, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
Definition trigo.cpp:175
@ SCH_GROUP_T
Definition typeinfo.h:177
@ SCH_TABLE_T
Definition typeinfo.h:169
@ SCH_LINE_T
Definition typeinfo.h:167
@ LIB_SYMBOL_T
Definition typeinfo.h:152
@ SCH_NO_CONNECT_T
Definition typeinfo.h:164
@ SCH_SYMBOL_T
Definition typeinfo.h:176
@ SCH_TABLECELL_T
Definition typeinfo.h:170
@ SCH_FIELD_T
Definition typeinfo.h:154
@ SCH_DIRECTIVE_LABEL_T
Definition typeinfo.h:175
@ SCH_LABEL_T
Definition typeinfo.h:171
@ SCH_SHEET_T
Definition typeinfo.h:179
@ SCH_SHAPE_T
Definition typeinfo.h:153
@ SCH_RULE_AREA_T
Definition typeinfo.h:174
@ SCH_HIER_LABEL_T
Definition typeinfo.h:173
@ SCH_BUS_BUS_ENTRY_T
Definition typeinfo.h:166
@ SCH_SHEET_PIN_T
Definition typeinfo.h:178
@ SCH_TEXT_T
Definition typeinfo.h:155
@ SCH_BUS_WIRE_ENTRY_T
Definition typeinfo.h:165
@ SCH_BITMAP_T
Definition typeinfo.h:168
@ SCH_TEXTBOX_T
Definition typeinfo.h:156
@ SCH_GLOBAL_LABEL_T
Definition typeinfo.h:172
@ SCH_JUNCTION_T
Definition typeinfo.h:163
@ SCH_PIN_T
Definition typeinfo.h:157
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695
VECTOR2< double > VECTOR2D
Definition vector2d.h:694