Debian Codegraph @

src/App/Part.h

raw
1 /***************************************************************************
2 * Copyright (c) 2014 Jürgen Riegel <[email protected]> *
3 * *
4 * This file is part of the FreeCAD CAx development system. *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Library General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2 of the License, or (at your option) any later version. *
10 * *
11 * This library 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 Library General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Library General Public *
17 * License along with this library; see the file COPYING.LIB. If not, *
18 * write to the Free Software Foundation, Inc., 59 Temple Place, *
19 * Suite 330, Boston, MA 02111-1307, USA *
20 * *
21 ***************************************************************************/
22
23
24 #ifndef APP_Part_H
25 #define APP_Part_H
26
27 #include "GeoFeature.h"
28 #include "OriginGroupExtension.h"
29 #include "PropertyLinks.h"
30
31
32 namespace App
33 {
34
35
36 /** Base class of all geometric document objects.
37 */
38 class AppExport Part: public App::GeoFeature, public App::OriginGroupExtension
39 {
40 PROPERTY_HEADER_WITH_EXTENSIONS(App::Part);
41
42 public:
43 /// type of the part
44 PropertyString Type;
45
46 /** @name base properties of all Assembly Items
47 * These properties correspond mostly to the meta information
48 * in the App::Document class
49 */
50 //@{
51 /// Id e.g. Part number
52 App::PropertyString Id;
53 /// unique identifier of the Item
54 App::PropertyUUID Uid;
55 /// material descriptions
56 App::PropertyLink Material;
57 /// Meta descriptions
58 App::PropertyMap Meta;
59
60 /** License string
61 * Holds the short license string for the Item, e.g. CC-BY
62 * for the Creative Commons license suit.
63 */
64 App::PropertyString License;
65 /// License description/contract URL
66 App::PropertyString LicenseURL;
67 //@}
68
69 /** @name Visual properties */
70 //@{
71 /** Base color of the Item
72 If the transparency value is 1.0
73 the color or the next hierarchy is used
74 */
75 App::PropertyColor Color;
76 //@}
77
78 /// Constructor
79 Part();
80 ~Part() override;
81
82 /// returns the type name of the ViewProvider
83 const char* getViewProviderName() const override
84 {
85 return "Gui::ViewProviderPart";
86 }
87
88
89 void handleChangedPropertyType(Base::XMLReader& reader,
90 const char* TypeName,
91 App::Property* prop) override;
92
93 /**
94 * Returns the part which contains this object.
95 * In case this object does not belong to any Part, 0 is returned.
96 * @param obj the object to search for
97 * @param recursive: whether to recursively find any grand parent Part container
98 */
99 static App::Part* getPartOfObject(const DocumentObject* obj, bool recursive = true);
100
101 PyObject* getPyObject() override;
102 };
103
104 // using PartPython = App::FeaturePythonT<Part>;
105
106 } // namespace App
107
108
109 #endif // APP_Part_H