/* * This program source code file is part of KICAD, a free EDA CAD application. * * Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com * Copyright (C) 2004-2007 Kicad Developers, see change_log.txt for contributors. * * 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 COLLECTORS_H #define COLLECTORS_H /* This module contains a number of COLLECTOR implementations which are used to augment the functionality of class WinEDA_PcbFrame. */ #include "class_collector.h" #include "pcbstruct.h" // LAYER_COUNT, layer defs /** * Class COLLECTORS_GUIDE * is an abstract base class whose derivatives may be passed to a GENERAL_COLLECTOR, * telling GENERAL_COLLECTOR what should be collected (aside from HitTest()ing * and KICAD_T scanTypes[], information which are provided to the GENERAL_COLLECTOR * through attributes or arguments separately). *
* A justification for this class is to keep the structural storage details of * the program's "global preferences" or "configuration options" out of * GENERAL_COLLECTOR::Inspect(). This class carries all the necessary details * in with it to the Inspect() call. The constructors or other functions of * this class's derivatives are then the only place where knowledge of the * specific structure of the global preference storage is needed. Thus, * GENERAL_COLLECTOR::Inspect() can be kept as simple as possible, and insulated * from changes in global preference storage (and even then it is * not simple enough). *
* This class introduces the notion of layer locking.
*/
class COLLECTORS_GUIDE
{
public:
virtual ~COLLECTORS_GUIDE() {}
/**
* Function IsLayerLocked
* @return bool - true if the given layer is locked, else false.
*/
virtual bool IsLayerLocked( int layer ) const = 0;
/**
* Function IsLayerVisible
* @return bool - true if the given layer is visible, else false.
*/
virtual bool IsLayerVisible( int layer ) const = 0;
/**
* Function IgnoreLockedLayers
* @return bool - true if should ignore locked layers, else false.
*/
virtual bool IgnoreLockedLayers() const = 0;
/**
* Function IgnoredNonVisibleLayers
* @return bool - true if should ignore non-visible layers, else false.
*/
virtual bool IgnoreNonVisibleLayers() const = 0;
/**
* Function GetPreferredLayer
* @return int - the preferred layer for HitTest()ing.
*/
virtual int GetPreferredLayer() const = 0;
/**
* Function IgnorePreferredLayer
* provides wildcard behavior regarding the preferred layer.
* @return bool - true if should ignore preferred layer, else false.
*/
virtual bool IgnorePreferredLayer() const = 0;
/**
* Function IgnoreLockedItems
* @return bool - true if should ignore locked items, else false.
*/
virtual bool IgnoreLockedItems() const = 0;
/**
* Function IncludeSecondary
* determines if the secondary criteria, or 2nd choice items should be
* included.
* @return bool - true if should include, else false.
*/
virtual bool IncludeSecondary() const = 0;
/**
* Function IgnoreMTextsMarkedNoShow
* @return bool - true if MTexts marked as "no show" should be ignored.
*/
virtual bool IgnoreMTextsMarkedNoShow() const = 0;
/**
* Function IgnoreZones
* @return bool - true if should ignore zones.
virtual bool IgnoreZones() const = 0;
can simply omit from scanTypes[] TYPEZONE */
/**
* Function IgnoreMTextsOnCu
* @return bool - true if should ignore MTexts on copper layer.
*/
virtual bool IgnoreMTextsOnCopper() const = 0;
/**
* Function IgnoreMTextsOnCmp
* @return bool - true if should ignore MTexts on component layer.
*/
virtual bool IgnoreMTextsOnCmp() const = 0;
/**
* Function IgnoreModulesOnCu
* @return bool - true if should ignore MODULEs on copper layer.
*/
virtual bool IgnoreModulesOnCu() const = 0;
/**
* Function IgnoreModulesOnCmp
* @return bool - ture if should ignore MODULEs on component layer.
*/
virtual bool IgnoreModulesOnCmp() const = 0;
/**
* Function UseHitTesting
* @return bool - true if Inspect() should use BOARD_ITEM::HitTest()
* or false if Inspect() should use BOARD_ITEM::BoundsTest().
virtual bool UseHitTesting() const = 0;
*/
};
/**
* Class GENERAL_COLLECTOR
* is intended for use when the right click button is pressed, or when the
* plain "arrow" tool is in effect. This class can be used by window classes
* such as WinEDA_PcbFrame.
*
* Philosophy: this class knows nothing of the context in which a BOARD is used
* and that means it knows nothing about which layers are visible or current,
* but can handle those concerns by the SetPreferredLayer() function and the
* SetLayerMask() fuction.
*/
class GENERAL_COLLECTOR : public COLLECTOR
{
protected:
/**
* A place to hold collected objects which don't match precisely the search
* criteria, but would be acceptable if nothing else is found.
* "2nd" choice, which will be appended to the end of COLLECTOR's prime
* "list" at the end of the search.
*/
std::vector