KiCad PCB EDA Suite
layer_item_2d.h
Go to the documentation of this file.
1 
2 /*
3  * This program source code file is part of KiCad, a free EDA CAD application.
4  *
5  * Copyright (C) 2015-2016 Mario Luzeiro <[email protected]>
6  * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
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 
30 #ifndef _LAYER_ITEM_2D_H_
31 #define _LAYER_ITEM_2D_H_
32 
33 #include "object_2d.h"
34 #include <vector>
35 
36 struct RAYSEG2D;
37 
38 #define CSGITEM_EMPTY 0
39 #define CSGITEM_FULL (OBJECT_2D*) ( ( size_t )( -1 ) )
40 
79 class LAYER_ITEM_2D : public OBJECT_2D
80 {
81 public:
82  LAYER_ITEM_2D( const OBJECT_2D* aObjectA, std::vector<const OBJECT_2D*>* aObjectB,
83  const OBJECT_2D* aObjectC, const BOARD_ITEM& aBoardItem );
84 
86 
87  // Imported from OBJECT_2D
88  bool Overlaps( const BBOX_2D& aBBox ) const override;
89  bool Intersects( const BBOX_2D& aBBox ) const override;
90  bool Intersect( const RAYSEG2D& aSegRay, float* aOutT, SFVEC2F* aNormalOut ) const override;
91  INTERSECTION_RESULT IsBBoxInside( const BBOX_2D& aBBox ) const override;
92  bool IsPointInside( const SFVEC2F& aPoint ) const override;
93 
94 private:
96  std::vector<const OBJECT_2D*>* m_objectB;
98 };
99 
100 #endif // _LAYER_ITEM_2D_H_
const OBJECT_2D * m_objectA
Definition: layer_item_2d.h:95
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
glm::vec2 SFVEC2F
Definition: xv3d_types.h:42
INTERSECTION_RESULT
Definition: object_2d.h:36
const OBJECT_2D * m_objectC
Definition: layer_item_2d.h:97
bool Overlaps(const BBOX_2D &aBBox) const override
Test if the box overlaps the object.
Manage a bounding box defined by two SFVEC2F min max points.
Definition: bbox_2d.h:41
std::vector< const OBJECT_2D * > * m_objectB
Definition: layer_item_2d.h:96
INTERSECTION_RESULT IsBBoxInside(const BBOX_2D &aBBox) const override
Test this object if it's completely outside, intersects, or is completely inside aBBox.
Make solid geometry for objects on layers.
Definition: layer_item_2d.h:79
bool Intersects(const BBOX_2D &aBBox) const override
a.Intersects(b) ⇔ !a.Disjoint(b) ⇔ !(a ∩ b = ∅)
bool IsPointInside(const SFVEC2F &aPoint) const override
bool Intersect(const RAYSEG2D &aSegRay, float *aOutT, SFVEC2F *aNormalOut) const override
LAYER_ITEM_2D(const OBJECT_2D *aObjectA, std::vector< const OBJECT_2D * > *aObjectB, const OBJECT_2D *aObjectC, const BOARD_ITEM &aBoardItem)
Definition: ray.h:105