KiCad PCB EDA Suite
Loading...
Searching...
No Matches
shape_null.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2020 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 * @author Tomasz Wlostowski <[email protected]>
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
26#ifndef __SHAPE_NULL_H
27#define __SHAPE_NULL_H
28
29#include <geometry/shape.h>
30#include <math/box2.h>
31#include <math/vector2d.h>
32
33#include <algorithm>
34
35class SHAPE_NULL : public SHAPE
36{
37public:
39 SHAPE( SH_NULL )
40 {}
41
42 SHAPE_NULL( const SHAPE_NULL& aOther ) :
43 SHAPE( SH_NULL )
44 {};
45
47 {}
48
49 SHAPE* Clone() const override
50 {
51 return new SHAPE_NULL( *this );
52 }
53
54 SHAPE_NULL& operator=( const SHAPE_NULL& ) = default;
55
56 const BOX2I BBox( int aClearance = 0 ) const override
57 {
58 return BOX2I();
59 }
60
61 bool Collide( const SEG& aSeg, int aClearance = 0, int* aActual = nullptr,
62 VECTOR2I* aLocation = nullptr ) const override
63 {
64 return false;
65 }
66
67 void Move( const VECTOR2I& aVector ) override
68 {
69 }
70
71 void Rotate( const EDA_ANGLE& aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override
72 {
73 }
74
75 bool IsSolid() const override
76 {
77 return false;
78 }
79
80 void TransformToPolygon( SHAPE_POLY_SET& aBuffer, int aError,
81 ERROR_LOC aErrorLoc ) const override {}
82};
83
84#endif
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
Definition: approximation.h:32
BOX2< VECTOR2I > BOX2I
Definition: box2.h:922
Definition: seg.h:42
bool IsSolid() const override
Definition: shape_null.h:75
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Definition: shape_null.h:71
bool Collide(const SEG &aSeg, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if the boundary of shape (this) lies closer to the segment aSeg than aClearance,...
Definition: shape_null.h:61
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
Definition: shape_null.h:56
void Move(const VECTOR2I &aVector) override
Definition: shape_null.h:67
void TransformToPolygon(SHAPE_POLY_SET &aBuffer, int aError, ERROR_LOC aErrorLoc) const override
Fills a SHAPE_POLY_SET with a polygon representation of this shape.
Definition: shape_null.h:80
SHAPE * Clone() const override
Return a dynamically allocated copy of the shape.
Definition: shape_null.h:49
SHAPE_NULL(const SHAPE_NULL &aOther)
Definition: shape_null.h:42
SHAPE_NULL & operator=(const SHAPE_NULL &)=default
Represent a set of closed polygons.
An abstract shape on 2D plane.
Definition: shape.h:126
@ SH_NULL
empty shape (no shape...),
Definition: shape.h:55