KiCad PCB EDA Suite
ee_grid_helper.h
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 (C) 2021 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#ifndef EE_GRID_HELPER_H
27#define EE_GRID_HELPER_H
28
29#include <math/vector2d.h>
30#include <origin_viewitem.h>
31#include <tool/grid_helper.h>
32#include <ee_selection.h>
33
34class SCH_ITEM;
35
36
38{
42};
43
44
46{
47public:
48
49 EE_GRID_HELPER( TOOL_MANAGER* aToolMgr );
50
58 SCH_ITEM* GetSnapped() const;
59
60 VECTOR2I BestDragOrigin( const VECTOR2I& aMousePos, int aLayer, const EE_SELECTION& aItems );
61
62 VECTOR2I BestSnapAnchor( const VECTOR2I& aOrigin, int aLayer, SCH_ITEM* aDraggedItem );
63 VECTOR2I BestSnapAnchor( const VECTOR2I& aOrigin, int aLayer, const EE_SELECTION& aSkip = {} );
64
65private:
66 std::set<SCH_ITEM*> queryVisible( const BOX2I& aArea, const EE_SELECTION& aSkipList ) const;
67
68 ANCHOR* nearestAnchor( const VECTOR2I& aPos, int aFlags, int aMatchLayer );
69
79 void computeAnchors( SCH_ITEM* aItem, const VECTOR2I& aRefPos, bool aFrom = false,
80 bool aIncludeText = false );
81};
82
83#endif
VECTOR2I BestSnapAnchor(const VECTOR2I &aOrigin, int aLayer, SCH_ITEM *aDraggedItem)
std::set< SCH_ITEM * > queryVisible(const BOX2I &aArea, const EE_SELECTION &aSkipList) const
SCH_ITEM * GetSnapped() const
Function GetSnapped If the EE_GRID_HELPER has highlighted a snap point (target shown),...
VECTOR2I BestDragOrigin(const VECTOR2I &aMousePos, int aLayer, const EE_SELECTION &aItems)
EE_GRID_HELPER(TOOL_MANAGER *aToolMgr)
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,...
ANCHOR * nearestAnchor(const VECTOR2I &aPos, int aFlags, int aMatchLayer)
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
Master controller class:
Definition: tool_manager.h:55
EE_GRID_HELPER_LAYERS
@ LAYER_ANY
@ LAYER_CONNECTABLE
@ LAYER_GRAPHICS
@ SCH_LAYER_ID_END
Definition: layer_ids.h:388