Prevent DetailView crop circle marker

This commit is contained in:
WandererFan
2017-01-11 15:40:33 -05:00
parent 0cb29cfa45
commit afa8c9fece
4 changed files with 53 additions and 45 deletions

View File

@@ -67,6 +67,7 @@
#include "DrawUtil.h"
#include "GeometryObject.h"
#include "DrawViewPart.h"
#include "DrawViewDetail.h"
using namespace TechDrawGeometry;
using namespace TechDraw;
@@ -77,9 +78,9 @@ struct EdgePoints {
TopoDS_Edge edge;
};
GeometryObject::GeometryObject(const string& parent) :
Scale(1.f),
GeometryObject::GeometryObject(const string& parent, TechDraw::DrawView* parentObj) :
m_parentName(parent),
m_parent(parentObj),
m_isoCount(0)
{
}
@@ -89,12 +90,6 @@ GeometryObject::~GeometryObject()
clear();
}
void GeometryObject::setScale(double value)
{
Scale = value;
}
const std::vector<BaseGeom *> GeometryObject::getVisibleFaceEdges(const bool smooth, const bool seam) const
{
std::vector<BaseGeom *> result;
@@ -157,17 +152,6 @@ void GeometryObject::projectShape(const TopoDS_Shape& input,
// Clear previous Geometry
clear();
//*******
gp_Dir x = viewAxis.XDirection();
gp_Dir y = viewAxis.YDirection();
gp_Dir z = viewAxis.Direction();
Base::Vector3d vx(x.X(),x.Y(),x.Z());
Base::Vector3d vy(y.X(),y.Y(),y.Z());
Base::Vector3d vz(z.X(),z.Y(),z.Z());
// Base::Console().Message("TRACE - GO::projectShape - %s viewAxis x: %s y: %s Z: %s\n",m_parentName.c_str(),
// DrawUtil::formatVector(vx).c_str(), DrawUtil::formatVector(vy).c_str(), DrawUtil::formatVector(vz).c_str());
//*******
auto start = chrono::high_resolution_clock::now();
Handle_HLRBRep_Algo brep_hlr = NULL;
@@ -301,6 +285,7 @@ void GeometryObject::addGeomFromCompound(TopoDS_Shape edgeCompound, edgeClass ca
edgeGeom.push_back(base);
//add vertices of new edge if not already in list
bool skipDetail = false;
if (visible) {
BaseGeom* lastAdded = edgeGeom.back();
bool v1Add = true, v2Add = true;
@@ -310,9 +295,23 @@ void GeometryObject::addGeomFromCompound(TopoDS_Shape edgeCompound, edgeClass ca
TechDrawGeometry::Circle* circle = dynamic_cast<TechDrawGeometry::Circle*>(lastAdded);
TechDrawGeometry::Vertex* c1 = nullptr;
if (circle) {
c1 = new TechDrawGeometry::Vertex(circle->center);
c1->isCenter = true;
c1->visible = true;
// if this is the center of a detail view, skip it
TechDraw::DrawViewDetail* detail = isParentDetail();
if (detail != nullptr) {
double scale = m_parent->Scale.getValue();
if ((circle->center == Base::Vector2d(0.0,0.0)) &&
(DrawUtil::fpCompare(circle->radius, scale * detail->getFudgeRadius()))) {
skipDetail = true;
} else {
c1 = new TechDrawGeometry::Vertex(circle->center);
c1->isCenter = true;
c1->visible = true;
}
} else {
c1 = new TechDrawGeometry::Vertex(circle->center);
c1->isCenter = true;
c1->visible = true;
}
}
std::vector<Vertex *>::iterator itVertex = vertexGeom.begin();
@@ -323,7 +322,7 @@ void GeometryObject::addGeomFromCompound(TopoDS_Shape edgeCompound, edgeClass ca
if ((*itVertex)->isEqual(v2,Precision::Confusion())) {
v2Add = false;
}
if (circle) {
if (circle && !skipDetail) {
if ((*itVertex)->isEqual(c1,Precision::Confusion())) {
c1Add = false;
}
@@ -343,7 +342,7 @@ void GeometryObject::addGeomFromCompound(TopoDS_Shape edgeCompound, edgeClass ca
delete v2;
}
if (circle) {
if (circle && !skipDetail) {
if (c1Add) {
vertexGeom.push_back(c1);
c1->visible = true;
@@ -367,6 +366,18 @@ void GeometryObject::addFaceGeom(Face* f)
faceGeom.push_back(f);
}
TechDraw::DrawViewDetail* GeometryObject::isParentDetail()
{
TechDraw::DrawViewDetail* result = nullptr;
if (m_parent != nullptr) {
TechDraw::DrawViewDetail* detail = dynamic_cast<TechDraw::DrawViewDetail*>(m_parent);
if (detail != nullptr) {
result = detail;
}
}
return result;
}
bool GeometryObject::isWithinArc(double theta, double first,
double last, bool cw) const
@@ -439,16 +450,6 @@ bool GeometryObject::findVertex(Base::Vector2d v)
return found;
}
//"Top" X should == "Front" X for front = [front,rear]
//"Top" X should == "Front" X for front = [right]
//"Top" X should == "Front" -X for front = [left]
//"Top" X should == "Front" X for front = [top,bottom]
//view XAxis == anchor XAxis except
// anchor.ProjDir = (-1,0,0) then
// view XAxis == -Anchor XAxis
/// utility non-class member functions
//! gets a coordinate system that matches view system used in 3D with +Z up (or +Y up if neccessary)
//! used for individual views, but not secondary views in projection groups