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:
Alexander Golubev
2015-09-01 05:35:10 +03:00
committed by Stefan Tröger
parent ecbb576330
commit 797d6d3a11
47 changed files with 641 additions and 673 deletions

View File

@@ -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));
}
}

View File

@@ -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>

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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());
}

View File

@@ -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>

View File

@@ -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>

View File

@@ -31,7 +31,7 @@
#endif
#include <App/Plane.h>
#include <App/OriginFeature.h>
#include <Base/Exception.h>
#include "FeatureMirrored.h"
#include "DatumPlane.h"

View File

@@ -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;

View File

@@ -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())