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
@@ -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()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user