App/Origin: big refactoring
- Rebase App::Origin on App::DocumentObject - Keep all control over the Origin structure inside the Origin and it's ViewProvider - Add OriginFeature class as common base for App::Plane and App::Line - Rebase App::Plane and App::Line on top of newly created class and move to the file. - Change Origin's ViewProvider API associated with temporary display - Lots of associated changes to files - Several minor fixes - Lots of new bugs
This commit is contained in:
committed by
Stefan Tröger
parent
ecbb576330
commit
797d6d3a11
@@ -54,8 +54,7 @@
|
||||
|
||||
#include "Attacher.h"
|
||||
#include <Base/Console.h>
|
||||
#include <App/Plane.h>
|
||||
#include <App/Line.h>
|
||||
#include <App/OriginFeature.h>
|
||||
|
||||
using namespace Part;
|
||||
using namespace Attacher;
|
||||
@@ -614,6 +613,7 @@ void AttachEngine::readLinks(const App::PropertyLinkSubList &references,
|
||||
shapes[i] = &(shape->_Shape);
|
||||
}
|
||||
} else if ( geof->isDerivedFrom(App::Plane::getClassTypeId()) ){
|
||||
// TODO Why this assert is here? (2015-08-31, Fat-Zer)
|
||||
assert(sub[i].length()==0);//no more support for "back"/"front" on planes. Use mapReversed instead.
|
||||
//obtain Z axis and origin of placement
|
||||
Base::Vector3d norm;
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
# include <Standard_Version.hxx>
|
||||
#endif
|
||||
|
||||
#include <App/Plane.h>
|
||||
#include "DatumFeature.h"
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/Console.h>
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Reader.h>
|
||||
#include <App/Plane.h>
|
||||
#include <App/Property.h>
|
||||
#include <App/PropertyLinks.h>
|
||||
#include "Part2DObject.h"
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#ifndef _PreComp_
|
||||
#endif
|
||||
|
||||
#include <App/Plane.h>
|
||||
#include <Base/Placement.h>
|
||||
|
||||
#include "Feature.h"
|
||||
@@ -413,6 +412,7 @@ App::DocumentObjectExecReturn *Body::execute(void)
|
||||
|
||||
Base::BoundBox3d Body::getBoundBox()
|
||||
{
|
||||
// TODO review the function (2015-08-31, Fat-Zer)
|
||||
Base::BoundBox3d result;
|
||||
|
||||
Part::Feature* tipSolid = static_cast<Part::Feature*>(Tip.getValue());
|
||||
@@ -422,7 +422,8 @@ Base::BoundBox3d Body::getBoundBox()
|
||||
}
|
||||
|
||||
if (!tipSolid || tipSolid->Shape.getValue().IsNull()) {
|
||||
result = App::Plane::getBoundBox();
|
||||
// TODO check that all callers are correctly handle if bounding box is null (2015-08-31, Fat-Zer)
|
||||
result = Base::BoundBox3d ();
|
||||
} else {
|
||||
result = tipSolid->Shape.getShape().getBoundBox();
|
||||
}
|
||||
@@ -439,9 +440,6 @@ Base::BoundBox3d Body::getBoundBox()
|
||||
} else if ((*m)->getTypeId().isDerivedFrom(PartDesign::Plane::getClassTypeId())) {
|
||||
PartDesign::Plane* plane = static_cast<PartDesign::Plane*>(*m);
|
||||
result.Add(plane->getBasePoint());
|
||||
} else if ((*m)->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) {
|
||||
// Note: We only take into account the base planes here
|
||||
result.Add(Base::Vector3d(0,0,0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,7 @@
|
||||
#include "DatumPoint.h"
|
||||
#include "DatumPlane.h"
|
||||
#include "DatumLine.h"
|
||||
#include <App/Plane.h>
|
||||
#include <App/Part.h>
|
||||
#include <App/Line.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
|
||||
@@ -61,9 +61,8 @@
|
||||
#endif
|
||||
|
||||
#include <QObject>
|
||||
#include <App/Plane.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <App/Part.h>
|
||||
#include <App/Line.h>
|
||||
#include "DatumPoint.h"
|
||||
#include "DatumLine.h"
|
||||
#include "DatumPlane.h"
|
||||
|
||||
@@ -59,9 +59,7 @@
|
||||
#endif
|
||||
|
||||
#include <QObject>
|
||||
#include <App/Plane.h>
|
||||
#include <App/Part.h>
|
||||
#include <App/Line.h>
|
||||
#include "DatumPoint.h"
|
||||
#include "DatumLine.h"
|
||||
#include "DatumPlane.h"
|
||||
|
||||
@@ -59,8 +59,6 @@
|
||||
#endif
|
||||
|
||||
#include <QObject>
|
||||
#include <App/Plane.h>
|
||||
#include <App/Line.h>
|
||||
#include <App/Part.h>
|
||||
#include "DatumPoint.h"
|
||||
#include "DatumLine.h"
|
||||
|
||||
@@ -36,8 +36,7 @@
|
||||
|
||||
#include <Base/Exception.h>
|
||||
#include "App/Document.h"
|
||||
#include "App/Plane.h"
|
||||
#include <App/Line.h>
|
||||
#include "App/OriginFeature.h"
|
||||
#include "Body.h"
|
||||
#include "Feature.h"
|
||||
#include "Mod/Part/App/DatumFeature.h"
|
||||
@@ -140,8 +139,7 @@ const Part::TopoShape Feature::getBaseTopoShape() const {
|
||||
|
||||
bool Feature::isDatum(const App::DocumentObject* feature)
|
||||
{
|
||||
return feature->getTypeId().isDerivedFrom(App::Plane::getClassTypeId()) ||
|
||||
feature->getTypeId().isDerivedFrom(App::Line::getClassTypeId()) ||
|
||||
return feature->getTypeId().isDerivedFrom(App::OriginFeature::getClassTypeId()) ||
|
||||
feature->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId());
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
# include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#endif
|
||||
|
||||
#include <App/Plane.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
|
||||
@@ -36,8 +36,7 @@
|
||||
#include "FeatureLinearPattern.h"
|
||||
#include "DatumPlane.h"
|
||||
#include "DatumLine.h"
|
||||
#include <App/Plane.h>
|
||||
#include <App/Line.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <Base/Axis.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
#include <App/Plane.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <Base/Exception.h>
|
||||
#include "FeatureMirrored.h"
|
||||
#include "DatumPlane.h"
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <Base/Tools.h>
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
#include <Mod/Part/App/Part2DObject.h>
|
||||
#include <App/Line.h>
|
||||
#include <App/OriginFeature.h>
|
||||
|
||||
using namespace PartDesign;
|
||||
|
||||
|
||||
@@ -67,11 +67,10 @@
|
||||
#include <TopExp.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
|
||||
#include <App/Plane.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/Line.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <App/Part.h>
|
||||
#include <Mod/Part/App/modelRefine.h>
|
||||
#include "FeatureSketchBased.h"
|
||||
@@ -1054,12 +1053,7 @@ void SketchBased::getAxis(const App::DocumentObject *pcReferenceAxis, const std:
|
||||
if (pcReferenceAxis->getTypeId().isDerivedFrom(App::Line::getClassTypeId())) {
|
||||
const App::Line* line = static_cast<const App::Line*>(pcReferenceAxis);
|
||||
base = Base::Vector3d(0,0,0);
|
||||
if( strcmp(line->LineType.getValue(), App::Part::BaselineTypes[0]) == 0)
|
||||
dir = Base::Vector3d(1,0,0);
|
||||
else if( strcmp(line->LineType.getValue(), App::Part::BaselineTypes[1]) == 0)
|
||||
dir = Base::Vector3d(0,1,0);
|
||||
else if( strcmp(line->LineType.getValue(), App::Part::BaselineTypes[2]) == 0)
|
||||
dir = Base::Vector3d(0,0,1);
|
||||
line->Placement.getValue().multVec (Base::Vector3d (1,0,0), dir);
|
||||
|
||||
// Check that axis is perpendicular with sketch plane!
|
||||
if (sketchplane.Axis().Direction().Angle(gp_Dir(dir.x, dir.y, dir.z)) < Precision::Angular())
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include <App/DocumentObjectGroup.h>
|
||||
#include <App/Plane.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <App/Part.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Command.h>
|
||||
@@ -307,11 +307,12 @@ void CmdPartDesignNewSketch::activated(int iMsg)
|
||||
}
|
||||
|
||||
if (!pcActiveBody->hasFeature(obj)) {
|
||||
// TODO check what the heck is going on here (2015-08-31, Fat-Zer)
|
||||
bool isBasePlane = false;
|
||||
if(obj->isDerivedFrom(App::Plane::getClassTypeId())) {
|
||||
App::Plane* pfeat = static_cast<App::Plane*>(obj);
|
||||
for (unsigned i = 0; i < 3; i++) {
|
||||
if (strcmp(App::Part::BaseplaneTypes[i], pfeat->PlaneType.getValue()) == 0) {
|
||||
if (strcmp(App::Part::BaseplaneTypes[i], pfeat->Role.getValue()) == 0) {
|
||||
isBasePlane = true;
|
||||
break;
|
||||
}
|
||||
@@ -360,7 +361,7 @@ void CmdPartDesignNewSketch::activated(int iMsg)
|
||||
if((*p)->isDerivedFrom(App::Plane::getClassTypeId())) {
|
||||
App::Plane* pfeat = static_cast<App::Plane*>(*p);
|
||||
for (unsigned i = 0; i < 3; i++) {
|
||||
if (strcmp(App::Part::BaseplaneTypes[i], pfeat->PlaneType.getValue()) == 0) {
|
||||
if (strcmp(App::Part::BaseplaneTypes[i], pfeat->Role.getValue()) == 0) {
|
||||
if(pcActivePart->hasObject(pfeat, true))
|
||||
status.push_back(PartDesignGui::TaskFeaturePick::basePlane);
|
||||
else
|
||||
|
||||
@@ -30,9 +30,8 @@
|
||||
# include <BRepAdaptor_Surface.hxx>
|
||||
#endif
|
||||
|
||||
#include <App/Plane.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <App/Part.h>
|
||||
#include <App/Line.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
#include <Base/Console.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/Plane.h>
|
||||
#include <App/Line.h>
|
||||
#include <App/Origin.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <App/Part.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
@@ -67,8 +67,7 @@ const QString makeRefString(const App::DocumentObject* obj, const std::string& s
|
||||
if (obj == NULL)
|
||||
return QObject::tr("No reference selected");
|
||||
|
||||
if (obj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId()) ||
|
||||
obj->getTypeId().isDerivedFrom(App::Line::getClassTypeId()) ||
|
||||
if (obj->getTypeId().isDerivedFrom(App::OriginFeature::getClassTypeId()) ||
|
||||
obj->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId()))
|
||||
// App::Plane, Liine or Datum feature
|
||||
return QString::fromAscii(obj->getNameInDocument());
|
||||
@@ -217,10 +216,8 @@ TaskDatumParameters::TaskDatumParameters(ViewProviderDatum *DatumView,QWidget *p
|
||||
auto app_origin = part->getObjectsOfType(App::Origin::getClassTypeId());
|
||||
if(!app_origin.empty()) {
|
||||
ViewProviderOrigin* origin;
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->activeDocument()->getViewProvider(app_origin[0]));
|
||||
origin->setTemporaryVisibilityMode(true, Gui::Application::Instance->activeDocument());
|
||||
origin->setTemporaryVisibilityAxis(true);
|
||||
origin->setTemporaryVisibilityPlanes(true);
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->getViewProvider(app_origin[0]));
|
||||
origin->setTemporaryVisibility(true, true);
|
||||
}
|
||||
}
|
||||
if (pcDatum->Support.getSize() == 0)
|
||||
@@ -402,8 +399,7 @@ void TaskDatumParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
std::string subname = msg.pSubName;
|
||||
|
||||
// Remove subname for planes and datum features
|
||||
if (selObj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId()) ||
|
||||
selObj->getTypeId().isDerivedFrom(App::Line::getClassTypeId()) ||
|
||||
if (selObj->getTypeId().isDerivedFrom(App::OriginFeature::getClassTypeId()) ||
|
||||
selObj->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId()))
|
||||
subname = "";
|
||||
|
||||
@@ -778,8 +774,8 @@ TaskDatumParameters::~TaskDatumParameters()
|
||||
auto app_origin = part->getObjectsOfType(App::Origin::getClassTypeId());
|
||||
if(!app_origin.empty()) {
|
||||
ViewProviderOrigin* origin;
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->activeDocument()->getViewProvider(app_origin[0]));
|
||||
origin->setTemporaryVisibilityMode(false);
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->getViewProvider(app_origin[0]));
|
||||
origin->resetTemporaryVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/ViewProviderOrigin.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/Origin.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <App/Part.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/Reader.h>
|
||||
@@ -85,32 +87,43 @@ TaskFeaturePick::TaskFeaturePick(std::vector<App::DocumentObject*>& objects,
|
||||
connect(ui->nobodyRadioIndependent, SIGNAL(toggled(bool)), this, SLOT(onUpdate(bool)));
|
||||
connect(ui->nobodyRadioXRef, SIGNAL(toggled(bool)), this, SLOT(onUpdate(bool)));
|
||||
|
||||
auto guidoc = Gui::Application::Instance->activeDocument();
|
||||
auto origin_obj = App::GetApplication().getActiveDocument()->getObjectsOfType<App::Origin>();
|
||||
enum { axisBit=0, planeBit = 1};
|
||||
|
||||
// Note generally there shouldn't be more then one origin
|
||||
std::map <App::Origin*, std::bitset<2> > originVisStatus;
|
||||
|
||||
auto statusIt = status.cbegin();
|
||||
auto objIt = objects.begin();
|
||||
assert(status.size() == objects.size());
|
||||
std::vector<featureStatus>::const_iterator st = status.begin();
|
||||
for (std::vector<App::DocumentObject*>::const_iterator o = objects.begin(); o != objects.end(); o++) {
|
||||
QListWidgetItem* item = new QListWidgetItem(QString::fromAscii((*o)->getNameInDocument()) +
|
||||
QString::fromAscii(" (") + getFeatureStatusString(*st) + QString::fromAscii(")"));
|
||||
for (; statusIt != status.end(); ++statusIt, ++objIt) {
|
||||
QListWidgetItem* item = new QListWidgetItem(
|
||||
QString::fromAscii((*objIt)->getNameInDocument()) +
|
||||
QString::fromAscii(" (") + getFeatureStatusString(*statusIt) + QString::fromAscii(")") );
|
||||
ui->listWidget->addItem(item);
|
||||
|
||||
//check if we need to set any origin in temporary visibility mode
|
||||
for(App::Origin* obj : origin_obj) {
|
||||
if(obj->hasObject(*o) && (*st != invalidShape)) {
|
||||
Gui::ViewProviderOrigin* vpo = static_cast<Gui::ViewProviderOrigin*>(guidoc->getViewProvider(obj));
|
||||
if(!vpo->isTemporaryVisibilityMode())
|
||||
vpo->setTemporaryVisibilityMode(true, guidoc);
|
||||
if (*statusIt != invalidShape && (*objIt)->isDerivedFrom ( App::OriginFeature::getClassTypeId () )) {
|
||||
App::Origin *origin = static_cast<App::OriginFeature*> (*objIt)->getOrigin ();
|
||||
if (origin) {
|
||||
if ((*objIt)->isDerivedFrom ( App::Plane::getClassTypeId () )) {
|
||||
originVisStatus[ origin ].set (planeBit, true);
|
||||
} else if ( (*objIt)->isDerivedFrom ( App::Line::getClassTypeId () ) ) {
|
||||
originVisStatus[ origin ].set (axisBit, true);
|
||||
}
|
||||
|
||||
vpo->setTemporaryVisibility(*o, true);
|
||||
Gui::ViewProviderOrigin* vpo = static_cast<Gui::ViewProviderOrigin*> (
|
||||
Gui::Application::Instance->getViewProvider(*objIt) );
|
||||
if (vpo) {
|
||||
vpo->setTemporaryVisibility( originVisStatus[origin][axisBit],
|
||||
originVisStatus[origin][planeBit]);
|
||||
}
|
||||
origins.push_back(vpo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
st++;
|
||||
}
|
||||
|
||||
// TODO may be update origin API to show only some objects (2015-08-31, Fat-Zer)
|
||||
|
||||
groupLayout()->addWidget(proxy);
|
||||
statuses = status;
|
||||
updateList();
|
||||
@@ -119,7 +132,7 @@ TaskFeaturePick::TaskFeaturePick(std::vector<App::DocumentObject*>& objects,
|
||||
TaskFeaturePick::~TaskFeaturePick()
|
||||
{
|
||||
for(Gui::ViewProviderOrigin* vpo : origins)
|
||||
vpo->setTemporaryVisibilityMode(false, NULL);
|
||||
vpo->resetTemporaryVisibility();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <App/Document.h>
|
||||
#include <App/Part.h>
|
||||
#include <App/Origin.h>
|
||||
#include <App/Line.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
@@ -170,10 +170,9 @@ void TaskLinearPatternParameters::setupUI()
|
||||
auto app_origin = part->getObjectsOfType(App::Origin::getClassTypeId());
|
||||
if(!app_origin.empty()) {
|
||||
ViewProviderOrigin* origin;
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->activeDocument()->getViewProvider(app_origin[0]));
|
||||
origin->setTemporaryVisibilityMode(true, Gui::Application::Instance->activeDocument());
|
||||
origin->setTemporaryVisibilityAxis(true);
|
||||
}
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->getViewProvider(app_origin[0]));
|
||||
origin->setTemporaryVisibility(true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,8 +369,8 @@ TaskLinearPatternParameters::~TaskLinearPatternParameters()
|
||||
auto app_origin = part->getObjectsOfType(App::Origin::getClassTypeId());
|
||||
if(!app_origin.empty()) {
|
||||
ViewProviderOrigin* origin;
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->activeDocument()->getViewProvider(app_origin[0]));
|
||||
origin->setTemporaryVisibilityMode(false);
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->getViewProvider(app_origin[0]));
|
||||
origin->resetTemporaryVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/Part.h>
|
||||
#include <App/Plane.h>
|
||||
#include <App/Origin.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
@@ -141,15 +142,14 @@ void TaskMirroredParameters::setupUI()
|
||||
|
||||
//show the parts coordinate system axis for selection
|
||||
App::Part* part = getPartFor(getObject(), false);
|
||||
if(part) {
|
||||
if(part) {
|
||||
auto app_origin = part->getObjectsOfType(App::Origin::getClassTypeId());
|
||||
if(!app_origin.empty()) {
|
||||
ViewProviderOrigin* origin;
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->activeDocument()->getViewProvider(app_origin[0]));
|
||||
origin->setTemporaryVisibilityMode(true, Gui::Application::Instance->activeDocument());
|
||||
origin->setTemporaryVisibilityAxis(true);
|
||||
}
|
||||
}
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->getViewProvider(app_origin.front() ));
|
||||
origin->setTemporaryVisibility(true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TaskMirroredParameters::updateUI()
|
||||
@@ -281,8 +281,8 @@ TaskMirroredParameters::~TaskMirroredParameters()
|
||||
auto app_origin = part->getObjectsOfType(App::Origin::getClassTypeId());
|
||||
if(!app_origin.empty()) {
|
||||
ViewProviderOrigin* origin;
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->activeDocument()->getViewProvider(app_origin[0]));
|
||||
origin->setTemporaryVisibilityMode(false);
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->getViewProvider(app_origin[0]));
|
||||
origin->resetTemporaryVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/Part.h>
|
||||
#include <App/Line.h>
|
||||
#include <App/Origin.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
@@ -163,9 +164,8 @@ void TaskPolarPatternParameters::setupUI()
|
||||
auto app_origin = part->getObjectsOfType(App::Origin::getClassTypeId());
|
||||
if(!app_origin.empty()) {
|
||||
ViewProviderOrigin* origin;
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->activeDocument()->getViewProvider(app_origin[0]));
|
||||
origin->setTemporaryVisibilityMode(true, Gui::Application::Instance->activeDocument());
|
||||
origin->setTemporaryVisibilityAxis(true);
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->getViewProvider(app_origin[0]));
|
||||
origin->setTemporaryVisibility(true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -365,7 +365,7 @@ TaskPolarPatternParameters::~TaskPolarPatternParameters()
|
||||
if(!app_origin.empty()) {
|
||||
ViewProviderOrigin* origin;
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->activeDocument()->getViewProvider(app_origin[0]));
|
||||
origin->setTemporaryVisibilityMode(false);
|
||||
origin->resetTemporaryVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <App/Document.h>
|
||||
#include <App/Part.h>
|
||||
#include <App/Origin.h>
|
||||
#include <App/Line.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
@@ -136,15 +136,15 @@ TaskRevolutionParameters::TaskRevolutionParameters(PartDesignGui::ViewProvider*
|
||||
auto app_origin = part->getObjectsOfType(App::Origin::getClassTypeId());
|
||||
if(!app_origin.empty()) {
|
||||
ViewProviderOrigin* origin;
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->activeDocument()->getViewProvider(app_origin[0]));
|
||||
origin->setTemporaryVisibilityMode(true, Gui::Application::Instance->activeDocument());
|
||||
origin->setTemporaryVisibilityAxis(true);
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->getViewProvider(app_origin[0]));
|
||||
origin->setTemporaryVisibility(true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TaskRevolutionParameters::fillAxisCombo(bool forceRefill)
|
||||
{
|
||||
// TODO share the code with TaskTransformedParameters (2015-08-31, Fat-Zer)
|
||||
bool oldVal_blockUpdate = blockUpdate;
|
||||
blockUpdate = true;
|
||||
|
||||
@@ -174,16 +174,21 @@ void TaskRevolutionParameters::fillAxisCombo(bool forceRefill)
|
||||
}
|
||||
|
||||
//add part axes
|
||||
App::DocumentObject* line = 0;
|
||||
line = getPartLines(App::Part::BaselineTypes[0]);
|
||||
if(line)
|
||||
addAxisToCombo(line,"",tr("Base X axis"));
|
||||
line = getPartLines(App::Part::BaselineTypes[1]);
|
||||
if(line)
|
||||
addAxisToCombo(line,"",tr("Base Y axis"));
|
||||
line = getPartLines(App::Part::BaselineTypes[2]);
|
||||
if(line)
|
||||
addAxisToCombo(line,"",tr("Base Z axis"));
|
||||
App::DocumentObject* obj = vp->getObject();
|
||||
App::Part* part = getPartFor(obj, false);
|
||||
|
||||
if (part) {
|
||||
try {
|
||||
std::vector<App::DocumentObject*> origs = part->getObjectsOfType(App::Origin::getClassTypeId());
|
||||
|
||||
App::Origin* orig = static_cast<App::Origin*>(origs[0]);
|
||||
addAxisToCombo(orig->getX(),"",tr("Base X axis"));
|
||||
addAxisToCombo(orig->getY(),"",tr("Base Y axis"));
|
||||
addAxisToCombo(orig->getZ(),"",tr("Base Z axis"));
|
||||
} catch (const Base::Exception &ex) {
|
||||
Base::Console().Error ("%s\n", ex.what() );
|
||||
}
|
||||
}
|
||||
|
||||
//add "Select reference"
|
||||
addAxisToCombo(0,std::string(),tr("Select reference..."));
|
||||
@@ -360,8 +365,8 @@ TaskRevolutionParameters::~TaskRevolutionParameters()
|
||||
auto app_origin = part->getObjectsOfType(App::Origin::getClassTypeId());
|
||||
if(!app_origin.empty()) {
|
||||
ViewProviderOrigin* origin;
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->activeDocument()->getViewProvider(app_origin[0]));
|
||||
origin->setTemporaryVisibilityMode(false);
|
||||
origin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->getViewProvider(app_origin[0]));
|
||||
origin->resetTemporaryVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,10 +33,9 @@
|
||||
#include <Base/Console.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/Plane.h>
|
||||
#include <App/Part.h>
|
||||
#include <App/Origin.h>
|
||||
#include <App/Line.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
@@ -200,59 +199,6 @@ void TaskSketchBasedParameters::recomputeFeature()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
App::DocumentObject* TaskSketchBasedParameters::getPartPlanes(const char* str) const {
|
||||
|
||||
//TODO: Adjust to GRAPH handling when available
|
||||
App::DocumentObject* obj = vp->getObject();
|
||||
App::Part* part = getPartFor(obj, false);
|
||||
if(!part)
|
||||
return nullptr;
|
||||
|
||||
std::vector<App::DocumentObject*> origs = part->getObjectsOfType(App::Origin::getClassTypeId());
|
||||
if(origs.size()<1)
|
||||
return nullptr;
|
||||
|
||||
App::Origin* orig = static_cast<App::Origin*>(origs[0]);
|
||||
auto planes = orig->getObjectsOfType(App::Plane::getClassTypeId());
|
||||
for(App::DocumentObject* plane : planes) {
|
||||
|
||||
if( strcmp(static_cast<App::Plane*>(plane)->PlaneType.getValue(), str) == 0)
|
||||
return plane;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
App::DocumentObject* TaskSketchBasedParameters::getPartLines(const char* str) const {
|
||||
|
||||
//TODO: Adjust to GRAPH handling when available
|
||||
App::DocumentObject* obj = vp->getObject();
|
||||
App::Part* part = getPartFor(obj, false);
|
||||
|
||||
|
||||
std::vector<App::DocumentObject*> origs;
|
||||
if(part)
|
||||
origs = part->getObjectsOfType(App::Origin::getClassTypeId());
|
||||
else
|
||||
origs = vp->getObject()->getDocument()->getObjectsOfType(App::Origin::getClassTypeId());
|
||||
|
||||
if(origs.size()<1)
|
||||
return nullptr;
|
||||
|
||||
App::Origin* orig = static_cast<App::Origin*>(origs[0]);
|
||||
auto lines = orig->getObjectsOfType(App::Line::getClassTypeId());
|
||||
for(App::DocumentObject* line : lines) {
|
||||
|
||||
if( strcmp(static_cast<App::Line*>(line)->LineType.getValue(), str) == 0)
|
||||
return line;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
TaskSketchBasedParameters::~TaskSketchBasedParameters()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -56,9 +56,6 @@ protected:
|
||||
QString getFaceReference(const QString& obj, const QString& sub) const;
|
||||
void recomputeFeature();
|
||||
|
||||
App::DocumentObject* getPartPlanes(const char* str) const;
|
||||
App::DocumentObject* getPartLines(const char* str) const;
|
||||
|
||||
protected Q_SLOTS:
|
||||
void onUpdateView(bool on);
|
||||
|
||||
|
||||
@@ -36,8 +36,7 @@
|
||||
#include <App/Document.h>
|
||||
#include <App/Part.h>
|
||||
#include <App/Origin.h>
|
||||
#include <App/Plane.h>
|
||||
#include <App/Line.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
@@ -173,51 +172,6 @@ void TaskTransformedParameters::removeItemFromListWidget(QListWidget* widget, co
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
App::DocumentObject* TaskTransformedParameters::getPartPlanes(const char* str) const {
|
||||
//TODO: Adjust to GRAPH handling when available
|
||||
App::DocumentObject* obj = getObject();
|
||||
App::Part* part = getPartFor(obj, false);
|
||||
|
||||
if (part) {
|
||||
std::vector<App::DocumentObject*> origs = part->getObjectsOfType(App::Origin::getClassTypeId());
|
||||
if(origs.size()<1)
|
||||
return nullptr;
|
||||
|
||||
App::Origin* orig = static_cast<App::Origin*>(origs[0]);
|
||||
auto planes = orig->getObjectsOfType(App::Plane::getClassTypeId());
|
||||
for(App::DocumentObject* plane : planes) {
|
||||
if( strcmp(static_cast<App::Plane*>(plane)->PlaneType.getValue(), str) == 0)
|
||||
return plane;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
App::DocumentObject* TaskTransformedParameters::getPartLines(const char* str) const {
|
||||
|
||||
//TODO: Adjust to GRAPH handling when available
|
||||
App::DocumentObject* obj = getObject();
|
||||
App::Part* part = getPartFor(obj, false);
|
||||
if (part) {
|
||||
std::vector<App::DocumentObject*> origs = part->getObjectsOfType(App::Origin::getClassTypeId());
|
||||
if(origs.size()<1)
|
||||
return nullptr;
|
||||
|
||||
App::Origin* orig = static_cast<App::Origin*>(origs[0]);
|
||||
auto lines = orig->getObjectsOfType(App::Line::getClassTypeId());
|
||||
for(App::DocumentObject* line : lines) {
|
||||
|
||||
if( strcmp(static_cast<App::Line*>(line)->LineType.getValue(), str) == 0)
|
||||
return line;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void TaskTransformedParameters::fillAxisCombo(ComboLinks &combolinks,
|
||||
Part::Part2DObject* sketch)
|
||||
{
|
||||
@@ -237,16 +191,21 @@ void TaskTransformedParameters::fillAxisCombo(ComboLinks &combolinks,
|
||||
}
|
||||
|
||||
//add part axes
|
||||
App::DocumentObject* line = 0;
|
||||
line = getPartLines(App::Part::BaselineTypes[0]);
|
||||
if(line)
|
||||
combolinks.addLink(line,"",tr("Base X axis"));
|
||||
line = getPartLines(App::Part::BaselineTypes[1]);
|
||||
if(line)
|
||||
combolinks.addLink(line,"",tr("Base Y axis"));
|
||||
line = getPartLines(App::Part::BaselineTypes[2]);
|
||||
if(line)
|
||||
combolinks.addLink(line,"",tr("Base Z axis"));
|
||||
App::DocumentObject* obj = getObject();
|
||||
App::Part* part = getPartFor(obj, false);
|
||||
|
||||
if (part) {
|
||||
try {
|
||||
std::vector<App::DocumentObject*> origs = part->getObjectsOfType(App::Origin::getClassTypeId());
|
||||
|
||||
App::Origin* orig = static_cast<App::Origin*>(origs[0]);
|
||||
combolinks.addLink(orig->getX(),"",tr("Base X axis"));
|
||||
combolinks.addLink(orig->getY(),"",tr("Base Y axis"));
|
||||
combolinks.addLink(orig->getZ(),"",tr("Base Z axis"));
|
||||
} catch (const Base::Exception &ex) {
|
||||
Base::Console().Error ("%s\n", ex.what() );
|
||||
}
|
||||
}
|
||||
|
||||
//add "Select reference"
|
||||
combolinks.addLink(0,std::string(),tr("Select reference..."));
|
||||
@@ -270,20 +229,24 @@ void TaskTransformedParameters::fillPlanesCombo(ComboLinks &combolinks,
|
||||
}
|
||||
|
||||
//add part baseplanes
|
||||
App::DocumentObject* plane = 0;
|
||||
plane = getPartPlanes(App::Part::BaseplaneTypes[0]);
|
||||
if(plane)
|
||||
combolinks.addLink(plane,"",tr("Base XY plane"));
|
||||
plane = getPartPlanes(App::Part::BaseplaneTypes[1]);
|
||||
if(plane)
|
||||
combolinks.addLink(plane,"",tr("Base XZ plane"));
|
||||
plane = getPartPlanes(App::Part::BaseplaneTypes[2]);
|
||||
if(plane)
|
||||
combolinks.addLink(plane,"",tr("Base YZ plane"));
|
||||
App::DocumentObject* obj = getObject();
|
||||
App::Part* part = getPartFor(obj, false);
|
||||
|
||||
if (part) {
|
||||
try {
|
||||
std::vector<App::DocumentObject*> origs = part->getObjectsOfType(App::Origin::getClassTypeId());
|
||||
|
||||
App::Origin* orig = static_cast<App::Origin*>(origs[0]);
|
||||
combolinks.addLink(orig->getXY(),"",tr("Base XY plane"));
|
||||
combolinks.addLink(orig->getYZ(),"",tr("Base YZ plane"));
|
||||
combolinks.addLink(orig->getXZ(),"",tr("Base XZ plane"));
|
||||
} catch (const Base::Exception &ex) {
|
||||
Base::Console().Error ("%s\n", ex.what() );
|
||||
}
|
||||
}
|
||||
|
||||
//add "Select reference"
|
||||
combolinks.addLink(0,std::string(),tr("Select reference..."));
|
||||
|
||||
}
|
||||
|
||||
void TaskTransformedParameters::recomputeFeature() {
|
||||
|
||||
@@ -189,9 +189,6 @@ protected:
|
||||
virtual void clearButtons()=0;
|
||||
static void removeItemFromListWidget(QListWidget* widget, const char* itemstr);
|
||||
|
||||
App::DocumentObject* getPartPlanes(const char* str) const;
|
||||
App::DocumentObject* getPartLines(const char* str) const;
|
||||
|
||||
void fillAxisCombo(ComboLinks &combolinks, Part::Part2DObject *sketch);
|
||||
void fillPlanesCombo(ComboLinks &combolinks, Part2DObject *sketch);
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
#include <App/Plane.h>
|
||||
#include <App/OriginFeature.h>
|
||||
|
||||
#include <Mod/Part/App/Geometry.h>
|
||||
#include <Mod/Part/App/DatumFeature.h>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/QuantityPy.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/Plane.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <CXX/Objects.hxx>
|
||||
|
||||
// inclusion of the generated files (generated out of SketchObjectSFPy.xml)
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#endif
|
||||
|
||||
#include <App/DocumentObjectGroup.h>
|
||||
#include <App/Plane.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/Command.h>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include <App/Plane.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <Gui/Action.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
|
||||
Reference in New Issue
Block a user