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, see <https://www.gnu.org/licenses/>.
20 */
21
22#ifndef __SHAPE_NULL_H
23#define __SHAPE_NULL_H
24
25#include <geometry/shape.h>
26#include <math/box2.h>
27#include <math/vector2d.h>
28
29#include <algorithm>
30
31class SHAPE_NULL : public SHAPE
32{
33public:
35 SHAPE( SH_NULL )
36 {}
37
38 SHAPE_NULL( const SHAPE_NULL& aOther ) :
39 SHAPE( SH_NULL )
40 {};
41
43 {}
44
45 SHAPE* Clone() const override
46 {
47 return new SHAPE_NULL( *this );
48 }
49
50 SHAPE_NULL& operator=( const SHAPE_NULL& ) = default;
51
52 const BOX2I BBox( int aClearance = 0 ) const override
53 {
54 return BOX2I();
55 }
56
57 bool Collide( const SEG& aSeg, int aClearance = 0, int* aActual = nullptr,
58 VECTOR2I* aLocation = nullptr ) const override
59 {
60 return false;
61 }
62
63 void Move( const VECTOR2I& aVector ) override
64 {
65 }
66
67 void Rotate( const EDA_ANGLE& aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override
68 {
69 }
70
71 bool IsSolid() const override
72 {
73 return false;
74 }
75
76 void TransformToPolygon( SHAPE_POLY_SET& aBuffer, int aError,
77 ERROR_LOC aErrorLoc ) const override {}
78};
79
80#endif
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
Definition seg.h:38
bool IsSolid() const override
Definition shape_null.h:71
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Definition shape_null.h:67
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:57
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:52
void Move(const VECTOR2I &aVector) override
Definition shape_null.h:63
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:76
SHAPE * Clone() const override
Return a dynamically allocated copy of the shape.
Definition shape_null.h:45
SHAPE_NULL(const SHAPE_NULL &aOther)
Definition shape_null.h:38
SHAPE_NULL & operator=(const SHAPE_NULL &)=default
Represent a set of closed polygons.
SHAPE(SHAPE_TYPE aType)
Create an empty shape of type aType.
Definition shape.h:134
@ SH_NULL
empty shape (no shape...),
Definition shape.h:51
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683