Skip to content

Commit

Permalink
Performance Ph2
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan authored and yorikvanhavre committed Oct 6, 2016
1 parent 3cf036d commit 001bbf5
Show file tree
Hide file tree
Showing 9 changed files with 345 additions and 179 deletions.
16 changes: 14 additions & 2 deletions src/Mod/TechDraw/App/DrawUtil.cpp
Expand Up @@ -44,6 +44,8 @@
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <BRepGProp.hxx>
#include <GProp_GProps.hxx>

#endif

Expand Down Expand Up @@ -118,11 +120,21 @@ bool DrawUtil::isSamePoint(TopoDS_Vertex v1, TopoDS_Vertex v2)
return result;
}

bool DrawUtil::isZeroEdge(TopoDS_Edge& e)
bool DrawUtil::isZeroEdge(TopoDS_Edge e)
{
TopoDS_Vertex vStart = TopExp::FirstVertex(e);
TopoDS_Vertex vEnd = TopExp::LastVertex(e);
return isSamePoint(vStart,vEnd);
bool result = isSamePoint(vStart,vEnd);
if (result) {
//closed edge will have same V's but non-zero length
GProp_GProps props;
BRepGProp::LinearProperties(e, props);
double len = props.Mass();
if (len > Precision::Confusion()) {
result = false;
}
}
return result;
}

//============================
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/TechDraw/App/DrawUtil.h
Expand Up @@ -41,7 +41,7 @@ class TechDrawExport DrawUtil {
static std::string getGeomTypeFromName(std::string geomName);
static std::string makeGeomName(std::string geomType, int index);
static bool isSamePoint(TopoDS_Vertex v1, TopoDS_Vertex v2);
static bool isZeroEdge(TopoDS_Edge& e);
static bool isZeroEdge(TopoDS_Edge e);
//debugging routines
static void dumpVertexes(const char* text, const TopoDS_Shape& s);
static void dumpEdge(char* label, int i, TopoDS_Edge e);
Expand Down
3 changes: 1 addition & 2 deletions src/Mod/TechDraw/App/DrawView.cpp
Expand Up @@ -134,7 +134,7 @@ short DrawView::mustExecute() const
if (result) {
return result;
}
return App::DocumentObject::mustExecute(); return App::DocumentObject::mustExecute();
return App::DocumentObject::mustExecute();
}

////you must override this in derived class
Expand All @@ -146,7 +146,6 @@ QRectF DrawView::getRect() const

void DrawView::onDocumentRestored()
{
// Rebuild the view
DrawView::execute();
}

Expand Down

0 comments on commit 001bbf5

Please sign in to comment.