2017-02-28 03:04:44 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014 CERN
|
2022-08-23 10:57:07 +00:00
|
|
|
* Copyright (C) 2017-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
2021-01-27 22:15:38 +00:00
|
|
|
*
|
2017-02-28 03:04:44 +00:00
|
|
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PCB_SELECTION_CONDITIONS_H_
|
|
|
|
#define PCB_SELECTION_CONDITIONS_H_
|
|
|
|
|
|
|
|
#include <tool/selection.h>
|
|
|
|
#include <tool/selection_conditions.h>
|
2021-07-14 20:03:32 +00:00
|
|
|
#include <eda_shape.h>
|
2017-02-28 03:04:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
class PCB_SELECTION_CONDITIONS : public SELECTION_CONDITIONS
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Create a functor that tests if selection contains items belonging to the same net or are
|
2017-02-28 03:04:44 +00:00
|
|
|
* unconnected if aAllowUnconnected == true.
|
2021-01-27 22:15:38 +00:00
|
|
|
*
|
2017-02-28 03:04:44 +00:00
|
|
|
* @param aAllowUnconnected determines if unconnected items (with no net code assigned) should
|
2021-01-27 22:15:38 +00:00
|
|
|
* be treated as connected to the same net.
|
2017-02-28 03:04:44 +00:00
|
|
|
* @return Functor testing if selected items are belonging to the same net.
|
|
|
|
*/
|
|
|
|
static SELECTION_CONDITION SameNet( bool aAllowUnconnected = false );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a functor that tests if selection contains items that belong exclusively to the same
|
2021-01-27 22:15:38 +00:00
|
|
|
* layer.
|
|
|
|
*
|
|
|
|
* In case of items belonging to multiple layers, it is enough to have a single common layer
|
|
|
|
* with other items.
|
|
|
|
*
|
2017-02-28 03:04:44 +00:00
|
|
|
* @return Functor testing if selected items share at least one common layer.
|
|
|
|
*/
|
|
|
|
static SELECTION_CONDITION SameLayer();
|
|
|
|
|
|
|
|
private:
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Helper function used by SameNet()
|
2017-02-28 03:04:44 +00:00
|
|
|
static bool sameNetFunc( const SELECTION& aSelection, bool aAllowUnconnected );
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Helper function used by SameLayer()
|
2017-02-28 03:04:44 +00:00
|
|
|
static bool sameLayerFunc( const SELECTION& aSelection );
|
2018-11-13 13:30:56 +00:00
|
|
|
|
2017-02-28 03:04:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* PCB_SELECTION_CONDITIONS_H_ */
|