X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fcanvas%2Fcanvas%2Flookup_table.h;h=2877f7a727b194121231a5d075a5bb55bf74bc35;hb=9a0a2a29b53a7d8b74d64039a3a594e54262ef29;hp=d56394ca589aaba482b7023da2dfe6ef677a6cd6;hpb=bcd65def7da197a6f88eb1c4adb375f2b639f783;p=ardour.git diff --git a/libs/canvas/canvas/lookup_table.h b/libs/canvas/canvas/lookup_table.h index d56394ca58..2877f7a727 100644 --- a/libs/canvas/canvas/lookup_table.h +++ b/libs/canvas/canvas/lookup_table.h @@ -1,8 +1,29 @@ +/* + Copyright (C) 2011-2013 Paul Davis + Author: Carl Hetherington + + 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, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + #ifndef __CANVAS_LOOKUP_TABLE_H__ #define __CANVAS_LOOKUP_TABLE_H__ #include #include + +#include "canvas/visibility.h" #include "canvas/types.h" class OptimizingLookupTableTest; @@ -10,55 +31,57 @@ class OptimizingLookupTableTest; namespace ArdourCanvas { class Item; -class Group; -class LookupTable +class LIBCANVAS_API LookupTable { public: - LookupTable (Group const &); - virtual ~LookupTable (); + LookupTable (Item const &); + virtual ~LookupTable (); - virtual std::vector get (Rect const &) = 0; - virtual std::vector items_at_point (Duple) const = 0; + virtual std::vector get (Rect const &) = 0; + virtual std::vector items_at_point (Duple const &) const = 0; + virtual bool has_item_at_point (Duple const & point) const = 0; protected: - - Group const & _group; + + Item const & _item; }; -class DumbLookupTable : public LookupTable +class LIBCANVAS_API DumbLookupTable : public LookupTable { public: - DumbLookupTable (Group const &); + DumbLookupTable (Item const &); - std::vector get (Rect const &); - std::vector items_at_point (Duple) const; + std::vector get (Rect const &); + std::vector items_at_point (Duple const &) const; + bool has_item_at_point (Duple const & point) const; }; -class OptimizingLookupTable : public LookupTable +class LIBCANVAS_API OptimizingLookupTable : public LookupTable { public: - OptimizingLookupTable (Group const &, int); - ~OptimizingLookupTable (); - std::vector get (Rect const &); - std::vector items_at_point (Duple) const; + OptimizingLookupTable (Item const &, int); + ~OptimizingLookupTable (); + std::vector get (Rect const &); + std::vector items_at_point (Duple const &) const; + bool has_item_at_point (Duple const & point) const; - static int default_items_per_cell; + static int default_items_per_cell; -private: + private: - void area_to_indices (Rect const &, int &, int &, int &, int &) const; - void point_to_indices (Duple, int &, int &) const; + void area_to_indices (Rect const &, int &, int &, int &, int &) const; + void point_to_indices (Duple, int &, int &) const; - friend class ::OptimizingLookupTableTest; + friend class ::OptimizingLookupTableTest; - typedef std::vector Cell; - int _items_per_cell; - int _dimension; - Duple _cell_size; - Duple _offset; - Cell** _cells; - bool _added; + typedef std::vector Cell; + int _items_per_cell; + int _dimension; + Duple _cell_size; + Duple _offset; + Cell** _cells; + bool _added; }; }