[TD]implement BrokenView
This commit is contained in:
@@ -355,16 +355,9 @@ TopoDS_Shape ShapeExtractor::stripInfiniteShapes(TopoDS_Shape inShape)
|
||||
return TopoDS_Shape(std::move(comp));
|
||||
}
|
||||
|
||||
bool ShapeExtractor::is2dObject(App::DocumentObject* obj)
|
||||
bool ShapeExtractor::is2dObject(const App::DocumentObject* obj)
|
||||
{
|
||||
// TODO:: the check for an object being a sketch should be done as in the commented
|
||||
// if statement below. To do this, we need to include Mod/Sketcher/SketchObject.h,
|
||||
// but that makes TechDraw dependent on Eigen libraries which we don't use. As a
|
||||
// workaround we will inspect the object's class name.
|
||||
// if (obj->isDerivedFrom(Sketcher::SketchObject::getClassTypeId())) {
|
||||
std::string objTypeName = obj->getTypeId().getName();
|
||||
std::string sketcherToken("Sketcher");
|
||||
if (objTypeName.find(sketcherToken) != std::string::npos) {
|
||||
if (isSketchObject(obj)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -375,7 +368,7 @@ bool ShapeExtractor::is2dObject(App::DocumentObject* obj)
|
||||
}
|
||||
|
||||
// just these for now
|
||||
bool ShapeExtractor::isEdgeType(App::DocumentObject* obj)
|
||||
bool ShapeExtractor::isEdgeType(const App::DocumentObject* obj)
|
||||
{
|
||||
bool result = false;
|
||||
Base::Type t = obj->getTypeId();
|
||||
@@ -391,7 +384,7 @@ bool ShapeExtractor::isEdgeType(App::DocumentObject* obj)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ShapeExtractor::isPointType(App::DocumentObject* obj)
|
||||
bool ShapeExtractor::isPointType(const App::DocumentObject* obj)
|
||||
{
|
||||
// Base::Console().Message("SE::isPointType(%s)\n", obj->getNameInDocument());
|
||||
if (obj) {
|
||||
@@ -407,7 +400,7 @@ bool ShapeExtractor::isPointType(App::DocumentObject* obj)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ShapeExtractor::isDraftPoint(App::DocumentObject* obj)
|
||||
bool ShapeExtractor::isDraftPoint(const App::DocumentObject* obj)
|
||||
{
|
||||
// Base::Console().Message("SE::isDraftPoint()\n");
|
||||
//if the docObj doesn't have a Proxy property, it definitely isn't a Draft point
|
||||
@@ -422,7 +415,7 @@ bool ShapeExtractor::isDraftPoint(App::DocumentObject* obj)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ShapeExtractor::isDatumPoint(App::DocumentObject* obj)
|
||||
bool ShapeExtractor::isDatumPoint(const App::DocumentObject* obj)
|
||||
{
|
||||
std::string objTypeName = obj->getTypeId().getName();
|
||||
std::string pointToken("Point");
|
||||
@@ -434,7 +427,7 @@ bool ShapeExtractor::isDatumPoint(App::DocumentObject* obj)
|
||||
|
||||
|
||||
//! get the location of a point object
|
||||
Base::Vector3d ShapeExtractor::getLocation3dFromFeat(App::DocumentObject* obj)
|
||||
Base::Vector3d ShapeExtractor::getLocation3dFromFeat(const App::DocumentObject* obj)
|
||||
{
|
||||
// Base::Console().Message("SE::getLocation3dFromFeat()\n");
|
||||
if (!isPointType(obj)) {
|
||||
@@ -444,7 +437,7 @@ Base::Vector3d ShapeExtractor::getLocation3dFromFeat(App::DocumentObject* obj)
|
||||
// //Draft Points are not necc. Part::PartFeature??
|
||||
// //if Draft option "use part primitives" is not set are Draft points still PartFeature?
|
||||
|
||||
Part::Feature* pf = dynamic_cast<Part::Feature*>(obj);
|
||||
const Part::Feature* pf = dynamic_cast<const Part::Feature*>(obj);
|
||||
if (pf) {
|
||||
Part::TopoShape pts = pf->Shape.getShape();
|
||||
pts.setPlacement(pf->globalPlacement());
|
||||
@@ -471,3 +464,18 @@ TopoDS_Shape ShapeExtractor::getLocatedShape(const App::DocumentObject* docObj)
|
||||
return shape.getShape();
|
||||
}
|
||||
|
||||
bool ShapeExtractor::isSketchObject(const App::DocumentObject* obj)
|
||||
{
|
||||
// TODO:: the check for an object being a sketch should be done as in the commented
|
||||
// if statement below. To do this, we need to include Mod/Sketcher/SketchObject.h,
|
||||
// but that makes TechDraw dependent on Eigen libraries which we don't use. As a
|
||||
// workaround we will inspect the object's class name.
|
||||
// if (obj->isDerivedFrom(Sketcher::SketchObject::getClassTypeId())) {
|
||||
std::string objTypeName = obj->getTypeId().getName();
|
||||
std::string sketcherToken("Sketcher");
|
||||
if (objTypeName.find(sketcherToken) != std::string::npos) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user