Merge pull request #710 from wwmayer/SurfaceFilling
Surface filling task panel
This commit is contained in:
@@ -1604,13 +1604,16 @@ PyObject *PropertyStringList::getPyObject(void)
|
||||
|
||||
void PropertyStringList::setPyObject(PyObject *value)
|
||||
{
|
||||
if (PyList_Check(value)) {
|
||||
Py_ssize_t nSize = PyList_Size(value);
|
||||
if (PyString_Check(value)) {
|
||||
setValue(PyString_AsString(value));
|
||||
}
|
||||
else if (PySequence_Check(value)) {
|
||||
Py_ssize_t nSize = PySequence_Size(value);
|
||||
std::vector<std::string> values;
|
||||
values.resize(nSize);
|
||||
|
||||
for (Py_ssize_t i=0; i<nSize;++i) {
|
||||
PyObject* item = PyList_GetItem(value, i);
|
||||
PyObject* item = PySequence_GetItem(value, i);
|
||||
if (PyUnicode_Check(item)) {
|
||||
PyObject* unicode = PyUnicode_AsUTF8String(item);
|
||||
values[i] = PyString_AsString(unicode);
|
||||
@@ -1628,9 +1631,6 @@ void PropertyStringList::setPyObject(PyObject *value)
|
||||
|
||||
setValues(values);
|
||||
}
|
||||
else if (PyString_Check(value)) {
|
||||
setValue(PyString_AsString(value));
|
||||
}
|
||||
else {
|
||||
std::string error = std::string("type must be str or list of str, not ");
|
||||
error += value->ob_type->tp_name;
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
# include <Inventor/details/SoFaceDetail.h>
|
||||
# include <Inventor/details/SoLineDetail.h>
|
||||
# include <Inventor/details/SoPointDetail.h>
|
||||
# include <Inventor/errors/SoDebugError.h>
|
||||
# include <Inventor/events/SoMouseButtonEvent.h>
|
||||
# include <Inventor/nodes/SoBaseColor.h>
|
||||
# include <Inventor/nodes/SoCoordinate3.h>
|
||||
@@ -244,6 +245,7 @@ ViewProviderPartExt::ViewProviderPartExt()
|
||||
ADD_PROPERTY(PointMaterial,(mat));
|
||||
ADD_PROPERTY(LineColor,(mat.diffuseColor));
|
||||
ADD_PROPERTY(PointColor,(mat.diffuseColor));
|
||||
ADD_PROPERTY(PointColorArray, (PointColor.getValue()));
|
||||
ADD_PROPERTY(DiffuseColor,(ShapeColor.getValue()));
|
||||
ADD_PROPERTY(LineColorArray,(LineColor.getValue()));
|
||||
ADD_PROPERTY(LineWidth,(lwidth));
|
||||
@@ -273,8 +275,8 @@ ViewProviderPartExt::ViewProviderPartExt()
|
||||
nodeset = new SoBrepPointSet();
|
||||
nodeset->ref();
|
||||
|
||||
pcShapeBind = new SoMaterialBinding();
|
||||
pcShapeBind->ref();
|
||||
pcFaceBind = new SoMaterialBinding();
|
||||
pcFaceBind->ref();
|
||||
|
||||
pcLineBind = new SoMaterialBinding();
|
||||
pcLineBind->ref();
|
||||
@@ -282,6 +284,8 @@ ViewProviderPartExt::ViewProviderPartExt()
|
||||
pcLineMaterial->ref();
|
||||
LineMaterial.touch();
|
||||
|
||||
pcPointBind = new SoMaterialBinding();
|
||||
pcPointBind->ref();
|
||||
pcPointMaterial = new SoMaterial;
|
||||
pcPointMaterial->ref();
|
||||
PointMaterial.touch();
|
||||
@@ -308,8 +312,9 @@ ViewProviderPartExt::ViewProviderPartExt()
|
||||
|
||||
ViewProviderPartExt::~ViewProviderPartExt()
|
||||
{
|
||||
pcShapeBind->unref();
|
||||
pcFaceBind->unref();
|
||||
pcLineBind->unref();
|
||||
pcPointBind->unref();
|
||||
pcLineMaterial->unref();
|
||||
pcPointMaterial->unref();
|
||||
pcLineStyle->unref();
|
||||
@@ -391,7 +396,7 @@ void ViewProviderPartExt::onChanged(const App::Property* prop)
|
||||
setHighlightedFaces(DiffuseColor.getValues());
|
||||
}
|
||||
else if (prop == &ShapeMaterial || prop == &ShapeColor) {
|
||||
pcShapeBind->value = SoMaterialBinding::OVERALL;
|
||||
pcFaceBind->value = SoMaterialBinding::OVERALL;
|
||||
ViewProviderGeometryObject::onChanged(prop);
|
||||
DiffuseColor.setValue(ShapeColor.getValue());
|
||||
}
|
||||
@@ -400,7 +405,7 @@ void ViewProviderPartExt::onChanged(const App::Property* prop)
|
||||
long value = (long)(100*Mat.transparency);
|
||||
if (value != Transparency.getValue()) {
|
||||
float trans = Transparency.getValue()/100.0f;
|
||||
if (pcShapeBind->value.getValue() == SoMaterialBinding::PER_PART) {
|
||||
if (pcFaceBind->value.getValue() == SoMaterialBinding::PER_PART) {
|
||||
int cnt = pcShapeMaterial->diffuseColor.getNum();
|
||||
pcShapeMaterial->transparency.setNum(cnt);
|
||||
float *t = pcShapeMaterial->transparency.startEditing();
|
||||
@@ -480,7 +485,7 @@ void ViewProviderPartExt::attach(App::DocumentObject *pcFeat)
|
||||
|
||||
// just faces with no edges or points
|
||||
pcFlatRoot->addChild(pShapeHints);
|
||||
pcFlatRoot->addChild(pcShapeBind);
|
||||
pcFlatRoot->addChild(pcFaceBind);
|
||||
pcFlatRoot->addChild(pcShapeMaterial);
|
||||
SoDrawStyle* pcFaceStyle = new SoDrawStyle();
|
||||
pcFaceStyle->style = SoDrawStyle::FILLED;
|
||||
@@ -494,6 +499,7 @@ void ViewProviderPartExt::attach(App::DocumentObject *pcFeat)
|
||||
pcWireframeRoot->addChild(pcPointsRoot);
|
||||
|
||||
// normal viewing with edges and points
|
||||
pcPointsRoot->addChild(pcPointBind);
|
||||
pcPointsRoot->addChild(pcPointMaterial);
|
||||
pcPointsRoot->addChild(pcPointStyle);
|
||||
pcPointsRoot->addChild(nodeset);
|
||||
@@ -643,7 +649,7 @@ void ViewProviderPartExt::setHighlightedFaces(const std::vector<App::Color>& col
|
||||
{
|
||||
int size = static_cast<int>(colors.size());
|
||||
if (size > 1 && size == this->faceset->partIndex.getNum()) {
|
||||
pcShapeBind->value = SoMaterialBinding::PER_PART;
|
||||
pcFaceBind->value = SoMaterialBinding::PER_PART;
|
||||
pcShapeMaterial->diffuseColor.setNum(size);
|
||||
pcShapeMaterial->transparency.setNum(size);
|
||||
SbColor* ca = pcShapeMaterial->diffuseColor.startEditing();
|
||||
@@ -656,7 +662,7 @@ void ViewProviderPartExt::setHighlightedFaces(const std::vector<App::Color>& col
|
||||
pcShapeMaterial->transparency.finishEditing();
|
||||
}
|
||||
else if (colors.size() == 1) {
|
||||
pcShapeBind->value = SoMaterialBinding::OVERALL;
|
||||
pcFaceBind->value = SoMaterialBinding::OVERALL;
|
||||
pcShapeMaterial->diffuseColor.setValue(colors[0].r, colors[0].g, colors[0].b);
|
||||
//pcShapeMaterial->transparency = colors[0].a; do not get transparency from DiffuseColor in this case
|
||||
}
|
||||
@@ -666,7 +672,7 @@ void ViewProviderPartExt::setHighlightedFaces(const std::vector<App::Material>&
|
||||
{
|
||||
int size = static_cast<int>(colors.size());
|
||||
if (size > 1 && size == this->faceset->partIndex.getNum()) {
|
||||
pcShapeBind->value = SoMaterialBinding::PER_PART;
|
||||
pcFaceBind->value = SoMaterialBinding::PER_PART;
|
||||
|
||||
pcShapeMaterial->diffuseColor.setNum(size);
|
||||
pcShapeMaterial->ambientColor.setNum(size);
|
||||
@@ -691,7 +697,7 @@ void ViewProviderPartExt::setHighlightedFaces(const std::vector<App::Material>&
|
||||
pcShapeMaterial->emissiveColor.finishEditing();
|
||||
}
|
||||
else if (colors.size() == 1) {
|
||||
pcShapeBind->value = SoMaterialBinding::OVERALL;
|
||||
pcFaceBind->value = SoMaterialBinding::OVERALL;
|
||||
pcShapeMaterial->diffuseColor.setValue(colors[0].diffuseColor.r, colors[0].diffuseColor.g, colors[0].diffuseColor.b);
|
||||
pcShapeMaterial->ambientColor.setValue(colors[0].ambientColor.r, colors[0].ambientColor.g, colors[0].ambientColor.b);
|
||||
pcShapeMaterial->specularColor.setValue(colors[0].specularColor.r, colors[0].specularColor.g, colors[0].specularColor.b);
|
||||
@@ -701,7 +707,7 @@ void ViewProviderPartExt::setHighlightedFaces(const std::vector<App::Material>&
|
||||
|
||||
void ViewProviderPartExt::unsetHighlightedFaces()
|
||||
{
|
||||
ShapeMaterial.touch();
|
||||
DiffuseColor.touch();
|
||||
Transparency.touch();
|
||||
}
|
||||
|
||||
@@ -744,8 +750,14 @@ void ViewProviderPartExt::setHighlightedPoints(const std::vector<App::Color>& co
|
||||
{
|
||||
int size = static_cast<int>(colors.size());
|
||||
if (size > 1) {
|
||||
// FIXME: Check for size mismatch between number of points and number of colors
|
||||
pcShapeBind->value = SoMaterialBinding::PER_VERTEX;
|
||||
#ifdef FC_DEBUG
|
||||
int numPoints = coords->point.getNum() - nodeset->startIndex.getValue();
|
||||
if (numPoints != size) {
|
||||
SoDebugError::postWarning("ViewProviderPartExt::setHighlightedPoints",
|
||||
"The number of points (%d) doesn't match with the number of colors (%d).", numPoints, size);
|
||||
}
|
||||
#endif
|
||||
pcPointBind->value = SoMaterialBinding::PER_VERTEX;
|
||||
pcPointMaterial->diffuseColor.setNum(size);
|
||||
SbColor* ca = pcPointMaterial->diffuseColor.startEditing();
|
||||
for (int i = 0; i < size; ++i)
|
||||
@@ -753,14 +765,14 @@ void ViewProviderPartExt::setHighlightedPoints(const std::vector<App::Color>& co
|
||||
pcPointMaterial->diffuseColor.finishEditing();
|
||||
}
|
||||
else if (size == 1) {
|
||||
pcShapeBind->value = SoMaterialBinding::OVERALL;
|
||||
pcPointBind->value = SoMaterialBinding::OVERALL;
|
||||
pcPointMaterial->diffuseColor.setValue(colors[0].r, colors[0].g, colors[0].b);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewProviderPartExt::unsetHighlightedPoints()
|
||||
{
|
||||
PointMaterial.touch();
|
||||
PointColorArray.touch();
|
||||
}
|
||||
|
||||
bool ViewProviderPartExt::loadParameter()
|
||||
@@ -818,7 +830,7 @@ void ViewProviderPartExt::updateData(const App::Property* prop)
|
||||
if (!VisualTouched) {
|
||||
if (this->faceset->partIndex.getNum() >
|
||||
this->pcShapeMaterial->diffuseColor.getNum()) {
|
||||
this->pcShapeBind->value = SoMaterialBinding::OVERALL;
|
||||
this->pcFaceBind->value = SoMaterialBinding::OVERALL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,8 +145,9 @@ protected:
|
||||
TColgp_Array1OfDir& theNormals);
|
||||
|
||||
// nodes for the data representation
|
||||
SoMaterialBinding * pcShapeBind;
|
||||
SoMaterialBinding * pcFaceBind;
|
||||
SoMaterialBinding * pcLineBind;
|
||||
SoMaterialBinding * pcPointBind;
|
||||
SoMaterial * pcLineMaterial;
|
||||
SoMaterial * pcPointMaterial;
|
||||
SoDrawStyle * pcLineStyle;
|
||||
|
||||
@@ -46,42 +46,52 @@ PROPERTY_SOURCE(Surface::Filling, Part::Spline)
|
||||
|
||||
Filling::Filling()
|
||||
{
|
||||
ADD_PROPERTY_TYPE(Border,(0,""), "Filling", App::Prop_None, "Border Edges (C0 is required for edges without a corresponding face)");
|
||||
ADD_PROPERTY_TYPE(BorderFaces,(0,""), "Filling", App::Prop_None, "Border Faces");
|
||||
ADD_PROPERTY_TYPE(OrderBorderFaces,(-1), "Filling", App::Prop_None, "Order of constraint on border faces (C0, G1 and G2 are possible)");
|
||||
ADD_PROPERTY_TYPE(BoundaryEdges,(0,""), "Filling", App::Prop_None, "Boundary Edges (C0 is required for edges without a corresponding face)");
|
||||
ADD_PROPERTY_TYPE(BoundaryFaces,(""), "Filling", App::Prop_None, "Boundary Faces");
|
||||
ADD_PROPERTY_TYPE(BoundaryOrder,(-1), "Filling", App::Prop_None, "Order of constraint on boundary faces (C0, G1 and G2 are possible)");
|
||||
|
||||
ADD_PROPERTY_TYPE(Curves,(0,""), "Filling", App::Prop_None, "Other Constraint Curves (C0 is required for edges without a corresponding face)");
|
||||
ADD_PROPERTY_TYPE(CurveFaces,(0,""), "Filling", App::Prop_None, "Curve Faces");
|
||||
ADD_PROPERTY_TYPE(OrderCurveFaces,(-1), "Filling", App::Prop_None, "Order of constraint on curve faces (C0, G1 and G2 are possible)");
|
||||
ADD_PROPERTY_TYPE(UnboundEdges,(0,""), "Filling", App::Prop_None, "Unbound constraint edges (C0 is required for edges without a corresponding face)");
|
||||
ADD_PROPERTY_TYPE(UnboundFaces,(""), "Filling", App::Prop_None, "Unbound constraint faces");
|
||||
ADD_PROPERTY_TYPE(UnboundOrder,(-1), "Filling", App::Prop_None, "Order of constraint on curve faces (C0, G1 and G2 are possible)");
|
||||
|
||||
ADD_PROPERTY_TYPE(FreeFaces,(0,""), "Filling", App::Prop_None, "Free constraint on a face");
|
||||
ADD_PROPERTY_TYPE(OrderFreeFaces,(0), "Filling", App::Prop_None, "Order of constraint on free faces");
|
||||
ADD_PROPERTY_TYPE(FreeOrder,(0), "Filling", App::Prop_None, "Order of constraint on free faces");
|
||||
|
||||
ADD_PROPERTY_TYPE(Points,(0,""), "Filling", App::Prop_None, "Constraint Points (on Surface)");
|
||||
ADD_PROPERTY_TYPE(InitialFace,(0), "Filling", App::Prop_None, "Initial surface to use");
|
||||
|
||||
ADD_PROPERTY_TYPE(Degree,(3), "Filling", App::Prop_None, "Starting degree");
|
||||
ADD_PROPERTY_TYPE(PointsOnCurve,(3), "Filling", App::Prop_None, "Number of points on an edge for constraint");
|
||||
ADD_PROPERTY_TYPE(PointsOnCurve,(15), "Filling", App::Prop_None, "Number of points on an edge for constraint");
|
||||
ADD_PROPERTY_TYPE(Iterations,(2), "Filling", App::Prop_None, "Number of iterations");
|
||||
ADD_PROPERTY_TYPE(Anisotropy,(false), "Filling", App::Prop_None, "Anisotropy");
|
||||
ADD_PROPERTY_TYPE(Tolerance2d,(0.00001), "Filling", App::Prop_None, "2D Tolerance");
|
||||
ADD_PROPERTY_TYPE(Tolerance3d,(0.0001), "Filling", App::Prop_None, "3D Tolerance");
|
||||
ADD_PROPERTY_TYPE(TolAngular,(0.001), "Filling", App::Prop_None, "G1 tolerance");
|
||||
ADD_PROPERTY_TYPE(TolCurvature,(0.01), "Filling", App::Prop_None, "G2 tolerance");
|
||||
ADD_PROPERTY_TYPE(TolAngular,(0.01), "Filling", App::Prop_None, "G1 tolerance");
|
||||
ADD_PROPERTY_TYPE(TolCurvature,(0.1), "Filling", App::Prop_None, "G2 tolerance");
|
||||
ADD_PROPERTY_TYPE(MaximumDegree,(8), "Filling", App::Prop_None, "Maximum curve degree");
|
||||
ADD_PROPERTY_TYPE(MaximumSegments,(10000), "Filling", App::Prop_None, "Maximum number of segments");
|
||||
ADD_PROPERTY_TYPE(MaximumSegments,(9), "Filling", App::Prop_None, "Maximum number of segments");
|
||||
|
||||
BoundaryEdges.setSize(0);
|
||||
BoundaryFaces.setSize(0);
|
||||
BoundaryOrder.setSize(0);
|
||||
UnboundEdges.setSize(0);
|
||||
UnboundFaces.setSize(0);
|
||||
UnboundOrder.setSize(0);
|
||||
FreeFaces.setSize(0);
|
||||
FreeOrder.setSize(0);
|
||||
Points.setSize(0);
|
||||
}
|
||||
|
||||
short Filling::mustExecute() const
|
||||
{
|
||||
if (Border.isTouched() ||
|
||||
BorderFaces.isTouched() ||
|
||||
OrderBorderFaces.isTouched() ||
|
||||
Curves.isTouched() ||
|
||||
CurveFaces.isTouched() ||
|
||||
OrderCurveFaces.isTouched() ||
|
||||
if (BoundaryEdges.isTouched() ||
|
||||
BoundaryFaces.isTouched() ||
|
||||
BoundaryOrder.isTouched() ||
|
||||
UnboundEdges.isTouched() ||
|
||||
UnboundFaces.isTouched() ||
|
||||
UnboundOrder.isTouched() ||
|
||||
FreeFaces.isTouched() ||
|
||||
OrderFreeFaces.isTouched() ||
|
||||
FreeOrder.isTouched() ||
|
||||
Points.isTouched() ||
|
||||
InitialFace.isTouched() ||
|
||||
Degree.isTouched() ||
|
||||
@@ -100,39 +110,61 @@ short Filling::mustExecute() const
|
||||
|
||||
void Filling::addConstraints(BRepFill_Filling& builder,
|
||||
const App::PropertyLinkSubList& edges,
|
||||
const App::PropertyLinkSubList& faces,
|
||||
const App::PropertyStringList& faces,
|
||||
const App::PropertyIntegerList& orders,
|
||||
Standard_Boolean bnd)
|
||||
{
|
||||
auto edge_obj = edges.getValues();
|
||||
auto edge_sub = edges.getSubValues();
|
||||
auto face_obj = faces.getValues();
|
||||
auto face_sub = faces.getSubValues();
|
||||
auto face_sub = faces.getValues();
|
||||
auto contvals = orders.getValues();
|
||||
|
||||
// tmp. workaround
|
||||
if (edge_obj.size() != contvals.size()) {
|
||||
contvals.resize(edge_obj.size());
|
||||
// if the number of continuities doesn't match then fall back to C0
|
||||
if (edge_sub.size() != contvals.size()) {
|
||||
contvals.resize(edge_sub.size());
|
||||
std::fill(contvals.begin(), contvals.end(), static_cast<long>(GeomAbs_C0));
|
||||
}
|
||||
|
||||
if (edge_obj.size() == edge_sub.size() &&
|
||||
edge_obj.size() == contvals.size()) {
|
||||
// if the number of faces doesn't match then fall back to empty strings
|
||||
// an empty face string indicates that there is no face associated to an edge
|
||||
if (face_sub.size() != edge_sub.size()) {
|
||||
face_sub.resize(edge_obj.size());
|
||||
std::fill(face_sub.begin(), face_sub.end(), std::string());
|
||||
}
|
||||
|
||||
if (edge_obj.size() == edge_sub.size()) {
|
||||
for (std::size_t index = 0; index < edge_obj.size(); index++) {
|
||||
// get the part object
|
||||
App::DocumentObject* obj = edge_obj[index];
|
||||
const std::string& sub = edge_sub[index];
|
||||
|
||||
if (obj && obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
// get the sub-edge of the part's shape
|
||||
const Part::TopoShape& shape = static_cast<Part::Feature*>(obj)->Shape.getShape();
|
||||
TopoDS_Shape edge = shape.getSubShape(sub.c_str());
|
||||
if (!edge.IsNull() && edge.ShapeType() == TopAbs_EDGE) {
|
||||
GeomAbs_Shape cont = static_cast<GeomAbs_Shape>(contvals[index]);
|
||||
if (cont == GeomAbs_C0) {
|
||||
|
||||
// check for an adjacent face of the edge
|
||||
std::string subFace = face_sub[index];
|
||||
|
||||
// edge doesn't have set an adjacent face
|
||||
if (subFace.empty()) {
|
||||
builder.Add(TopoDS::Edge(edge), cont, bnd);
|
||||
}
|
||||
else {
|
||||
builder.Add(TopoDS::Edge(edge), cont, bnd);
|
||||
TopoDS_Shape face = shape.getSubShape(subFace.c_str());
|
||||
if (!face.IsNull() && face.ShapeType() == TopAbs_FACE) {
|
||||
builder.Add(TopoDS::Edge(edge), TopoDS::Face(face), cont, bnd);
|
||||
}
|
||||
else {
|
||||
Standard_Failure::Raise("Sub-shape is not a face");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Standard_Failure::Raise("Sub-shape is not an edge");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,6 +173,7 @@ void Filling::addConstraints(BRepFill_Filling& builder,
|
||||
}
|
||||
}
|
||||
|
||||
// Add free support faces with their continuities
|
||||
void Filling::addConstraints(BRepFill_Filling& builder,
|
||||
const App::PropertyLinkSubList& faces,
|
||||
const App::PropertyIntegerList& orders)
|
||||
@@ -161,6 +194,9 @@ void Filling::addConstraints(BRepFill_Filling& builder,
|
||||
GeomAbs_Shape cont = static_cast<GeomAbs_Shape>(contvals[index]);
|
||||
builder.Add(TopoDS::Face(face), cont);
|
||||
}
|
||||
else {
|
||||
Standard_Failure::Raise("Sub-shape is not a face");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,7 +243,7 @@ App::DocumentObjectExecReturn *Filling::execute(void)
|
||||
BRepFill_Filling builder(degree, ptsoncurve, numIter, anisotropy, tol2d,
|
||||
tol3d, tolG1, tolG2, maxdeg, maxseg);
|
||||
|
||||
if ((Border.getSize()) < 1) {
|
||||
if ((BoundaryEdges.getSize()) < 1) {
|
||||
return new App::DocumentObjectExecReturn("Border must have at least one curve defined.");
|
||||
}
|
||||
|
||||
@@ -226,16 +262,16 @@ App::DocumentObjectExecReturn *Filling::execute(void)
|
||||
}
|
||||
|
||||
// Add the constraints of border curves/faces (bound)
|
||||
addConstraints(builder, Border, BorderFaces, OrderBorderFaces, Standard_True);
|
||||
addConstraints(builder, BoundaryEdges, BoundaryFaces, BoundaryOrder, Standard_True);
|
||||
|
||||
// Add additional curves constraints if available (unbound)
|
||||
if (Curves.getSize() > 0) {
|
||||
addConstraints(builder, Curves, CurveFaces, OrderCurveFaces, Standard_False);
|
||||
// Add additional edge constraints if available (unbound)
|
||||
if (UnboundEdges.getSize() > 0) {
|
||||
addConstraints(builder, UnboundEdges, UnboundFaces, UnboundOrder, Standard_False);
|
||||
}
|
||||
|
||||
// Add additional constraint on free faces
|
||||
if (FreeFaces.getSize() > 0) {
|
||||
addConstraints(builder, FreeFaces, OrderFreeFaces);
|
||||
addConstraints(builder, FreeFaces, FreeOrder);
|
||||
}
|
||||
|
||||
// App point constraints
|
||||
|
||||
@@ -41,14 +41,14 @@ public:
|
||||
Filling();
|
||||
|
||||
//Properties of Curves
|
||||
App::PropertyLinkSubList Border; // Border Edges (C0 is required for edges without a corresponding face)
|
||||
App::PropertyLinkSubList BorderFaces; // Border Faces (C0, G1 and G2 are possible)
|
||||
App::PropertyIntegerList OrderBorderFaces; // Order of constraint on border faces
|
||||
App::PropertyLinkSubList Curves; // Other Constraint Curves (C0 is required for edges without a corresponding face)
|
||||
App::PropertyLinkSubList CurveFaces; // Curve Faces (C0, G1 and G2 are possible)
|
||||
App::PropertyIntegerList OrderCurveFaces; // Order of constraint on curve faces
|
||||
App::PropertyLinkSubList FreeFaces; // Free constraint on a face
|
||||
App::PropertyIntegerList OrderFreeFaces; // Order of constraint on free faces
|
||||
App::PropertyLinkSubList BoundaryEdges; // Boundary Edges (C0 is required for edges without a corresponding face)
|
||||
App::PropertyStringList BoundaryFaces; // Boundary Faces (C0, G1 and G2 are possible)
|
||||
App::PropertyIntegerList BoundaryOrder; // Order of constraint on border faces
|
||||
App::PropertyLinkSubList UnboundEdges; // Unbound constraint edges (C0 is required for edges without a corresponding face)
|
||||
App::PropertyStringList UnboundFaces; // Unbound constraint faces (C0, G1 and G2 are possible)
|
||||
App::PropertyIntegerList UnboundOrder; // Order of constraint on curve faces
|
||||
App::PropertyLinkSubList FreeFaces; // Free constraint faces
|
||||
App::PropertyIntegerList FreeOrder; // Order of constraint on free faces
|
||||
App::PropertyLinkSubList Points; // Constraint Points (on Surface)
|
||||
App::PropertyLinkSub InitialFace; // Initial Face to use
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
private:
|
||||
void addConstraints(BRepFill_Filling& builder,
|
||||
const App::PropertyLinkSubList& edges,
|
||||
const App::PropertyLinkSubList& faces,
|
||||
const App::PropertyStringList& faces,
|
||||
const App::PropertyIntegerList& orders,
|
||||
Standard_Boolean bnd);
|
||||
void addConstraints(BRepFill_Filling& builder,
|
||||
|
||||
@@ -10,7 +10,7 @@ include_directories(
|
||||
${CMAKE_BINARY_DIR}/src
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${COIN3D_INCLUDE_DIR}
|
||||
${COIN3D_INCLUDE_DIRS}
|
||||
${OCC_INCLUDE_DIR}
|
||||
${PYTHON_INCLUDE_DIRS}
|
||||
${XercesC_INCLUDE_DIRS}
|
||||
@@ -25,6 +25,7 @@ set(SurfaceGui_LIBS
|
||||
|
||||
set(SurfaceGui_MOC_HDRS
|
||||
TaskFilling.h
|
||||
TaskFillingVertex.h
|
||||
TaskGeomFillSurface.h
|
||||
)
|
||||
fc_wrap_cpp(SurfaceGui_MOC_SRCS ${SurfaceGui_MOC_HDRS})
|
||||
@@ -38,6 +39,7 @@ endif()
|
||||
|
||||
SET(SurfaceGui_UIC_SRCS
|
||||
TaskFilling.ui
|
||||
TaskFillingVertex.ui
|
||||
TaskGeomFillSurface.ui
|
||||
)
|
||||
|
||||
@@ -52,6 +54,8 @@ SET(SurfaceGui_SRCS
|
||||
${SurfaceGui_UIC_HDRS}
|
||||
TaskFilling.cpp
|
||||
TaskFilling.h
|
||||
TaskFillingVertex.cpp
|
||||
TaskFillingVertex.h
|
||||
TaskGeomFillSurface.cpp
|
||||
TaskGeomFillSurface.h
|
||||
AppSurfaceGui.cpp
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2015 Balázs Bámer *
|
||||
* Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* Copyright (c) 2017 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
@@ -26,8 +25,11 @@
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
|
||||
#include <Gui/ViewProvider.h>
|
||||
#include <Gui/Application.h>
|
||||
@@ -40,6 +42,7 @@
|
||||
#include <Mod/Part/Gui/ViewProvider.h>
|
||||
|
||||
#include "TaskFilling.h"
|
||||
#include "TaskFillingVertex.h"
|
||||
#include "ui_TaskFilling.h"
|
||||
|
||||
|
||||
@@ -101,32 +104,78 @@ QIcon ViewProviderFilling::getIcon(void) const
|
||||
return Gui::BitmapFactory().pixmap("BSplineSurf");
|
||||
}
|
||||
|
||||
void ViewProviderFilling::highlightReferences(bool on)
|
||||
void ViewProviderFilling::highlightReferences(ShapeType type, const References& refs, bool on)
|
||||
{
|
||||
Surface::Filling* surface = static_cast<Surface::Filling*>(getObject());
|
||||
auto bounds = surface->Border.getSubListValues();
|
||||
for (auto it : bounds) {
|
||||
for (auto it : refs) {
|
||||
Part::Feature* base = dynamic_cast<Part::Feature*>(it.first);
|
||||
if (base) {
|
||||
PartGui::ViewProviderPartExt* svp = dynamic_cast<PartGui::ViewProviderPartExt*>(
|
||||
Gui::Application::Instance->getViewProvider(base));
|
||||
if (svp) {
|
||||
if (on) {
|
||||
std::vector<App::Color> colors;
|
||||
TopTools_IndexedMapOfShape eMap;
|
||||
TopExp::MapShapes(base->Shape.getValue(), TopAbs_EDGE, eMap);
|
||||
colors.resize(eMap.Extent(), svp->LineColor.getValue());
|
||||
switch (type) {
|
||||
case ViewProviderFilling::Vertex:
|
||||
if (on) {
|
||||
std::vector<App::Color> colors;
|
||||
TopTools_IndexedMapOfShape vMap;
|
||||
TopExp::MapShapes(base->Shape.getValue(), TopAbs_VERTEX, vMap);
|
||||
colors.resize(vMap.Extent(), svp->PointColor.getValue());
|
||||
|
||||
for (auto jt : it.second) {
|
||||
std::size_t idx = static_cast<std::size_t>(std::stoi(jt.substr(4)) - 1);
|
||||
assert (idx < colors.size());
|
||||
colors[idx] = App::Color(1.0,0.0,1.0); // magenta
|
||||
for (auto jt : it.second) {
|
||||
// check again that the index is in range because it's possible that the
|
||||
// sub-names are invalid
|
||||
std::size_t idx = static_cast<std::size_t>(std::stoi(jt.substr(6)) - 1);
|
||||
if (idx < colors.size())
|
||||
colors[idx] = App::Color(1.0,0.0,1.0); // magenta
|
||||
}
|
||||
|
||||
svp->setHighlightedPoints(colors);
|
||||
}
|
||||
else {
|
||||
svp->unsetHighlightedPoints();
|
||||
}
|
||||
break;
|
||||
case ViewProviderFilling::Edge:
|
||||
if (on) {
|
||||
std::vector<App::Color> colors;
|
||||
TopTools_IndexedMapOfShape eMap;
|
||||
TopExp::MapShapes(base->Shape.getValue(), TopAbs_EDGE, eMap);
|
||||
colors.resize(eMap.Extent(), svp->LineColor.getValue());
|
||||
|
||||
svp->setHighlightedEdges(colors);
|
||||
}
|
||||
else {
|
||||
svp->unsetHighlightedEdges();
|
||||
for (auto jt : it.second) {
|
||||
std::size_t idx = static_cast<std::size_t>(std::stoi(jt.substr(4)) - 1);
|
||||
// check again that the index is in range because it's possible that the
|
||||
// sub-names are invalid
|
||||
if (idx < colors.size())
|
||||
colors[idx] = App::Color(1.0,0.0,1.0); // magenta
|
||||
}
|
||||
|
||||
svp->setHighlightedEdges(colors);
|
||||
}
|
||||
else {
|
||||
svp->unsetHighlightedEdges();
|
||||
}
|
||||
break;
|
||||
case ViewProviderFilling::Face:
|
||||
if (on) {
|
||||
std::vector<App::Color> colors;
|
||||
TopTools_IndexedMapOfShape fMap;
|
||||
TopExp::MapShapes(base->Shape.getValue(), TopAbs_FACE, fMap);
|
||||
colors.resize(fMap.Extent(), svp->ShapeColor.getValue());
|
||||
|
||||
for (auto jt : it.second) {
|
||||
std::size_t idx = static_cast<std::size_t>(std::stoi(jt.substr(4)) - 1);
|
||||
// check again that the index is in range because it's possible that the
|
||||
// sub-names are invalid
|
||||
if (idx < colors.size())
|
||||
colors[idx] = App::Color(1.0,0.0,1.0); // magenta
|
||||
}
|
||||
|
||||
svp->setHighlightedFaces(colors);
|
||||
}
|
||||
else {
|
||||
svp->unsetHighlightedFaces();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,12 +187,16 @@ void ViewProviderFilling::highlightReferences(bool on)
|
||||
class FillingPanel::ShapeSelection : public Gui::SelectionFilterGate
|
||||
{
|
||||
public:
|
||||
ShapeSelection(FillingPanel::SelectionMode mode, Surface::Filling* editedObject)
|
||||
ShapeSelection(FillingPanel::SelectionMode& mode, Surface::Filling* editedObject)
|
||||
: Gui::SelectionFilterGate(static_cast<Gui::SelectionFilter*>(nullptr))
|
||||
, mode(mode)
|
||||
, editedObject(editedObject)
|
||||
{
|
||||
}
|
||||
~ShapeSelection()
|
||||
{
|
||||
mode = FillingPanel::None;
|
||||
}
|
||||
/**
|
||||
* Allow the user to pick only edges.
|
||||
*/
|
||||
@@ -171,7 +224,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
bool allowFace(App::DocumentObject* pObj, const char* sSubName)
|
||||
bool allowFace(App::DocumentObject*, const char* sSubName)
|
||||
{
|
||||
std::string element(sSubName);
|
||||
if (element.substr(0,4) != "Face")
|
||||
@@ -184,7 +237,7 @@ private:
|
||||
if (element.substr(0,4) != "Edge")
|
||||
return false;
|
||||
|
||||
auto links = editedObject->Border.getSubListValues();
|
||||
auto links = editedObject->BoundaryEdges.getSubListValues();
|
||||
for (auto it : links) {
|
||||
if (it.first == pObj) {
|
||||
for (auto jt : it.second) {
|
||||
@@ -198,7 +251,7 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
FillingPanel::SelectionMode mode;
|
||||
FillingPanel::SelectionMode& mode;
|
||||
Surface::Filling* editedObject;
|
||||
};
|
||||
|
||||
@@ -208,6 +261,8 @@ FillingPanel::FillingPanel(ViewProviderFilling* vp, Surface::Filling* obj)
|
||||
{
|
||||
ui = new Ui_TaskFilling();
|
||||
ui->setupUi(this);
|
||||
ui->statusLabel->clear();
|
||||
|
||||
selectionMode = None;
|
||||
this->vp = vp;
|
||||
checkCommand = true;
|
||||
@@ -216,9 +271,9 @@ FillingPanel::FillingPanel(ViewProviderFilling* vp, Surface::Filling* obj)
|
||||
// Create context menu
|
||||
QAction* action = new QAction(tr("Remove"), this);
|
||||
action->setShortcut(QString::fromLatin1("Del"));
|
||||
ui->listWidget->addAction(action);
|
||||
ui->listBoundary->addAction(action);
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(onDeleteEdge()));
|
||||
ui->listWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
ui->listBoundary->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -235,6 +290,7 @@ void FillingPanel::setEditedObject(Surface::Filling* obj)
|
||||
{
|
||||
editedObject = obj;
|
||||
|
||||
// get the link to the initial surface if set
|
||||
App::DocumentObject* initFace = editedObject->InitialFace.getValue();
|
||||
const std::vector<std::string>& subList = editedObject->InitialFace.getSubValues();
|
||||
if (initFace && subList.size() == 1) {
|
||||
@@ -244,27 +300,56 @@ void FillingPanel::setEditedObject(Surface::Filling* obj)
|
||||
ui->lineInitFaceName->setText(text);
|
||||
}
|
||||
|
||||
auto objects = editedObject->Border.getValues();
|
||||
auto element = editedObject->Border.getSubValues();
|
||||
auto it = objects.begin();
|
||||
auto jt = element.begin();
|
||||
// get the boundary edges, if set their adjacent faces and continuities
|
||||
auto objects = editedObject->BoundaryEdges.getValues();
|
||||
auto edges = editedObject->BoundaryEdges.getSubValues();
|
||||
auto count = objects.size();
|
||||
|
||||
// fill up faces if wrong size
|
||||
auto faces = editedObject->BoundaryFaces.getValues();
|
||||
if (faces.size() != edges.size()) {
|
||||
faces.resize(edges.size());
|
||||
std::fill(faces.begin(), faces.end(), std::string());
|
||||
}
|
||||
|
||||
// fill up continuities if wrong size
|
||||
auto conts = editedObject->BoundaryOrder.getValues();
|
||||
if (edges.size() != conts.size()) {
|
||||
conts.resize(edges.size());
|
||||
std::fill(conts.begin(), conts.end(), static_cast<long>(GeomAbs_C0));
|
||||
}
|
||||
|
||||
App::Document* doc = editedObject->getDocument();
|
||||
for (; it != objects.end() && jt != element.end(); ++it, ++jt) {
|
||||
QListWidgetItem* item = new QListWidgetItem(ui->listWidget);
|
||||
ui->listWidget->addItem(item);
|
||||
for (std::size_t i=0; i<count; i++) {
|
||||
App::DocumentObject* obj = objects[i];
|
||||
std::string edge = edges[i];
|
||||
std::string face = faces[i];
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem(ui->listBoundary);
|
||||
ui->listBoundary->addItem(item);
|
||||
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8((*it)->Label.getValue()))
|
||||
.arg(QString::fromStdString(*jt));
|
||||
.arg(QString::fromUtf8(obj->Label.getValue()))
|
||||
.arg(QString::fromStdString(edge));
|
||||
item->setText(text);
|
||||
|
||||
// The user data field of a list widget item
|
||||
// is a list of five elementa:
|
||||
// 1. document name
|
||||
// 2. object name
|
||||
// 3. sub-element name of the edge
|
||||
// 4. sub-element of an adjacent face or empty string
|
||||
// 5. the continuity as int
|
||||
QList<QVariant> data;
|
||||
data << QByteArray(doc->getName());
|
||||
data << QByteArray((*it)->getNameInDocument());
|
||||
data << QByteArray(jt->c_str());
|
||||
data << QByteArray(obj->getNameInDocument());
|
||||
data << QByteArray(edge.c_str());
|
||||
data << QByteArray(face.c_str());
|
||||
data << static_cast<int>(conts[i]);
|
||||
item->setData(Qt::UserRole, data);
|
||||
}
|
||||
|
||||
// attach this document observer
|
||||
attachDocument(Gui::Application::Instance->getDocument(doc));
|
||||
}
|
||||
|
||||
@@ -281,7 +366,17 @@ void FillingPanel::changeEvent(QEvent *e)
|
||||
void FillingPanel::open()
|
||||
{
|
||||
checkOpenCommand();
|
||||
this->vp->highlightReferences(true);
|
||||
|
||||
// highlight the boundary edges
|
||||
this->vp->highlightReferences(ViewProviderFilling::Edge,
|
||||
editedObject->BoundaryEdges.getSubListValues(), true);
|
||||
|
||||
// highlight the referenced face
|
||||
std::vector<App::PropertyLinkSubList::SubSet> links;
|
||||
links.push_back(std::make_pair(editedObject->InitialFace.getValue(),
|
||||
editedObject->InitialFace.getSubValues()));
|
||||
this->vp->highlightReferences(ViewProviderFilling::Face, links, true);
|
||||
|
||||
Gui::Selection().clearSelection();
|
||||
}
|
||||
|
||||
@@ -310,6 +405,22 @@ void FillingPanel::slotRedoDocument(const Gui::Document&)
|
||||
checkCommand = true;
|
||||
}
|
||||
|
||||
void FillingPanel::slotDeletedObject(const Gui::ViewProviderDocumentObject& Obj)
|
||||
{
|
||||
// If this view provider is being deleted then reset the colors of
|
||||
// referenced part objects. The dialog will be deleted later.
|
||||
if (this->vp == &Obj) {
|
||||
this->vp->highlightReferences(ViewProviderFilling::Edge,
|
||||
editedObject->BoundaryEdges.getSubListValues(), false);
|
||||
|
||||
// unhighlight the referenced face
|
||||
std::vector<App::PropertyLinkSubList::SubSet> links;
|
||||
links.push_back(std::make_pair(editedObject->InitialFace.getValue(),
|
||||
editedObject->InitialFace.getSubValues()));
|
||||
this->vp->highlightReferences(ViewProviderFilling::Face, links, false);
|
||||
}
|
||||
}
|
||||
|
||||
bool FillingPanel::accept()
|
||||
{
|
||||
selectionMode = None;
|
||||
@@ -323,23 +434,32 @@ bool FillingPanel::accept()
|
||||
return false;
|
||||
}
|
||||
|
||||
this->vp->highlightReferences(false);
|
||||
this->vp->highlightReferences(ViewProviderFilling::Edge,
|
||||
editedObject->BoundaryEdges.getSubListValues(), false);
|
||||
|
||||
// unhighlight the referenced face
|
||||
std::vector<App::PropertyLinkSubList::SubSet> links;
|
||||
links.push_back(std::make_pair(editedObject->InitialFace.getValue(),
|
||||
editedObject->InitialFace.getSubValues()));
|
||||
this->vp->highlightReferences(ViewProviderFilling::Face, links, false);
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()");
|
||||
Gui::Command::updateActive();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FillingPanel::reject()
|
||||
{
|
||||
this->vp->highlightReferences(false);
|
||||
this->vp->highlightReferences(ViewProviderFilling::Edge,
|
||||
editedObject->BoundaryEdges.getSubListValues(), false);
|
||||
|
||||
// unhighlight the referenced face
|
||||
std::vector<App::PropertyLinkSubList::SubSet> links;
|
||||
links.push_back(std::make_pair(editedObject->InitialFace.getValue(),
|
||||
editedObject->InitialFace.getSubValues()));
|
||||
this->vp->highlightReferences(ViewProviderFilling::Face, links, false);
|
||||
|
||||
selectionMode = None;
|
||||
Gui::Selection().rmvSelectionGate();
|
||||
|
||||
Gui::Command::abortCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()");
|
||||
Gui::Command::updateActive();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -347,6 +467,13 @@ void FillingPanel::on_lineInitFaceName_textChanged(const QString& text)
|
||||
{
|
||||
if (text.isEmpty()) {
|
||||
checkOpenCommand();
|
||||
|
||||
// unhighlight the referenced face
|
||||
std::vector<App::PropertyLinkSubList::SubSet> links;
|
||||
links.push_back(std::make_pair(editedObject->InitialFace.getValue(),
|
||||
editedObject->InitialFace.getSubValues()));
|
||||
this->vp->highlightReferences(ViewProviderFilling::Face, links, false);
|
||||
|
||||
editedObject->InitialFace.setValue(nullptr);
|
||||
editedObject->recomputeFeature();
|
||||
}
|
||||
@@ -354,20 +481,89 @@ void FillingPanel::on_lineInitFaceName_textChanged(const QString& text)
|
||||
|
||||
void FillingPanel::on_buttonInitFace_clicked()
|
||||
{
|
||||
selectionMode = InitFace;
|
||||
// 'selectionMode' is passed by reference and changed when the filter is deleted
|
||||
Gui::Selection().addSelectionGate(new ShapeSelection(selectionMode, editedObject));
|
||||
selectionMode = InitFace;
|
||||
}
|
||||
|
||||
void FillingPanel::on_buttonEdgeAdd_clicked()
|
||||
{
|
||||
selectionMode = AppendEdge;
|
||||
// 'selectionMode' is passed by reference and changed when the filter is deleted
|
||||
Gui::Selection().addSelectionGate(new ShapeSelection(selectionMode, editedObject));
|
||||
selectionMode = AppendEdge;
|
||||
}
|
||||
|
||||
void FillingPanel::on_buttonEdgeRemove_clicked()
|
||||
{
|
||||
selectionMode = RemoveEdge;
|
||||
// 'selectionMode' is passed by reference and changed when the filter is deleted
|
||||
Gui::Selection().addSelectionGate(new ShapeSelection(selectionMode, editedObject));
|
||||
selectionMode = RemoveEdge;
|
||||
}
|
||||
|
||||
void FillingPanel::on_listBoundary_itemDoubleClicked(QListWidgetItem* item)
|
||||
{
|
||||
Gui::Selection().clearSelection();
|
||||
Gui::Selection().rmvSelectionGate();
|
||||
selectionMode = None;
|
||||
|
||||
ui->comboBoxFaces->clear();
|
||||
ui->comboBoxCont->clear();
|
||||
|
||||
if (item) {
|
||||
QList<QVariant> data;
|
||||
data = item->data(Qt::UserRole).toList();
|
||||
|
||||
try {
|
||||
App::Document* doc = App::GetApplication().getDocument(data[0].toByteArray());
|
||||
App::DocumentObject* obj = doc ? doc->getObject(data[1].toByteArray()) : nullptr;
|
||||
if (obj && obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
const Part::TopoShape& shape = static_cast<Part::Feature*>(obj)->Shape.getShape();
|
||||
TopoDS_Shape edge = shape.getSubShape(data[2].toByteArray());
|
||||
|
||||
// build up map edge->face
|
||||
TopTools_IndexedMapOfShape faces;
|
||||
TopExp::MapShapes(shape.getShape(), TopAbs_FACE, faces);
|
||||
TopTools_IndexedDataMapOfShapeListOfShape edge2Face;
|
||||
TopExp::MapShapesAndAncestors(shape.getShape(), TopAbs_EDGE, TopAbs_FACE, edge2Face);
|
||||
const TopTools_ListOfShape& adj_faces = edge2Face.FindFromKey(edge);
|
||||
if (adj_faces.Extent() > 0) {
|
||||
int n = adj_faces.Extent();
|
||||
ui->statusLabel->setText(tr("Edge has %n adjacent face(s)", 0, n));
|
||||
|
||||
// fill up the combo boxes
|
||||
modifyBoundary(true);
|
||||
ui->comboBoxFaces->addItem(tr("None"), QByteArray(""));
|
||||
ui->comboBoxCont->addItem(QString::fromLatin1("C0"), static_cast<int>(GeomAbs_C0));
|
||||
ui->comboBoxCont->addItem(QString::fromLatin1("G1"), static_cast<int>(GeomAbs_G1));
|
||||
ui->comboBoxCont->addItem(QString::fromLatin1("G2"), static_cast<int>(GeomAbs_G2));
|
||||
TopTools_ListIteratorOfListOfShape it(adj_faces);
|
||||
for (; it.More(); it.Next()) {
|
||||
const TopoDS_Shape& F = it.Value();
|
||||
int index = faces.FindIndex(F);
|
||||
QString text = QString::fromLatin1("Face%1").arg(index);
|
||||
ui->comboBoxFaces->addItem(text, text.toLatin1());
|
||||
}
|
||||
|
||||
// activste face and continuity
|
||||
if (data.size() == 5) {
|
||||
int index = ui->comboBoxFaces->findData(data[3]);
|
||||
ui->comboBoxFaces->setCurrentIndex(index);
|
||||
index = ui->comboBoxCont->findData(data[4]);
|
||||
ui->comboBoxCont->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui->statusLabel->setText(tr("Edge has no adjacent faces"));
|
||||
}
|
||||
}
|
||||
|
||||
Gui::Selection().addSelection(data[0].toByteArray(),
|
||||
data[1].toByteArray(),
|
||||
data[2].toByteArray());
|
||||
}
|
||||
catch (...) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FillingPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
@@ -387,14 +583,18 @@ void FillingPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
std::vector<std::string> subList;
|
||||
subList.push_back(msg.pSubName);
|
||||
editedObject->InitialFace.setValue(sel.getObject(), subList);
|
||||
//this->vp->highlightReferences(true);
|
||||
|
||||
// highlight the referenced face
|
||||
std::vector<App::PropertyLinkSubList::SubSet> links;
|
||||
links.push_back(std::make_pair(sel.getObject(), subList));
|
||||
this->vp->highlightReferences(ViewProviderFilling::Face, links, true);
|
||||
|
||||
Gui::Selection().rmvSelectionGate();
|
||||
selectionMode = None;
|
||||
}
|
||||
else if (selectionMode == AppendEdge) {
|
||||
QListWidgetItem* item = new QListWidgetItem(ui->listWidget);
|
||||
ui->listWidget->addItem(item);
|
||||
QListWidgetItem* item = new QListWidgetItem(ui->listBoundary);
|
||||
ui->listBoundary->addItem(item);
|
||||
|
||||
Gui::SelectionObject sel(msg);
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
@@ -406,14 +606,31 @@ void FillingPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
data << QByteArray(msg.pDocName);
|
||||
data << QByteArray(msg.pObjectName);
|
||||
data << QByteArray(msg.pSubName);
|
||||
data << QByteArray("");
|
||||
data << static_cast<int>(GeomAbs_C0);
|
||||
item->setData(Qt::UserRole, data);
|
||||
|
||||
auto objects = editedObject->Border.getValues();
|
||||
auto objects = editedObject->BoundaryEdges.getValues();
|
||||
std::size_t count = objects.size();
|
||||
objects.push_back(sel.getObject());
|
||||
auto element = editedObject->Border.getSubValues();
|
||||
auto element = editedObject->BoundaryEdges.getSubValues();
|
||||
element.push_back(msg.pSubName);
|
||||
editedObject->Border.setValues(objects, element);
|
||||
this->vp->highlightReferences(true);
|
||||
editedObject->BoundaryEdges.setValues(objects, element);
|
||||
|
||||
// extend faces and continuities lists if needed
|
||||
auto faces = editedObject->BoundaryFaces.getValues();
|
||||
if (count == faces.size()) {
|
||||
faces.push_back(std::string());
|
||||
editedObject->BoundaryFaces.setValues(faces);
|
||||
}
|
||||
auto conts = editedObject->BoundaryOrder.getValues();
|
||||
if (count == conts.size()) {
|
||||
conts.push_back(static_cast<long>(GeomAbs_C0));
|
||||
editedObject->BoundaryOrder.setValues(conts);
|
||||
}
|
||||
|
||||
this->vp->highlightReferences(ViewProviderFilling::Edge,
|
||||
editedObject->BoundaryEdges.getSubListValues(), true);
|
||||
}
|
||||
else if (selectionMode == RemoveEdge) {
|
||||
Gui::SelectionObject sel(msg);
|
||||
@@ -421,30 +638,53 @@ void FillingPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
data << QByteArray(msg.pDocName);
|
||||
data << QByteArray(msg.pObjectName);
|
||||
data << QByteArray(msg.pSubName);
|
||||
for (int i=0; i<ui->listWidget->count(); i++) {
|
||||
QListWidgetItem* item = ui->listWidget->item(i);
|
||||
if (item && item->data(Qt::UserRole) == data) {
|
||||
ui->listWidget->takeItem(i);
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
|
||||
this->vp->highlightReferences(false);
|
||||
App::DocumentObject* obj = sel.getObject();
|
||||
std::string sub = msg.pSubName;
|
||||
auto objects = editedObject->Border.getValues();
|
||||
auto element = editedObject->Border.getSubValues();
|
||||
auto it = objects.begin();
|
||||
auto jt = element.begin();
|
||||
for (; it != objects.end() && jt != element.end(); ++it, ++jt) {
|
||||
if (*it == obj && *jt == sub) {
|
||||
objects.erase(it);
|
||||
element.erase(jt);
|
||||
editedObject->Border.setValues(objects, element);
|
||||
// only the three first elements must match
|
||||
for (int i=0; i<ui->listBoundary->count(); i++) {
|
||||
QListWidgetItem* item = ui->listBoundary->item(i);
|
||||
QList<QVariant> userdata = item->data(Qt::UserRole).toList();
|
||||
if (userdata.mid(0,3) == data) {
|
||||
ui->listBoundary->takeItem(i);
|
||||
delete item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->vp->highlightReferences(true);
|
||||
|
||||
this->vp->highlightReferences(ViewProviderFilling::Edge,
|
||||
editedObject->BoundaryEdges.getSubListValues(), false);
|
||||
App::DocumentObject* obj = sel.getObject();
|
||||
std::string sub = msg.pSubName;
|
||||
auto objects = editedObject->BoundaryEdges.getValues();
|
||||
auto element = editedObject->BoundaryEdges.getSubValues();
|
||||
auto it = objects.begin();
|
||||
auto jt = element.begin();
|
||||
|
||||
for (; it != objects.end() && jt != element.end(); ++it, ++jt) {
|
||||
if (*it == obj && *jt == sub) {
|
||||
std::size_t index = std::distance(objects.begin(), it);
|
||||
|
||||
objects.erase(it);
|
||||
element.erase(jt);
|
||||
editedObject->BoundaryEdges.setValues(objects, element);
|
||||
|
||||
// try to remove the item also from the faces
|
||||
auto faces = editedObject->BoundaryFaces.getValues();
|
||||
if (index < faces.size()) {
|
||||
faces.erase(faces.begin() + index);
|
||||
editedObject->BoundaryFaces.setValues(faces);
|
||||
}
|
||||
|
||||
// try to remove the item also from the orders
|
||||
auto order = editedObject->BoundaryOrder.getValues();
|
||||
if (index < order.size()) {
|
||||
order.erase(order.begin() + index);
|
||||
editedObject->BoundaryOrder.setValues(order);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->vp->highlightReferences(ViewProviderFilling::Edge,
|
||||
editedObject->BoundaryEdges.getSubListValues(), true);
|
||||
}
|
||||
|
||||
editedObject->recomputeFeature();
|
||||
@@ -454,46 +694,141 @@ void FillingPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
|
||||
void FillingPanel::onDeleteEdge()
|
||||
{
|
||||
int row = ui->listWidget->currentRow();
|
||||
QListWidgetItem* item = ui->listWidget->item(row);
|
||||
int row = ui->listBoundary->currentRow();
|
||||
QListWidgetItem* item = ui->listBoundary->item(row);
|
||||
if (item) {
|
||||
checkOpenCommand();
|
||||
QList<QVariant> data;
|
||||
data = item->data(Qt::UserRole).toList();
|
||||
ui->listWidget->takeItem(row);
|
||||
ui->listBoundary->takeItem(row);
|
||||
delete item;
|
||||
|
||||
App::Document* doc = App::GetApplication().getDocument(data[0].toByteArray());
|
||||
App::DocumentObject* obj = doc ? doc->getObject(data[1].toByteArray()) : nullptr;
|
||||
std::string sub = data[2].toByteArray().constData();
|
||||
auto objects = editedObject->Border.getValues();
|
||||
auto element = editedObject->Border.getSubValues();
|
||||
auto objects = editedObject->BoundaryEdges.getValues();
|
||||
auto element = editedObject->BoundaryEdges.getSubValues();
|
||||
auto it = objects.begin();
|
||||
auto jt = element.begin();
|
||||
this->vp->highlightReferences(false);
|
||||
this->vp->highlightReferences(ViewProviderFilling::Edge,
|
||||
editedObject->BoundaryEdges.getSubListValues(), false);
|
||||
for (; it != objects.end() && jt != element.end(); ++it, ++jt) {
|
||||
if (*it == obj && *jt == sub) {
|
||||
std::size_t index = std::distance(objects.begin(), it);
|
||||
|
||||
objects.erase(it);
|
||||
element.erase(jt);
|
||||
editedObject->Border.setValues(objects, element);
|
||||
editedObject->BoundaryEdges.setValues(objects, element);
|
||||
|
||||
// try to remove the item also from the faces
|
||||
auto faces = editedObject->BoundaryFaces.getValues();
|
||||
if (index < faces.size()) {
|
||||
faces.erase(faces.begin() + index);
|
||||
editedObject->BoundaryFaces.setValues(faces);
|
||||
}
|
||||
|
||||
// try to remove the item also from the orders
|
||||
auto order = editedObject->BoundaryOrder.getValues();
|
||||
if (index < order.size()) {
|
||||
order.erase(order.begin() + index);
|
||||
editedObject->BoundaryOrder.setValues(order);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->vp->highlightReferences(true);
|
||||
this->vp->highlightReferences(ViewProviderFilling::Edge,
|
||||
editedObject->BoundaryEdges.getSubListValues(), true);
|
||||
|
||||
editedObject->recomputeFeature();
|
||||
}
|
||||
}
|
||||
|
||||
void FillingPanel::on_buttonAccept_clicked()
|
||||
{
|
||||
QListWidgetItem* item = ui->listBoundary->currentItem();
|
||||
if (item) {
|
||||
QList<QVariant> data;
|
||||
data = item->data(Qt::UserRole).toList();
|
||||
|
||||
QVariant face = ui->comboBoxFaces->itemData(ui->comboBoxFaces->currentIndex());
|
||||
QVariant cont = ui->comboBoxCont->itemData(ui->comboBoxCont->currentIndex());
|
||||
if (data.size() == 5) {
|
||||
data[3] = face;
|
||||
data[4] = cont;
|
||||
}
|
||||
else {
|
||||
data << face;
|
||||
data << cont;
|
||||
}
|
||||
|
||||
item->setData(Qt::UserRole, data);
|
||||
|
||||
std::size_t index = ui->listBoundary->row(item);
|
||||
|
||||
// try to set the item of the faces
|
||||
auto faces = editedObject->BoundaryFaces.getValues();
|
||||
if (index < faces.size()) {
|
||||
faces[index] = face.toByteArray().data();
|
||||
editedObject->BoundaryFaces.setValues(faces);
|
||||
}
|
||||
|
||||
// try to set the item of the orders
|
||||
auto order = editedObject->BoundaryOrder.getValues();
|
||||
if (index < order.size()) {
|
||||
order[index] = cont.toInt();
|
||||
editedObject->BoundaryOrder.setValues(order);
|
||||
}
|
||||
}
|
||||
|
||||
modifyBoundary(false);
|
||||
ui->comboBoxFaces->clear();
|
||||
ui->comboBoxCont->clear();
|
||||
ui->statusLabel->clear();
|
||||
|
||||
editedObject->recomputeFeature();
|
||||
}
|
||||
|
||||
void FillingPanel::on_buttonIgnore_clicked()
|
||||
{
|
||||
modifyBoundary(false);
|
||||
ui->comboBoxFaces->clear();
|
||||
ui->comboBoxCont->clear();
|
||||
ui->statusLabel->clear();
|
||||
}
|
||||
|
||||
void FillingPanel::modifyBoundary(bool on)
|
||||
{
|
||||
ui->buttonInitFace->setDisabled(on);
|
||||
ui->lineInitFaceName->setDisabled(on);
|
||||
ui->buttonEdgeAdd->setDisabled(on);
|
||||
ui->buttonEdgeRemove->setDisabled(on);
|
||||
ui->listBoundary->setDisabled(on);
|
||||
|
||||
ui->comboBoxFaces->setEnabled(on);
|
||||
ui->comboBoxCont->setEnabled(on);
|
||||
ui->buttonAccept->setEnabled(on);
|
||||
ui->buttonIgnore->setEnabled(on);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
TaskFilling::TaskFilling(ViewProviderFilling* vp, Surface::Filling* obj)
|
||||
{
|
||||
widget = new FillingPanel(vp, obj);
|
||||
widget->setWindowTitle(QObject::tr("Surface"));
|
||||
taskbox = new Gui::TaskView::TaskBox(
|
||||
// first task box
|
||||
widget1 = new FillingPanel(vp, obj);
|
||||
Gui::TaskView::TaskBox* taskbox1 = new Gui::TaskView::TaskBox(
|
||||
Gui::BitmapFactory().pixmap("BezSurf"),
|
||||
widget->windowTitle(), true, 0);
|
||||
taskbox->groupLayout()->addWidget(widget);
|
||||
Content.push_back(taskbox);
|
||||
widget1->windowTitle(), true, 0);
|
||||
taskbox1->groupLayout()->addWidget(widget1);
|
||||
Content.push_back(taskbox1);
|
||||
|
||||
// second task box
|
||||
widget2 = new FillingVertexPanel(vp, obj);
|
||||
Gui::TaskView::TaskBox* taskbox2 = new Gui::TaskView::TaskBox(
|
||||
QPixmap(), widget2->windowTitle(), true, 0);
|
||||
taskbox2->groupLayout()->addWidget(widget2);
|
||||
Content.push_back(taskbox2);
|
||||
taskbox2->hideGroupBox();
|
||||
}
|
||||
|
||||
TaskFilling::~TaskFilling()
|
||||
@@ -503,22 +838,39 @@ TaskFilling::~TaskFilling()
|
||||
|
||||
void TaskFilling::setEditedObject(Surface::Filling* obj)
|
||||
{
|
||||
widget->setEditedObject(obj);
|
||||
widget1->setEditedObject(obj);
|
||||
}
|
||||
|
||||
void TaskFilling::open()
|
||||
{
|
||||
widget->open();
|
||||
widget1->open();
|
||||
widget2->open();
|
||||
}
|
||||
|
||||
bool TaskFilling::accept()
|
||||
{
|
||||
return widget->accept();
|
||||
bool ok = widget1->accept();
|
||||
if (ok) {
|
||||
widget2->reject();
|
||||
Gui::Command::commitCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()");
|
||||
Gui::Command::updateActive();
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TaskFilling::reject()
|
||||
{
|
||||
return widget->reject();
|
||||
bool ok = widget1->reject();
|
||||
if (ok) {
|
||||
widget2->reject();
|
||||
Gui::Command::abortCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()");
|
||||
Gui::Command::updateActive();
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2015 Balázs Bámer *
|
||||
* Copyright (c) 2017 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
@@ -31,20 +31,26 @@
|
||||
#include <Mod/Part/Gui/ViewProviderSpline.h>
|
||||
#include <Mod/Surface/App/FeatureFilling.h>
|
||||
|
||||
class QListWidgetItem;
|
||||
|
||||
namespace SurfaceGui
|
||||
{
|
||||
|
||||
class FillingVertexPanel;
|
||||
class Ui_TaskFilling;
|
||||
|
||||
class ViewProviderFilling : public PartGui::ViewProviderSpline
|
||||
{
|
||||
PROPERTY_HEADER(SurfaceGui::ViewProviderFilling);
|
||||
typedef std::vector<App::PropertyLinkSubList::SubSet> References;
|
||||
|
||||
public:
|
||||
enum ShapeType {Vertex, Edge, Face};
|
||||
virtual void setupContextMenu(QMenu*, QObject*, const char*);
|
||||
virtual bool setEdit(int ModNum);
|
||||
virtual void unsetEdit(int ModNum);
|
||||
QIcon getIcon(void) const;
|
||||
void highlightReferences(bool on);
|
||||
void highlightReferences(ShapeType type, const References& refs, bool on);
|
||||
};
|
||||
|
||||
class FillingPanel : public QWidget,
|
||||
@@ -81,12 +87,18 @@ protected:
|
||||
virtual void slotUndoDocument(const Gui::Document& Doc);
|
||||
/** Notifies on redo */
|
||||
virtual void slotRedoDocument(const Gui::Document& Doc);
|
||||
/** Notifies when the object is about to be removed. */
|
||||
virtual void slotDeletedObject(const Gui::ViewProviderDocumentObject& Obj);
|
||||
void modifyBoundary(bool);
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_buttonInitFace_clicked();
|
||||
void on_buttonEdgeAdd_clicked();
|
||||
void on_buttonEdgeRemove_clicked();
|
||||
void on_lineInitFaceName_textChanged(const QString&);
|
||||
void on_listBoundary_itemDoubleClicked(QListWidgetItem*);
|
||||
void on_buttonAccept_clicked();
|
||||
void on_buttonIgnore_clicked();
|
||||
void onDeleteEdge(void);
|
||||
void clearSelection();
|
||||
};
|
||||
@@ -109,8 +121,8 @@ public:
|
||||
{ return QDialogButtonBox::Ok | QDialogButtonBox::Cancel; }
|
||||
|
||||
private:
|
||||
FillingPanel* widget;
|
||||
Gui::TaskView::TaskBox* taskbox;
|
||||
FillingPanel* widget1;
|
||||
FillingVertexPanel* widget2;
|
||||
};
|
||||
|
||||
} //namespace SurfaceGui
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>Filling</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
@@ -39,43 +39,135 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonEdgeAdd">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add Edge</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonEdgeRemove">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove Edge</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QListWidget" name="listWidget"/>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Boundary</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="listBoundary"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Faces:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="comboBoxFaces">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Continuity:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="comboBoxCont">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Maximum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>74</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QPushButton" name="buttonAccept">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Accept</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QPushButton" name="buttonIgnore">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ignore</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonEdgeAdd">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add Edge</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonEdgeRemove">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove Edge</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QLabel" name="statusLabel">
|
||||
<property name="text">
|
||||
<string notr="true">Status messages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
355
src/Mod/Surface/Gui/TaskFillingVertex.cpp
Normal file
355
src/Mod/Surface/Gui/TaskFillingVertex.cpp
Normal file
@@ -0,0 +1,355 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2017 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* 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 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
|
||||
#include <Gui/ViewProvider.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/SelectionObject.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Gui/Control.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Mod/Part/Gui/ViewProvider.h>
|
||||
|
||||
#include "TaskFillingVertex.h"
|
||||
#include "ui_TaskFillingVertex.h"
|
||||
#include "TaskFilling.h"
|
||||
|
||||
|
||||
using namespace SurfaceGui;
|
||||
|
||||
namespace SurfaceGui {
|
||||
|
||||
class FillingVertexPanel::VertexSelection : public Gui::SelectionFilterGate
|
||||
{
|
||||
public:
|
||||
VertexSelection(FillingVertexPanel::SelectionMode& mode, Surface::Filling* editedObject)
|
||||
: Gui::SelectionFilterGate(static_cast<Gui::SelectionFilter*>(nullptr))
|
||||
, mode(mode)
|
||||
, editedObject(editedObject)
|
||||
{
|
||||
}
|
||||
~VertexSelection()
|
||||
{
|
||||
mode = FillingVertexPanel::None;
|
||||
}
|
||||
/**
|
||||
* Allow the user to pick only edges.
|
||||
*/
|
||||
bool allow(App::Document*, App::DocumentObject* pObj, const char* sSubName)
|
||||
{
|
||||
// don't allow references to itself
|
||||
if (pObj == editedObject)
|
||||
return false;
|
||||
if (!pObj->isDerivedFrom(Part::Feature::getClassTypeId()))
|
||||
return false;
|
||||
|
||||
if (!sSubName || sSubName[0] == '\0')
|
||||
return false;
|
||||
|
||||
switch (mode) {
|
||||
case FillingVertexPanel::AppendVertex:
|
||||
return allowVertex(true, pObj, sSubName);
|
||||
case FillingVertexPanel::RemoveVertex:
|
||||
return allowVertex(false, pObj, sSubName);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
bool allowVertex(bool appendVertex, App::DocumentObject* pObj, const char* sSubName)
|
||||
{
|
||||
std::string element(sSubName);
|
||||
if (element.substr(0,6) != "Vertex")
|
||||
return false;
|
||||
|
||||
auto links = editedObject->Points.getSubListValues();
|
||||
for (auto it : links) {
|
||||
if (it.first == pObj) {
|
||||
for (auto jt : it.second) {
|
||||
if (jt == sSubName)
|
||||
return !appendVertex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return appendVertex;
|
||||
}
|
||||
|
||||
private:
|
||||
FillingVertexPanel::SelectionMode& mode;
|
||||
Surface::Filling* editedObject;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
FillingVertexPanel::FillingVertexPanel(ViewProviderFilling* vp, Surface::Filling* obj)
|
||||
{
|
||||
ui = new Ui_TaskFillingVertex();
|
||||
ui->setupUi(this);
|
||||
|
||||
selectionMode = None;
|
||||
this->vp = vp;
|
||||
checkCommand = true;
|
||||
setEditedObject(obj);
|
||||
|
||||
// Create context menu
|
||||
QAction* action = new QAction(tr("Remove"), this);
|
||||
action->setShortcut(QString::fromLatin1("Del"));
|
||||
ui->listFreeVertex->addAction(action);
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(onDeleteVertex()));
|
||||
ui->listFreeVertex->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
}
|
||||
|
||||
/*
|
||||
* Destroys the object and frees any allocated resources
|
||||
*/
|
||||
FillingVertexPanel::~FillingVertexPanel()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
delete ui;
|
||||
Gui::Selection().rmvSelectionGate();
|
||||
}
|
||||
|
||||
// stores object pointer, its old fill type and adjusts radio buttons according to it.
|
||||
void FillingVertexPanel::setEditedObject(Surface::Filling* obj)
|
||||
{
|
||||
editedObject = obj;
|
||||
|
||||
auto objects = editedObject->Points.getValues();
|
||||
auto element = editedObject->Points.getSubValues();
|
||||
auto it = objects.begin();
|
||||
auto jt = element.begin();
|
||||
|
||||
App::Document* doc = editedObject->getDocument();
|
||||
for (; it != objects.end() && jt != element.end(); ++it, ++jt) {
|
||||
QListWidgetItem* item = new QListWidgetItem(ui->listFreeVertex);
|
||||
ui->listFreeVertex->addItem(item);
|
||||
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8((*it)->Label.getValue()))
|
||||
.arg(QString::fromStdString(*jt));
|
||||
item->setText(text);
|
||||
|
||||
QList<QVariant> data;
|
||||
data << QByteArray(doc->getName());
|
||||
data << QByteArray((*it)->getNameInDocument());
|
||||
data << QByteArray(jt->c_str());
|
||||
item->setData(Qt::UserRole, data);
|
||||
}
|
||||
attachDocument(Gui::Application::Instance->getDocument(doc));
|
||||
}
|
||||
|
||||
void FillingVertexPanel::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
else {
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
void FillingVertexPanel::open()
|
||||
{
|
||||
checkOpenCommand();
|
||||
this->vp->highlightReferences(ViewProviderFilling::Vertex,
|
||||
editedObject->Points.getSubListValues(), true);
|
||||
Gui::Selection().clearSelection();
|
||||
}
|
||||
|
||||
void FillingVertexPanel::reject()
|
||||
{
|
||||
this->vp->highlightReferences(ViewProviderFilling::Vertex,
|
||||
editedObject->Points.getSubListValues(), false);
|
||||
}
|
||||
|
||||
void FillingVertexPanel::clearSelection()
|
||||
{
|
||||
Gui::Selection().clearSelection();
|
||||
}
|
||||
|
||||
void FillingVertexPanel::checkOpenCommand()
|
||||
{
|
||||
if (checkCommand && !Gui::Command::hasPendingCommand()) {
|
||||
std::string Msg("Edit ");
|
||||
Msg += editedObject->Label.getValue();
|
||||
Gui::Command::openCommand(Msg.c_str());
|
||||
checkCommand = false;
|
||||
}
|
||||
}
|
||||
|
||||
void FillingVertexPanel::slotUndoDocument(const Gui::Document&)
|
||||
{
|
||||
checkCommand = true;
|
||||
}
|
||||
|
||||
void FillingVertexPanel::slotRedoDocument(const Gui::Document&)
|
||||
{
|
||||
checkCommand = true;
|
||||
}
|
||||
|
||||
void FillingVertexPanel::slotDeletedObject(const Gui::ViewProviderDocumentObject& Obj)
|
||||
{
|
||||
// If this view provider is being deleted then reset the colors of
|
||||
// referenced part objects. The dialog will be deleted later.
|
||||
if (this->vp == &Obj) {
|
||||
this->vp->highlightReferences(ViewProviderFilling::Vertex,
|
||||
editedObject->Points.getSubListValues(), false);
|
||||
}
|
||||
}
|
||||
|
||||
void FillingVertexPanel::on_buttonVertexAdd_clicked()
|
||||
{
|
||||
// 'selectionMode' is passed by reference and changed when the filter is deleted
|
||||
Gui::Selection().addSelectionGate(new VertexSelection(selectionMode, editedObject));
|
||||
selectionMode = AppendVertex;
|
||||
}
|
||||
|
||||
void FillingVertexPanel::on_buttonVertexRemove_clicked()
|
||||
{
|
||||
// 'selectionMode' is passed by reference and changed when the filter is deleted
|
||||
Gui::Selection().addSelectionGate(new VertexSelection(selectionMode, editedObject));
|
||||
selectionMode = RemoveVertex;
|
||||
}
|
||||
|
||||
void FillingVertexPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
{
|
||||
if (selectionMode == None)
|
||||
return;
|
||||
|
||||
if (msg.Type == Gui::SelectionChanges::AddSelection) {
|
||||
checkOpenCommand();
|
||||
if (selectionMode == AppendVertex) {
|
||||
QListWidgetItem* item = new QListWidgetItem(ui->listFreeVertex);
|
||||
ui->listFreeVertex->addItem(item);
|
||||
|
||||
Gui::SelectionObject sel(msg);
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8(sel.getObject()->Label.getValue()))
|
||||
.arg(QString::fromLatin1(msg.pSubName));
|
||||
item->setText(text);
|
||||
|
||||
QList<QVariant> data;
|
||||
data << QByteArray(msg.pDocName);
|
||||
data << QByteArray(msg.pObjectName);
|
||||
data << QByteArray(msg.pSubName);
|
||||
item->setData(Qt::UserRole, data);
|
||||
|
||||
auto objects = editedObject->Points.getValues();
|
||||
objects.push_back(sel.getObject());
|
||||
auto element = editedObject->Points.getSubValues();
|
||||
element.push_back(msg.pSubName);
|
||||
editedObject->Points.setValues(objects, element);
|
||||
this->vp->highlightReferences(ViewProviderFilling::Vertex,
|
||||
editedObject->Points.getSubListValues(), true);
|
||||
}
|
||||
else if (selectionMode == RemoveVertex) {
|
||||
Gui::SelectionObject sel(msg);
|
||||
QList<QVariant> data;
|
||||
data << QByteArray(msg.pDocName);
|
||||
data << QByteArray(msg.pObjectName);
|
||||
data << QByteArray(msg.pSubName);
|
||||
for (int i=0; i<ui->listFreeVertex->count(); i++) {
|
||||
QListWidgetItem* item = ui->listFreeVertex->item(i);
|
||||
if (item && item->data(Qt::UserRole) == data) {
|
||||
ui->listFreeVertex->takeItem(i);
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
|
||||
this->vp->highlightReferences(ViewProviderFilling::Vertex,
|
||||
editedObject->Points.getSubListValues(), false);
|
||||
App::DocumentObject* obj = sel.getObject();
|
||||
std::string sub = msg.pSubName;
|
||||
auto objects = editedObject->Points.getValues();
|
||||
auto element = editedObject->Points.getSubValues();
|
||||
auto it = objects.begin();
|
||||
auto jt = element.begin();
|
||||
for (; it != objects.end() && jt != element.end(); ++it, ++jt) {
|
||||
if (*it == obj && *jt == sub) {
|
||||
objects.erase(it);
|
||||
element.erase(jt);
|
||||
editedObject->Points.setValues(objects, element);
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->vp->highlightReferences(ViewProviderFilling::Vertex,
|
||||
editedObject->Points.getSubListValues(), true);
|
||||
}
|
||||
|
||||
editedObject->recomputeFeature();
|
||||
QTimer::singleShot(50, this, SLOT(clearSelection()));
|
||||
}
|
||||
}
|
||||
|
||||
void FillingVertexPanel::onDeleteVertex()
|
||||
{
|
||||
int row = ui->listFreeVertex->currentRow();
|
||||
QListWidgetItem* item = ui->listFreeVertex->item(row);
|
||||
if (item) {
|
||||
checkOpenCommand();
|
||||
QList<QVariant> data;
|
||||
data = item->data(Qt::UserRole).toList();
|
||||
ui->listFreeVertex->takeItem(row);
|
||||
delete item;
|
||||
|
||||
App::Document* doc = App::GetApplication().getDocument(data[0].toByteArray());
|
||||
App::DocumentObject* obj = doc ? doc->getObject(data[1].toByteArray()) : nullptr;
|
||||
std::string sub = data[2].toByteArray().constData();
|
||||
auto objects = editedObject->Points.getValues();
|
||||
auto element = editedObject->Points.getSubValues();
|
||||
auto it = objects.begin();
|
||||
auto jt = element.begin();
|
||||
this->vp->highlightReferences(ViewProviderFilling::Vertex,
|
||||
editedObject->Points.getSubListValues(), false);
|
||||
|
||||
for (; it != objects.end() && jt != element.end(); ++it, ++jt) {
|
||||
if (*it == obj && *jt == sub) {
|
||||
objects.erase(it);
|
||||
element.erase(jt);
|
||||
editedObject->Points.setValues(objects, element);
|
||||
editedObject->recomputeFeature();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this->vp->highlightReferences(ViewProviderFilling::Vertex,
|
||||
editedObject->Points.getSubListValues(), true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include "moc_TaskFillingVertex.cpp"
|
||||
87
src/Mod/Surface/Gui/TaskFillingVertex.h
Normal file
87
src/Mod/Surface/Gui/TaskFillingVertex.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2017 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* 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 SURFACEGUI_TASKFILLINGVERTEX_H
|
||||
#define SURFACEGUI_TASKFILLINGVERTEX_H
|
||||
|
||||
#include <Gui/TaskView/TaskDialog.h>
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <Gui/SelectionFilter.h>
|
||||
#include <Gui/DocumentObserver.h>
|
||||
#include <Base/BoundBox.h>
|
||||
#include <Mod/Part/Gui/ViewProviderSpline.h>
|
||||
#include <Mod/Surface/App/FeatureFilling.h>
|
||||
|
||||
class QListWidgetItem;
|
||||
|
||||
namespace SurfaceGui
|
||||
{
|
||||
|
||||
class ViewProviderFilling;
|
||||
class Ui_TaskFillingVertex;
|
||||
|
||||
class FillingVertexPanel : public QWidget,
|
||||
public Gui::SelectionObserver,
|
||||
public Gui::DocumentObserver
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
class VertexSelection;
|
||||
enum SelectionMode { None, AppendVertex, RemoveVertex };
|
||||
SelectionMode selectionMode;
|
||||
Surface::Filling* editedObject;
|
||||
bool checkCommand;
|
||||
|
||||
private:
|
||||
Ui_TaskFillingVertex* ui;
|
||||
ViewProviderFilling* vp;
|
||||
|
||||
public:
|
||||
FillingVertexPanel(ViewProviderFilling* vp, Surface::Filling* obj);
|
||||
~FillingVertexPanel();
|
||||
|
||||
void open();
|
||||
void reject();
|
||||
void checkOpenCommand();
|
||||
void setEditedObject(Surface::Filling* obj);
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
virtual void onSelectionChanged(const Gui::SelectionChanges& msg);
|
||||
/** Notifies on undo */
|
||||
virtual void slotUndoDocument(const Gui::Document& Doc);
|
||||
/** Notifies on redo */
|
||||
virtual void slotRedoDocument(const Gui::Document& Doc);
|
||||
/** Notifies when the object is about to be removed. */
|
||||
virtual void slotDeletedObject(const Gui::ViewProviderDocumentObject& Obj);
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_buttonVertexAdd_clicked();
|
||||
void on_buttonVertexRemove_clicked();
|
||||
void onDeleteVertex(void);
|
||||
void clearSelection();
|
||||
};
|
||||
|
||||
} //namespace SurfaceGui
|
||||
|
||||
#endif // SURFACEGUI_TASKFILLINGVERTEX_H
|
||||
69
src/Mod/Surface/Gui/TaskFillingVertex.ui
Normal file
69
src/Mod/Surface/Gui/TaskFillingVertex.ui
Normal file
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SurfaceGui::TaskFillingVertex</class>
|
||||
<widget class="QWidget" name="SurfaceGui::TaskFillingVertex">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>273</width>
|
||||
<height>329</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Vertexes</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Unbound vertexes</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonVertexAdd">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add Vertex</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonVertexRemove">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove Vertex</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QListWidget" name="listFreeVertex"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -297,9 +297,17 @@ void GeomFillSurface::slotRedoDocument(const Gui::Document&)
|
||||
checkCommand = true;
|
||||
}
|
||||
|
||||
void GeomFillSurface::slotDeletedObject(const Gui::ViewProviderDocumentObject& Obj)
|
||||
{
|
||||
// If this view provider is being deleted then reset the colors of
|
||||
// referenced part objects. The dialog will be deleted later.
|
||||
if (this->vp == &Obj) {
|
||||
this->vp->highlightReferences(false);
|
||||
}
|
||||
}
|
||||
|
||||
bool GeomFillSurface::accept()
|
||||
{
|
||||
this->vp->highlightReferences(false);
|
||||
selectionMode = None;
|
||||
Gui::Selection().rmvSelectionGate();
|
||||
|
||||
@@ -325,6 +333,8 @@ bool GeomFillSurface::accept()
|
||||
return false;
|
||||
}
|
||||
|
||||
this->vp->highlightReferences(false);
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()");
|
||||
Gui::Command::updateActive();
|
||||
|
||||
@@ -82,6 +82,8 @@ protected:
|
||||
virtual void slotUndoDocument(const Gui::Document& Doc);
|
||||
/** Notifies on redo */
|
||||
virtual void slotRedoDocument(const Gui::Document& Doc);
|
||||
/** Notifies when the object is about to be removed. */
|
||||
virtual void slotDeletedObject(const Gui::ViewProviderDocumentObject& Obj);
|
||||
void changeFillType(GeomFill_FillingStyle);
|
||||
|
||||
private Q_SLOTS:
|
||||
|
||||
Reference in New Issue
Block a user