Hatch View Faces
This commit is contained in:
@@ -52,9 +52,8 @@ DrawHatch::DrawHatch(void)
|
||||
{
|
||||
static const char *vgroup = "Hatch";
|
||||
|
||||
ADD_PROPERTY_TYPE(PartView, (0), vgroup, (App::PropertyType)(App::Prop_None), "Parent view feature");
|
||||
ADD_PROPERTY_TYPE(DirProjection ,(0,0,1.0) ,vgroup,App::Prop_None,"Projection direction when Hatch was defined"); //sb RO?
|
||||
ADD_PROPERTY_TYPE(Edges,(0,0),vgroup,(App::PropertyType)(App::Prop_None),"The outline of the hatch area");
|
||||
ADD_PROPERTY_TYPE(Source,(0),vgroup,(App::PropertyType)(App::Prop_None),"The View + Face to be hatched");
|
||||
ADD_PROPERTY_TYPE(HatchPattern ,(""),vgroup,App::Prop_None,"The hatch pattern file for this area");
|
||||
ADD_PROPERTY_TYPE(HatchColor,(0.0f,0.0f,0.0f),vgroup,App::Prop_None,"The color of the hatch area");
|
||||
|
||||
@@ -79,15 +78,14 @@ DrawHatch::~DrawHatch()
|
||||
|
||||
void DrawHatch::onChanged(const App::Property* prop)
|
||||
{
|
||||
if (prop == &PartView ||
|
||||
prop == &Edges ||
|
||||
if (prop == &Source ||
|
||||
prop == &HatchPattern ||
|
||||
prop == &HatchColor) {
|
||||
if (!isRestoring()) {
|
||||
DrawHatch::execute();
|
||||
if (PartView.getValue()) {
|
||||
PartView.getValue()->touch();
|
||||
PartView.getValue()->recompute();
|
||||
if (getSourceView()) {
|
||||
getSourceView()->touch();
|
||||
getSourceView()->recompute();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,9 +95,20 @@ void DrawHatch::onChanged(const App::Property* prop)
|
||||
App::DocumentObjectExecReturn *DrawHatch::execute(void)
|
||||
{
|
||||
//TODO: need to refresh DrawViewPart to reflect change in hatch
|
||||
DrawViewPart* parent = getSourceView();
|
||||
if (parent) {
|
||||
parent->touch();
|
||||
}
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
|
||||
DrawViewPart* DrawHatch::getSourceView(void) const
|
||||
{
|
||||
App::DocumentObject* obj = Source.getValue();
|
||||
DrawViewPart* result = dynamic_cast<DrawViewPart*>(obj);
|
||||
return result;
|
||||
}
|
||||
|
||||
PyObject *DrawHatch::getPyObject(void)
|
||||
{
|
||||
if (PythonObject.is(Py::_None())) {
|
||||
|
||||
@@ -42,9 +42,8 @@ public:
|
||||
DrawHatch();
|
||||
virtual ~DrawHatch();
|
||||
|
||||
App::PropertyLink PartView;
|
||||
App::PropertyVector DirProjection; //edge list is only valid for original projection?
|
||||
App::PropertyLinkSubList Edges;
|
||||
App::PropertyVector DirProjection; //Source is only valid for original projection?
|
||||
App::PropertyLinkSub Source; //the dvp & face this hatch belongs to
|
||||
App::PropertyFile HatchPattern;
|
||||
App::PropertyColor HatchColor;
|
||||
|
||||
@@ -57,6 +56,9 @@ public:
|
||||
}
|
||||
//return PyObject as DrawHatchPy
|
||||
virtual PyObject *getPyObject(void);
|
||||
|
||||
DrawViewPart* getSourceView(void) const;
|
||||
|
||||
protected:
|
||||
void onChanged(const App::Property* prop);
|
||||
|
||||
|
||||
@@ -581,6 +581,23 @@ TechDrawGeometry::Vertex* DrawViewPart::getProjVertexByIndex(int idx) const
|
||||
return geoms[idx];
|
||||
}
|
||||
|
||||
//! returns existing geometry of 2D Face(idx)
|
||||
//version 1 Face has 1 wire
|
||||
std::vector<TechDrawGeometry::BaseGeom*> DrawViewPart::getProjFaceByIndex(int idx) const
|
||||
{
|
||||
std::vector<TechDrawGeometry::BaseGeom*> result;
|
||||
const std::vector<TechDrawGeometry::Face *>& faces = getFaceGeometry();
|
||||
for (auto& f:faces) {
|
||||
for (auto& w:f->wires) {
|
||||
for (auto& g:w->geoms) {
|
||||
result.push_back(g);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Base::BoundBox3d DrawViewPart::getBoundingBox() const
|
||||
{
|
||||
return bbox;
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
|
||||
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;
|
||||
|
||||
short mustExecute() const;
|
||||
@@ -113,7 +113,7 @@ protected:
|
||||
double simpleMinDist(TopoDS_Shape s1, TopoDS_Shape s2);
|
||||
bool isSamePoint(TopoDS_Vertex v1, TopoDS_Vertex v2);
|
||||
int findUniqueVert(TopoDS_Vertex vx, std::vector<TopoDS_Vertex> &uniqueVert);
|
||||
int findEdgeByWalkerEdge(WalkerEdge we, std::vector<TopoDS_Vertex> uniqueVert, std::vector<TopoDS_Edge>& edges);
|
||||
int findEdgeByWalkerEdge(WalkerEdge we, std::vector<TopoDS_Vertex> uniqueVert, std::vector<TopoDS_Edge>& edges); //obs?
|
||||
|
||||
private:
|
||||
static App::PropertyFloatConstraint::Constraints floatRange;
|
||||
|
||||
Reference in New Issue
Block a user