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, see <https://www.gnu.org/licenses/>.
20 */
21
22#include <functional>
23#include <macros.h>
25#include <sch_group.h>
26#include <sch_item.h>
27#include <sch_line.h>
28#include <sch_table.h>
29#include <sch_tablecell.h>
30#include <sch_painter.h>
31#include <tool/tool_manager.h>
32#include <sch_tool_base.h>
34#include <trigo.h>
35#include <view/view.h>
36#include "ee_grid_helper.h"
37
42
43
46{
47 if( !m_toolMgr )
48 return;
49
50 KIGFX::VIEW* view = m_toolMgr->GetView();
51
52 m_viewAxis.SetSize( 20000 );
54 m_viewAxis.SetColor( COLOR4D( 0.0, 0.1, 0.4, 0.8 ) );
55 m_viewAxis.SetDrawAtZero( true );
56 view->Add( &m_viewAxis );
57 view->SetVisible( &m_viewAxis, false );
58
60 m_viewSnapPoint.SetColor( COLOR4D( 0.0, 0.1, 0.4, 1.0 ) );
61 m_viewSnapPoint.SetDrawAtZero( true );
62 view->Add( &m_viewSnapPoint );
63 view->SetVisible( &m_viewSnapPoint, false );
64}
65
66
68{
69 if( !m_toolMgr )
70 return;
71
72 KIGFX::VIEW* view = m_toolMgr->GetView();
73
74 view->Remove( &m_viewAxis );
75 view->Remove( &m_viewSnapPoint );
76}
77
78
80 const SCH_SELECTION& aItems )
81{
83
84 // If we're working with any connectable objects, skip non-connectable objects
85 // since they are often off-grid, e.g. text anchors
86 bool hasConnectables = false;
87
88 for( EDA_ITEM* item : aItems )
89 {
90 GRID_HELPER_GRIDS grid = GetItemGrid( static_cast<SCH_ITEM*>( item ) );
92 {
93 hasConnectables = true;
94 break;
95 }
96 }
97
98 for( EDA_ITEM* item : aItems )
99 computeAnchors( static_cast<SCH_ITEM*>( item ), aMousePos, true, !hasConnectables );
100
101 double worldScale = m_toolMgr->GetView()->GetGAL()->GetWorldScale();
102 double lineSnapMinCornerDistance = 50.0 / worldScale;
103
104 ANCHOR* nearestOutline = nearestAnchor( aMousePos, OUTLINE, aGrid );
105 ANCHOR* nearestCorner = nearestAnchor( aMousePos, CORNER, aGrid );
106 ANCHOR* nearestOrigin = nearestAnchor( aMousePos, ORIGIN, aGrid );
107 ANCHOR* best = nullptr;
108 double minDist = std::numeric_limits<double>::max();
109
110 if( nearestOrigin )
111 {
112 minDist = nearestOrigin->Distance( aMousePos );
113 best = nearestOrigin;
114 }
115
116 if( nearestCorner )
117 {
118 double dist = nearestCorner->Distance( aMousePos );
119
120 if( dist < minDist )
121 {
122 minDist = dist;
123 best = nearestCorner;
124 }
125 }
126
127 if( nearestOutline )
128 {
129 double dist = nearestOutline->Distance( aMousePos );
130
131 if( minDist > lineSnapMinCornerDistance && dist < minDist )
132 best = nearestOutline;
133 }
134
135 return best ? best->pos : aMousePos;
136}
137
138
140 SCH_ITEM* aSkip )
141{
142 SCH_SELECTION skipItems;
143 skipItems.Add( aSkip );
144
145 return BestSnapAnchor( aOrigin, aGrid, skipItems );
146}
147
148
150 const SCH_SELECTION& aSkip )
151{
152 constexpr int snapRange = SNAP_RANGE * schIUScale.IU_PER_MILS;
153
154 VECTOR2I pt = aOrigin;
155 VECTOR2I snapDist( snapRange, snapRange );
156 bool gridChecked = false;
157 bool snappedToAnchor = false;
158
159 BOX2I bb( VECTOR2I( aOrigin.x - snapRange / 2, aOrigin.y - snapRange / 2 ),
160 VECTOR2I( snapRange, snapRange ) );
161
162 clearAnchors();
163 m_snapItem = std::nullopt;
164
165 for( SCH_ITEM* item : queryVisible( bb, aSkip ) )
166 computeAnchors( item, aOrigin );
167
168 ANCHOR* nearest = nearestAnchor( aOrigin, SNAPPABLE, aGrid );
169 VECTOR2I nearestGrid = Align( aOrigin, aGrid );
170
172 {
173 ad->ClearAnchors();
174 for( const ANCHOR& a : m_anchors )
175 ad->AddAnchor( a.pos );
176
177 ad->SetNearest( nearest ? OPT_VECTOR2I( nearest->pos ) : std::nullopt );
178 m_toolMgr->GetView()->Update( ad, KIGFX::GEOMETRY );
179 }
180
182
184 const VECTOR2D gridSize = GetGridSize( aGrid );
185
186 std::optional<VECTOR2I> guideSnap;
187
188 if( m_enableSnapLine )
189 guideSnap = SnapToConstructionLines( aOrigin, nearestGrid, gridSize, snapRange );
190
191 if( m_enableSnap && nearest && nearest->Distance( aOrigin ) < snapDist.EuclideanNorm() )
192 {
193
194 if( canUseGrid() && ( nearestGrid - aOrigin ).EuclideanNorm() < snapDist.EuclideanNorm() )
195 {
196 pt = nearestGrid;
197 snapDist.x = std::abs( nearestGrid.x - aOrigin.x );
198 snapDist.y = std::abs( nearestGrid.y - aOrigin.y );
199 gridChecked = true;
200 }
201 else
202 {
203 pt = nearest->pos;
204 snapDist.x = std::abs( nearest->pos.x - aOrigin.x );
205 snapDist.y = std::abs( nearest->pos.y - aOrigin.y );
206 snappedToAnchor = true;
207 gridChecked = true;
208 }
209 }
210
211 if( guideSnap && m_skipPoint != *guideSnap )
212 {
213 snapLineManager.SetSnapLineEnd( *guideSnap );
214 m_toolMgr->GetView()->SetVisible( &m_viewSnapPoint, false );
215 m_snapItem = std::nullopt;
216 return *guideSnap;
217 }
218
219 if( snappedToAnchor )
220 {
221 m_snapItem = *nearest;
222 m_viewSnapPoint.SetPosition( pt );
223
224 snapLineManager.SetSnapLineOrigin( pt );
225 snapLineManager.SetSnapLineEnd( std::nullopt );
226
227 if( m_toolMgr->GetView()->IsVisible( &m_viewSnapPoint ) )
228 m_toolMgr->GetView()->Update( &m_viewSnapPoint, KIGFX::GEOMETRY );
229 else
230 m_toolMgr->GetView()->SetVisible( &m_viewSnapPoint, true );
231
232 return pt;
233 }
234
235 m_snapItem = std::nullopt;
236
237 if( canUseGrid() && !gridChecked )
238 pt = nearestGrid;
239
240 snapLineManager.SetSnapLineEnd( std::nullopt );
241 m_toolMgr->GetView()->SetVisible( &m_viewSnapPoint, false );
242
243 return pt;
244}
245
246
248{
249 const GRID_SETTINGS& grid = m_toolMgr->GetSettings()->m_Window.grid;
250 int idx = -1;
251
252 VECTOR2D g = m_toolMgr->GetView()->GetGAL()->GetGridSize();
253
254 if( !grid.overrides_enabled )
255 return g;
256
257 switch( aGrid )
258 {
259 case GRID_CONNECTABLE:
260 if( grid.override_connected )
261 idx = grid.override_connected_idx;
262
263 break;
264
265 case GRID_WIRES:
266 if( grid.override_wires )
267 idx = grid.override_wires_idx;
268
269 break;
270
271 case GRID_TEXT:
272 if( grid.override_text )
273 idx = grid.override_text_idx;
274
275 break;
276
277 case GRID_GRAPHICS:
278 if( grid.override_graphics )
279 idx = grid.override_graphics_idx;
280
281 break;
282
283 default:
284 break;
285 }
286
287 if( idx >= 0 && idx < (int) grid.grids.size() )
288 g = grid.grids[idx].ToDouble( schIUScale );
289
290 return g;
291}
292
293
295{
296 if( !m_snapItem )
297 return nullptr;
298
299 if( m_snapItem->items.empty() )
300 return nullptr;
301
302 return static_cast<SCH_ITEM*>( m_snapItem->items[0] );
303}
304
305
306std::set<SCH_ITEM*> EE_GRID_HELPER::queryVisible( const BOX2I& aArea,
307 const SCH_SELECTION& aSkipList ) const
308{
309 std::set<SCH_ITEM*> items;
310 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;
311
312 EDA_DRAW_FRAME* frame = dynamic_cast<EDA_DRAW_FRAME*>( m_toolMgr->GetToolHolder() );
313 KIGFX::VIEW* view = m_toolMgr->GetView();
314
315 view->Query( aArea, selectedItems );
316
317 for( const KIGFX::VIEW::LAYER_ITEM_PAIR& it : selectedItems )
318 {
319 if( !it.first->IsSCH_ITEM() )
320 continue;
321
322 SCH_ITEM* item = static_cast<SCH_ITEM*>( it.first );
323
324 if( frame && frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) )
325 {
326 // If we are in the symbol editor, don't use the symbol itself
327 if( item->Type() == LIB_SYMBOL_T )
328 continue;
329 }
330 else
331 {
332 // If we are not in the symbol editor, don't use symbol-editor-private items
333 if( item->IsPrivate() )
334 continue;
335 }
336
337 // The item must be visible and on an active layer
338 if( view->IsVisible( item ) && item->ViewGetLOD( it.second, view ) < view->GetScale() )
339 items.insert ( item );
340 }
341
342 for( EDA_ITEM* skipItem : aSkipList )
343 items.erase( static_cast<SCH_ITEM*>( skipItem ) );
344
345 return items;
346}
347
348
350{
351 GRID_HELPER_GRIDS grid = GetItemGrid( aSelection.Front() );
352
353 // Find the largest grid of all the items and use that
354 for( EDA_ITEM* item : aSelection )
355 {
356 GRID_HELPER_GRIDS itemGrid = GetItemGrid( item );
357
358 if( GetGridSize( itemGrid ) > GetGridSize( grid ) )
359 grid = itemGrid;
360 }
361
362 return grid;
363}
364
365
367{
368 if( !aItem )
369 return GRID_CURRENT;
370
371 switch( aItem->Type() )
372 {
373 case LIB_SYMBOL_T:
374 case SCH_SYMBOL_T:
375 case SCH_PIN_T:
376 case SCH_SHEET_PIN_T:
377 case SCH_SHEET_T:
378 case SCH_NO_CONNECT_T:
380 case SCH_HIER_LABEL_T:
381 case SCH_LABEL_T:
383 case SCH_RULE_AREA_T:
384 return GRID_CONNECTABLE;
385
386 case SCH_FIELD_T:
387 case SCH_TEXT_T:
388 return GRID_TEXT;
389
390 case SCH_SHAPE_T:
391 // The text box's border lines are what need to be on the graphic grid
392 case SCH_TEXTBOX_T:
393 case SCH_BITMAP_T:
394 return GRID_GRAPHICS;
395
396 case SCH_JUNCTION_T:
397 return GRID_WIRES;
398
399 case SCH_LINE_T:
400 if( static_cast<const SCH_LINE*>( aItem )->IsConnectable() )
401 return GRID_WIRES;
402 else
403 return GRID_GRAPHICS;
404
407 return GRID_WIRES;
408
409 // Groups need to get the grid of their children
410 case SCH_GROUP_T:
411 {
412 const SCH_GROUP* group = static_cast<const SCH_GROUP*>( aItem );
413
414 // Shouldn't happen
415 if( group->GetItems().empty() )
416 return GRID_CURRENT;
417
418 GRID_HELPER_GRIDS grid = GetItemGrid( *group->GetItems().begin() );
419
420 for( EDA_ITEM* item : static_cast<const SCH_GROUP*>( aItem )->GetItems() )
421 {
422 GRID_HELPER_GRIDS itemGrid = GetItemGrid( item );
423
424 if( GetGridSize( itemGrid ) > GetGridSize( grid ) )
425 grid = itemGrid;
426 }
427
428 return grid;
429 }
430
431 default:
432 return GRID_CURRENT;
433 }
434}
435
436
437void EE_GRID_HELPER::computeAnchors( SCH_ITEM *aItem, const VECTOR2I &aRefPos, bool aFrom,
438 bool aIncludeText )
439{
440 bool isGraphicLine =
441 aItem->Type() == SCH_LINE_T && static_cast<SCH_LINE*>( aItem )->IsGraphicLine();
442
443 switch( aItem->Type() )
444 {
445 case SCH_TEXT_T:
446 case SCH_FIELD_T:
447 {
448 if( aIncludeText )
449 addAnchor( aItem->GetPosition(), ORIGIN, aItem );
450
451 break;
452 }
453
454 case SCH_TABLE_T:
455 {
456 if( aIncludeText )
457 {
458 addAnchor( aItem->GetPosition(), SNAPPABLE | CORNER, aItem );
459 addAnchor( static_cast<SCH_TABLE*>( aItem )->GetEnd(), SNAPPABLE | CORNER, aItem );
460 }
461
462 break;
463 }
464
465 case SCH_TEXTBOX_T:
466 case SCH_TABLECELL_T:
467 {
468 if( aIncludeText )
469 {
470 addAnchor( aItem->GetPosition(), SNAPPABLE | CORNER, aItem );
471 addAnchor( static_cast<SCH_SHAPE*>( aItem )->GetEnd(), SNAPPABLE | CORNER, aItem );
472 }
473
474 break;
475 }
476
477 case SCH_SYMBOL_T:
478 case SCH_SHEET_T:
479 addAnchor( aItem->GetPosition(), ORIGIN, aItem );
481
482 case SCH_JUNCTION_T:
483 case SCH_NO_CONNECT_T:
484 case SCH_LINE_T:
485 // Don't add anchors for graphic lines unless we're including text,
486 // they may be on a non-connectable grid
487 if( isGraphicLine && !aIncludeText )
488 break;
489
492 case SCH_HIER_LABEL_T:
493 case SCH_LABEL_T:
496 case SCH_SHEET_PIN_T:
497 {
498 std::vector<VECTOR2I> pts = aItem->GetConnectionPoints();
499
500 for( const VECTOR2I& pt : pts )
501 addAnchor( VECTOR2I( pt ), SNAPPABLE | CORNER, aItem );
502
503 break;
504 }
505 case SCH_PIN_T:
506 {
507 SCH_PIN* pin = static_cast<SCH_PIN*>( aItem );
508 addAnchor( pin->GetPosition(), SNAPPABLE | ORIGIN, aItem );
509 break;
510 }
511
512 case SCH_GROUP_T:
513 for( EDA_ITEM* item : static_cast<SCH_GROUP*>( aItem )->GetItems() )
514 {
515 computeAnchors( static_cast<SCH_ITEM*>( item ), aRefPos, aFrom, aIncludeText );
516 }
517
518 break;
519
520 default:
521 break;
522 }
523
524 // Don't add anchors for graphic lines unless we're including text,
525 // they may be on a non-connectable grid
526 if( aItem->Type() == SCH_LINE_T && ( aIncludeText || !isGraphicLine ) )
527 {
528 SCH_LINE* line = static_cast<SCH_LINE*>( aItem );
529 VECTOR2I pt = Align( aRefPos );
530
531 if( line->GetStartPoint().x == line->GetEndPoint().x )
532 {
533 VECTOR2I possible( line->GetStartPoint().x, pt.y );
534
535 if( TestSegmentHit( possible, line->GetStartPoint(), line->GetEndPoint(), 0 ) )
536 addAnchor( possible, SNAPPABLE | VERTICAL, aItem );
537 }
538 else if( line->GetStartPoint().y == line->GetEndPoint().y )
539 {
540 VECTOR2I possible( pt.x, line->GetStartPoint().y );
541
542 if( TestSegmentHit( possible, line->GetStartPoint(), line->GetEndPoint(), 0 ) )
543 addAnchor( possible, SNAPPABLE | HORIZONTAL, aItem );
544 }
545 }
546}
547
548
550 GRID_HELPER_GRIDS aGrid )
551{
552 double minDist = std::numeric_limits<double>::max();
553 ANCHOR* best = nullptr;
554
555 for( ANCHOR& a : m_anchors )
556 {
557 if( ( aFlags & a.flags ) != aFlags )
558 continue;
559
560 // A "virtual" anchor with no real items associated shouldn't be filtered out
561 if( !a.items.empty() )
562 {
563 // Filter using the first item
564 SCH_ITEM* item = static_cast<SCH_ITEM*>( a.items[0] );
565
566 if( aGrid == GRID_CONNECTABLE && !item->IsConnectable() )
567 continue;
568 else if( aGrid == GRID_GRAPHICS && item->IsConnectable() )
569 continue;
570 }
571
572 double dist = a.Distance( aPos );
573
574 if( dist < minDist )
575 {
576 minDist = dist;
577 best = &a;
578 }
579 }
580
581 return best;
582}
constexpr EDA_IU_SCALE schIUScale
Definition base_units.h:123
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
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:96
virtual VECTOR2I GetPosition() const
Definition eda_item.h:282
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:108
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:82
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:101
virtual double ViewGetLOD(int aLayer, const VIEW *aView) const
Return the level of detail (LOD) of the item.
Definition view_item.h:151
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:63
double GetScale() const
Definition view.h:281
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition view.cpp:300
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition view.cpp:404
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:487
std::pair< VIEW_ITEM *, int > LAYER_ITEM_PAIR
Definition view.h:67
bool IsVisible(const VIEW_ITEM *aItem) const
Return information if the item is visible (or not).
Definition view.cpp:1805
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
Definition view.cpp:1756
A set of SCH_ITEMs (i.e., without duplicates).
Definition sch_group.h:48
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:162
virtual bool IsConnectable() const
Definition sch_item.h:524
bool IsPrivate() const
Definition sch_item.h:248
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition sch_item.h:539
Segment description base class to describe items which have 2 end points (track, wire,...
Definition sch_line.h:38
VECTOR2I GetEndPoint() const
Definition sch_line.h:144
VECTOR2I GetStartPoint() const
Definition sch_line.h:135
virtual void Add(EDA_ITEM *aItem)
Definition selection.cpp:38
EDA_ITEM * Front() const
Definition selection.h:173
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:279
#define SNAP_RANGE
@ FRAME_SCH_SYMBOL_EDITOR
Definition frame_type.h:31
GRID_HELPER_GRIDS
Definition grid_helper.h:40
@ GRID_TEXT
Definition grid_helper.h:47
@ GRID_CURRENT
Definition grid_helper.h:42
@ GRID_GRAPHICS
Definition grid_helper.h:48
@ GRID_CONNECTABLE
Definition grid_helper.h:44
@ GRID_WIRES
Definition grid_helper.h:45
@ LAYER_SCHEMATIC_ANCHOR
Definition layer_ids.h:498
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:79
@ GEOMETRY
Position or shape has changed.
Definition view_item.h:51
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:35
double Distance(const VECTOR2I &aP) const
KIBIS_PIN * pin
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:171
@ SCH_GROUP_T
Definition typeinfo.h:170
@ SCH_TABLE_T
Definition typeinfo.h:162
@ SCH_LINE_T
Definition typeinfo.h:160
@ LIB_SYMBOL_T
Definition typeinfo.h:145
@ SCH_NO_CONNECT_T
Definition typeinfo.h:157
@ SCH_SYMBOL_T
Definition typeinfo.h:169
@ SCH_TABLECELL_T
Definition typeinfo.h:163
@ SCH_FIELD_T
Definition typeinfo.h:147
@ SCH_DIRECTIVE_LABEL_T
Definition typeinfo.h:168
@ SCH_LABEL_T
Definition typeinfo.h:164
@ SCH_SHEET_T
Definition typeinfo.h:172
@ SCH_SHAPE_T
Definition typeinfo.h:146
@ SCH_RULE_AREA_T
Definition typeinfo.h:167
@ SCH_HIER_LABEL_T
Definition typeinfo.h:166
@ SCH_BUS_BUS_ENTRY_T
Definition typeinfo.h:159
@ SCH_SHEET_PIN_T
Definition typeinfo.h:171
@ SCH_TEXT_T
Definition typeinfo.h:148
@ SCH_BUS_WIRE_ENTRY_T
Definition typeinfo.h:158
@ SCH_BITMAP_T
Definition typeinfo.h:161
@ SCH_TEXTBOX_T
Definition typeinfo.h:149
@ SCH_GLOBAL_LABEL_T
Definition typeinfo.h:165
@ SCH_JUNCTION_T
Definition typeinfo.h:156
@ SCH_PIN_T
Definition typeinfo.h:150
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683
VECTOR2< double > VECTOR2D
Definition vector2d.h:682