1 /*
2  Copyright (C) 2010-2014 Kristian Duske
3 
4  This file is part of TrenchBroom.
5 
6  TrenchBroom is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  TrenchBroom is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with TrenchBroom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef TrenchBroom_HitQuery
21 #define TrenchBroom_HitQuery
22 
23 #include "Model/Hit.h"
24 #include "Model/HitFilter.h"
25 
26 namespace TrenchBroom {
27     namespace Model {
28         class EditorContext;
29 
30         class HitQuery {
31         private:
32             const Hit::List& m_hits;
33             const EditorContext* m_editorContext;
34             HitFilter* m_include;
35             HitFilter* m_exclude;
36         public:
37             HitQuery(const Hit::List& hits, const EditorContext& editorContext);
38             HitQuery(const Hit::List& hits);
39             ~HitQuery();
40 
41             HitQuery& pickable();
42             HitQuery& type(Hit::HitType type);
43             HitQuery& occluded(Hit::HitType type = Hit::AnyType);
44             HitQuery& selected();
45             HitQuery& minDistance(FloatType minDistance);
46 
47             const Hit& first() const;
48             Hit::List all() const;
49         private:
50             bool visible(const Hit& hit) const;
51         };
52     }
53 }
54 
55 #endif /* defined(TrenchBroom_HitQuery) */
56