KiCad PCB EDA Suite
Loading...
Searching...
No Matches
teardrop_parameters.cpp
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) 2021 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include "teardrop_parameters.h"
26
27#define TARGET_NAME_ROUND "td_round_shape"
28#define TARGET_NAME_RECT "td_rect_shape"
29#define TARGET_NAME_TRACK "td_track_end"
30
32{
33 // return the canonical name of the target aTdType
34 std::string name;
35
36 switch( aTdType )
37 {
38 case TARGET_ROUND: name = TARGET_NAME_ROUND; break;
39 case TARGET_RECT: name = TARGET_NAME_RECT; break;
40 case TARGET_TRACK: name = TARGET_NAME_TRACK; break;
41 default: break;
42 }
43
44 return name;
45}
46
47
48TARGET_TD GetTeardropTargetTypeFromCanonicalName( const std::string& aTargetName )
49{
50 // return the target type from the canonical name
51
52 if( aTargetName == TARGET_NAME_ROUND )
53 return TARGET_ROUND;
54
55 if( aTargetName == TARGET_NAME_RECT )
56 return TARGET_RECT;
57
58 if( aTargetName == TARGET_NAME_TRACK )
59 return TARGET_TRACK;
60
61 return TARGET_UNKNOWN;
62}
const char * name
Definition: DXF_plotter.cpp:57
#define TARGET_NAME_TRACK
std::string GetTeardropTargetCanonicalName(TARGET_TD aTdType)
TARGET_TD GetTeardropTargetTypeFromCanonicalName(const std::string &aTargetName)
#define TARGET_NAME_RECT
#define TARGET_NAME_ROUND
@ TARGET_UNKNOWN
@ TARGET_ROUND
@ TARGET_RECT
@ TARGET_TRACK