/
DrawViewPart.h
170 lines (135 loc) · 6.46 KB
/
DrawViewPart.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/***************************************************************************
* Copyright (c) Jürgen Riegel (juergen.riegel@web.de) 2007 *
* Copyright (c) Luke Parry (l.parry@warwick.ac.uk) 2013 *
* Copyright (c) WandererFan (wandererfan@gmail.com) 2016 *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef _DrawViewPart_h_
#define _DrawViewPart_h_
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <App/DocumentObject.h>
#include <App/PropertyLinks.h>
#include <App/PropertyStandard.h>
#include <App/FeaturePython.h>
#include <Base/BoundBox.h>
#include "DrawView.h"
#include "DrawProjectSplit.h"
class gp_Pnt;
namespace TechDrawGeometry
{
class GeometryObject;
class Vertex;
class BaseGeom;
class Face;
}
namespace TechDraw {
class DrawHatch;
}
namespace TechDraw
{
class DrawViewSection;
class TechDrawExport DrawViewPart : public DrawView
{
PROPERTY_HEADER(TechDraw::DrawViewPart);
public:
DrawViewPart(void);
virtual ~DrawViewPart();
App::PropertyLink Source; //Part Feature
App::PropertyVector Direction; //TODO: Rename to YAxisDirection or whatever this actually is (ProjectionDirection)
App::PropertyBool SeamVisible;
App::PropertyBool SmoothVisible;
//App::PropertyBool OutlinesVisible;
App::PropertyBool IsoVisible;
App::PropertyBool HardHidden;
App::PropertyBool SmoothHidden;
App::PropertyBool SeamHidden;
//App::PropertyBool OutlinesHidden;
App::PropertyBool IsoHidden;
App::PropertyInteger IsoCount;
App::PropertyFloat LineWidth;
App::PropertyFloat HiddenWidth;
App::PropertyFloat IsoWidth;
App::PropertyBool ArcCenterMarks;
App::PropertyFloat CenterScale;
App::PropertyBool HorizCenterLine;
App::PropertyBool VertCenterLine;
App::PropertyBool ShowSectionLine;
std::vector<TechDraw::DrawHatch*> getHatches(void) const;
//TODO: are there use-cases for Python access to TechDrawGeometry???
const std::vector<TechDrawGeometry::Vertex *> & getVertexGeometry() const;
const std::vector<TechDrawGeometry::BaseGeom *> & getEdgeGeometry() const;
const std::vector<TechDrawGeometry::BaseGeom *> getVisibleFaceEdges() const;
const std::vector<TechDrawGeometry::Face *> & getFaceGeometry() const;
bool hasGeometry(void) const;
TechDrawGeometry::BaseGeom* getProjEdgeByIndex(int idx) const; //get existing geom for edge idx in projection
TechDrawGeometry::Vertex* getProjVertexByIndex(int idx) const; //get existing geom for vertex idx in projection
std::vector<TechDrawGeometry::BaseGeom*> getProjFaceByIndex(int idx) const; //get edges for face idx in projection
virtual Base::BoundBox3d getBoundingBox() const;
double getBoxX(void) const;
double getBoxY(void) const;
virtual QRectF getRect() const;
virtual std::vector<DrawViewSection*> getSectionRefs() const; //are there ViewSections based on this ViewPart?
const Base::Vector3d& getUDir(void) const {return uDir;} //paperspace X
const Base::Vector3d& getVDir(void) const {return vDir;} //paperspace Y
const Base::Vector3d& getWDir(void) const {return wDir;} //paperspace Z
const Base::Vector3d& getCentroid(void) const {return shapeCentroid;}
Base::Vector3d projectPoint(const Base::Vector3d& pt) const;
virtual gp_Ax2 getViewAxis(const Base::Vector3d& pt,
const Base::Vector3d& direction,
const bool flip=true) const;
virtual short mustExecute() const;
bool handleFaces(void);
bool showSectionEdges(void);
/** @name methods overide Feature */
//@{
/// recalculate the Feature
virtual App::DocumentObjectExecReturn *execute(void);
//@}
/// returns the type name of the ViewProvider
virtual const char* getViewProviderName(void) const {
return "TechDrawGui::ViewProviderViewPart";
}
//return PyObject as DrawViewPartPy
virtual PyObject *getPyObject(void);
bool isDeleting(void) { return nowDeleting; }
protected:
TechDrawGeometry::GeometryObject *geometryObject;
Base::BoundBox3d bbox;
void onChanged(const App::Property* prop);
virtual void unsetupObject();
virtual TechDrawGeometry::GeometryObject* buildGeometryObject(TopoDS_Shape shape, gp_Ax2 viewAxis);
void extractFaces();
//Projection parameter space
virtual void saveParamSpace(const Base::Vector3d& direction, const Base::Vector3d& xAxis=Base::Vector3d(0.0,0.0,0.0));
Base::Vector3d uDir; //paperspace X
Base::Vector3d vDir; //paperspace Y
Base::Vector3d wDir; //paperspace Z
Base::Vector3d shapeCentroid;
void getRunControl(void);
bool m_sectionEdges;
bool m_handleFaces;
private:
bool nowDeleting;
};
typedef App::FeaturePythonT<DrawViewPart> DrawViewPartPython;
} //namespace TechDraw
#endif // #ifndef _DrawViewPart_h_