rename 2d tool classes to be consistent with 3d classes
This commit is contained in:
@@ -119,8 +119,8 @@ int DrawParametricTemplate::drawLine(double x1, double y1, double x2, double y2)
|
||||
{
|
||||
TechDrawGeometry::Generic *line = new TechDrawGeometry::Generic();
|
||||
|
||||
line->points.push_back(Base::Vector2D(x1, y1));
|
||||
line->points.push_back(Base::Vector2D(x2, y2));
|
||||
line->points.push_back(Base::Vector2d(x1, y1));
|
||||
line->points.push_back(Base::Vector2d(x2, y2));
|
||||
|
||||
geom.push_back(line); // Push onto geometry stack
|
||||
return geom.size() -1;
|
||||
@@ -148,4 +148,4 @@ template<> const char* TechDraw::DrawParametricTemplatePython::getViewProviderNa
|
||||
|
||||
// explicit template instantiation
|
||||
template class TechDrawExport FeaturePythonT<TechDraw::DrawParametricTemplate>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,15 +286,15 @@ double DrawViewDimension::getDimValue() const
|
||||
int idx = DrawUtil::getIndexFromName(subElements[0]);
|
||||
TechDrawGeometry::BaseGeom* geom = getViewPart()->getProjEdgeByIndex(idx);
|
||||
TechDrawGeometry::Generic* gen = static_cast<TechDrawGeometry::Generic*>(geom);
|
||||
Base::Vector2D start = gen->points[0];
|
||||
Base::Vector2D end = gen->points[1];
|
||||
Base::Vector2D line = end - start;
|
||||
Base::Vector2d start = gen->points[0];
|
||||
Base::Vector2d end = gen->points[1];
|
||||
Base::Vector2d line = end - start;
|
||||
if (Type.isValue("Distance")) {
|
||||
result = line.Length() / getViewPart()->Scale.getValue();
|
||||
} else if (Type.isValue("DistanceX")) {
|
||||
return fabs(line.fX) / getViewPart()->Scale.getValue();
|
||||
return fabs(line.x) / getViewPart()->Scale.getValue();
|
||||
} else {
|
||||
result = fabs(line.fY) / getViewPart()->Scale.getValue();
|
||||
result = fabs(line.y) / getViewPart()->Scale.getValue();
|
||||
}
|
||||
}else if (getRefType() == twoEdge) {
|
||||
//only works for straight line edges
|
||||
@@ -304,35 +304,35 @@ double DrawViewDimension::getDimValue() const
|
||||
TechDrawGeometry::BaseGeom* geom1 = getViewPart()->getProjEdgeByIndex(idx1);
|
||||
TechDrawGeometry::Generic* gen0 = static_cast<TechDrawGeometry::Generic*>(geom0);
|
||||
TechDrawGeometry::Generic* gen1 = static_cast<TechDrawGeometry::Generic*>(geom1);
|
||||
Base::Vector2D s0 = gen0->points[0];
|
||||
Base::Vector2D e0 = gen0->points[1];
|
||||
Base::Vector2D s1 = gen1->points[0];
|
||||
Base::Vector2D e1 = gen1->points[1];
|
||||
Base::Vector2d s0 = gen0->points[0];
|
||||
Base::Vector2d e0 = gen0->points[1];
|
||||
Base::Vector2d s1 = gen1->points[0];
|
||||
Base::Vector2d e1 = gen1->points[1];
|
||||
if (Type.isValue("Distance")) {
|
||||
result = dist2Segs(s0,e0,s1,e1) / getViewPart()->Scale.getValue();
|
||||
} else if (Type.isValue("DistanceX")) {
|
||||
Base::Vector2D p1 = geom0->nearPoint(geom1);
|
||||
Base::Vector2D p2 = geom1->nearPoint(geom0);
|
||||
result = fabs(p1.fX - p2.fX) / getViewPart()->Scale.getValue();
|
||||
Base::Vector2d p1 = geom0->nearPoint(geom1);
|
||||
Base::Vector2d p2 = geom1->nearPoint(geom0);
|
||||
result = fabs(p1.x - p2.x) / getViewPart()->Scale.getValue();
|
||||
} else if (Type.isValue("DistanceY")) {
|
||||
Base::Vector2D p1 = geom0->nearPoint(geom1);
|
||||
Base::Vector2D p2 = geom1->nearPoint(geom0);
|
||||
result = fabs(p1.fY - p2.fY) / getViewPart()->Scale.getValue();
|
||||
Base::Vector2d p1 = geom0->nearPoint(geom1);
|
||||
Base::Vector2d p2 = geom1->nearPoint(geom0);
|
||||
result = fabs(p1.y - p2.y) / getViewPart()->Scale.getValue();
|
||||
}
|
||||
} else if (getRefType() == twoVertex) {
|
||||
int idx0 = DrawUtil::getIndexFromName(subElements[0]);
|
||||
int idx1 = DrawUtil::getIndexFromName(subElements[1]);
|
||||
TechDrawGeometry::Vertex* v0 = getViewPart()->getProjVertexByIndex(idx0);
|
||||
TechDrawGeometry::Vertex* v1 = getViewPart()->getProjVertexByIndex(idx1);
|
||||
Base::Vector2D start = v0->pnt;
|
||||
Base::Vector2D end = v1->pnt;
|
||||
Base::Vector2D line = end - start;
|
||||
Base::Vector2d start = v0->pnt;
|
||||
Base::Vector2d end = v1->pnt;
|
||||
Base::Vector2d line = end - start;
|
||||
if (Type.isValue("Distance")) {
|
||||
result = line.Length() / getViewPart()->Scale.getValue();
|
||||
} else if (Type.isValue("DistanceX")) {
|
||||
result = fabs(line.fX) / getViewPart()->Scale.getValue();
|
||||
result = fabs(line.x) / getViewPart()->Scale.getValue();
|
||||
} else {
|
||||
result = fabs(line.fY) / getViewPart()->Scale.getValue();
|
||||
result = fabs(line.y) / getViewPart()->Scale.getValue();
|
||||
}
|
||||
} else if (getRefType() == vertexEdge) {
|
||||
int idx0 = DrawUtil::getIndexFromName(subElements[0]);
|
||||
@@ -346,14 +346,14 @@ double DrawViewDimension::getDimValue() const
|
||||
e = getViewPart()->getProjEdgeByIndex(idx1);
|
||||
v = getViewPart()->getProjVertexByIndex(idx0);
|
||||
}
|
||||
Base::Vector2D nearPoint = e->nearPoint(v->pnt);
|
||||
Base::Vector2D line = nearPoint - v->pnt;
|
||||
Base::Vector2d nearPoint = e->nearPoint(v->pnt);
|
||||
Base::Vector2d line = nearPoint - v->pnt;
|
||||
if (Type.isValue("Distance")) {
|
||||
result = e->minDist(v->pnt) / getViewPart()->Scale.getValue();
|
||||
} else if (Type.isValue("DistanceX")) {
|
||||
result = fabs(line.fX) / getViewPart()->Scale.getValue();
|
||||
result = fabs(line.x) / getViewPart()->Scale.getValue();
|
||||
} else {
|
||||
result = fabs(line.fY) / getViewPart()->Scale.getValue();
|
||||
result = fabs(line.y) / getViewPart()->Scale.getValue();
|
||||
}
|
||||
} //else tarfu
|
||||
} else if(Type.isValue("Radius")){
|
||||
@@ -371,7 +371,7 @@ double DrawViewDimension::getDimValue() const
|
||||
} else if(Type.isValue("Angle")){
|
||||
// Must project lines to 2D so cannot use measurement framework this time
|
||||
//Relcalculate the measurement based on references stored.
|
||||
//WF: why not use projected geom in GeomObject and Vector2D.GetAngle? intersection pt & direction issues?
|
||||
//WF: why not use projected geom in GeomObject and Vector2d.GetAngle? intersection pt & direction issues?
|
||||
//TODO: do we need to distinguish inner vs outer angle? -wf
|
||||
// if(subElements.size() != 2) {
|
||||
// throw Base::Exception("FVD - Two references required for angle measurement");
|
||||
@@ -395,11 +395,11 @@ double DrawViewDimension::getDimValue() const
|
||||
TechDrawGeometry::Generic *gen1 = static_cast<TechDrawGeometry::Generic *>(edge0);
|
||||
TechDrawGeometry::Generic *gen2 = static_cast<TechDrawGeometry::Generic *>(edge1);
|
||||
|
||||
Base::Vector3d p1S(gen1->points.at(0).fX, gen1->points.at(0).fY, 0.);
|
||||
Base::Vector3d p1E(gen1->points.at(1).fX, gen1->points.at(1).fY, 0.);
|
||||
Base::Vector3d p1S(gen1->points.at(0).x, gen1->points.at(0).y, 0.);
|
||||
Base::Vector3d p1E(gen1->points.at(1).x, gen1->points.at(1).y, 0.);
|
||||
|
||||
Base::Vector3d p2S(gen2->points.at(0).fX, gen2->points.at(0).fY, 0.);
|
||||
Base::Vector3d p2E(gen2->points.at(1).fX, gen2->points.at(1).fY, 0.);
|
||||
Base::Vector3d p2S(gen2->points.at(0).x, gen2->points.at(0).y, 0.);
|
||||
Base::Vector3d p2E(gen2->points.at(1).x, gen2->points.at(1).y, 0.);
|
||||
|
||||
Base::Vector3d dir1 = p1E - p1S;
|
||||
Base::Vector3d dir2 = p2E - p2S;
|
||||
@@ -409,8 +409,8 @@ double DrawViewDimension::getDimValue() const
|
||||
if ((det > 0 ? det : -det) < 1e-10)
|
||||
throw Base::Exception("Invalid selection - Det = 0");
|
||||
|
||||
double c1 = dir1.y*gen1->points.at(0).fX - dir1.x*gen1->points.at(0).fY;
|
||||
double c2 = dir2.y*gen2->points.at(1).fX - dir2.x*gen2->points.at(1).fY;
|
||||
double c1 = dir1.y*gen1->points.at(0).x - dir1.x*gen1->points.at(0).y;
|
||||
double c2 = dir2.y*gen2->points.at(1).x - dir2.x*gen2->points.at(1).y;
|
||||
double x = (dir1.x*c2 - dir2.x*c1)/det;
|
||||
double y = (dir1.y*c2 - dir2.y*c1)/det;
|
||||
|
||||
@@ -519,20 +519,20 @@ void DrawViewDimension::dumpRefs2D(char* text) const
|
||||
}
|
||||
}
|
||||
|
||||
double DrawViewDimension::dist2Segs(Base::Vector2D s1,
|
||||
Base::Vector2D e1,
|
||||
Base::Vector2D s2,
|
||||
Base::Vector2D e2) const
|
||||
double DrawViewDimension::dist2Segs(Base::Vector2d s1,
|
||||
Base::Vector2d e1,
|
||||
Base::Vector2d s2,
|
||||
Base::Vector2d e2) const
|
||||
{
|
||||
gp_Pnt start(s1.fX,s1.fY,0.0);
|
||||
gp_Pnt end(e1.fX,e1.fY,0.0);
|
||||
gp_Pnt start(s1.x,s1.y,0.0);
|
||||
gp_Pnt end(e1.x,e1.y,0.0);
|
||||
TopoDS_Vertex v1 = BRepBuilderAPI_MakeVertex(start);
|
||||
TopoDS_Vertex v2 = BRepBuilderAPI_MakeVertex(end);
|
||||
BRepBuilderAPI_MakeEdge makeEdge1(v1,v2);
|
||||
TopoDS_Edge edge1 = makeEdge1.Edge();
|
||||
|
||||
start = gp_Pnt(s2.fX,s2.fY,0.0);
|
||||
end = gp_Pnt(e2.fX,e2.fY,0.0);
|
||||
start = gp_Pnt(s2.x,s2.y,0.0);
|
||||
end = gp_Pnt(e2.x,e2.y,0.0);
|
||||
v1 = BRepBuilderAPI_MakeVertex(start);
|
||||
v2 = BRepBuilderAPI_MakeVertex(end);
|
||||
BRepBuilderAPI_MakeEdge makeEdge2(v1,v2);
|
||||
|
||||
@@ -103,10 +103,10 @@ protected:
|
||||
|
||||
protected:
|
||||
Measure::Measurement *measurement;
|
||||
double dist2Segs(Base::Vector2D s1,
|
||||
Base::Vector2D e1,
|
||||
Base::Vector2D s2,
|
||||
Base::Vector2D e2) const;
|
||||
double dist2Segs(Base::Vector2d s1,
|
||||
Base::Vector2d e1,
|
||||
Base::Vector2d s2,
|
||||
Base::Vector2d e2) const;
|
||||
private:
|
||||
static const char* TypeEnums[];
|
||||
static const char* MeasureTypeEnums[];
|
||||
|
||||
@@ -101,46 +101,46 @@ BaseGeom::BaseGeom() :
|
||||
}
|
||||
|
||||
|
||||
std::vector<Base::Vector2D> BaseGeom::findEndPoints()
|
||||
std::vector<Base::Vector2d> BaseGeom::findEndPoints()
|
||||
{
|
||||
std::vector<Base::Vector2D> result;
|
||||
std::vector<Base::Vector2d> result;
|
||||
|
||||
gp_Pnt p = BRep_Tool::Pnt(TopExp::FirstVertex(occEdge));
|
||||
result.push_back(Base::Vector2D(p.X(),p.Y()));
|
||||
result.push_back(Base::Vector2d(p.X(),p.Y()));
|
||||
p = BRep_Tool::Pnt(TopExp::LastVertex(occEdge));
|
||||
result.push_back(Base::Vector2D(p.X(),p.Y()));
|
||||
result.push_back(Base::Vector2d(p.X(),p.Y()));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Base::Vector2D BaseGeom::getStartPoint()
|
||||
Base::Vector2d BaseGeom::getStartPoint()
|
||||
{
|
||||
std::vector<Base::Vector2D> verts = findEndPoints();
|
||||
std::vector<Base::Vector2d> verts = findEndPoints();
|
||||
return verts[0];
|
||||
}
|
||||
|
||||
|
||||
Base::Vector2D BaseGeom::getEndPoint()
|
||||
Base::Vector2d BaseGeom::getEndPoint()
|
||||
{
|
||||
std::vector<Base::Vector2D> verts = findEndPoints();
|
||||
std::vector<Base::Vector2d> verts = findEndPoints();
|
||||
return verts[1];
|
||||
}
|
||||
|
||||
|
||||
double BaseGeom::minDist(Base::Vector2D p)
|
||||
double BaseGeom::minDist(Base::Vector2d p)
|
||||
{
|
||||
double minDist = -1.0;
|
||||
gp_Pnt pnt(p.fX,p.fY,0.0);
|
||||
gp_Pnt pnt(p.x,p.y,0.0);
|
||||
TopoDS_Vertex v = BRepBuilderAPI_MakeVertex(pnt);
|
||||
minDist = TechDraw::DrawUtil::simpleMinDist(occEdge,v);
|
||||
return minDist;
|
||||
}
|
||||
|
||||
//!find point on me nearest to p
|
||||
Base::Vector2D BaseGeom::nearPoint(const BaseGeom* p)
|
||||
Base::Vector2d BaseGeom::nearPoint(const BaseGeom* p)
|
||||
{
|
||||
Base::Vector2D result(0.0,0.0);
|
||||
Base::Vector2d result(0.0,0.0);
|
||||
TopoDS_Edge pEdge = p->occEdge;
|
||||
BRepExtrema_DistShapeShape extss(occEdge, pEdge);
|
||||
if (extss.IsDone()) {
|
||||
@@ -148,16 +148,16 @@ Base::Vector2D BaseGeom::nearPoint(const BaseGeom* p)
|
||||
if (count != 0) {
|
||||
gp_Pnt p1;
|
||||
p1 = extss.PointOnShape1(1);
|
||||
result = Base::Vector2D(p1.X(),p1.Y());
|
||||
result = Base::Vector2d(p1.X(),p1.Y());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Base::Vector2D BaseGeom::nearPoint(Base::Vector2D p)
|
||||
Base::Vector2d BaseGeom::nearPoint(Base::Vector2d p)
|
||||
{
|
||||
gp_Pnt pnt(p.fX,p.fY,0.0);
|
||||
Base::Vector2D result(0.0,0.0);
|
||||
gp_Pnt pnt(p.x,p.y,0.0);
|
||||
Base::Vector2d result(0.0,0.0);
|
||||
TopoDS_Vertex v = BRepBuilderAPI_MakeVertex(pnt);
|
||||
BRepExtrema_DistShapeShape extss(occEdge, v);
|
||||
if (extss.IsDone()) {
|
||||
@@ -165,7 +165,7 @@ Base::Vector2D BaseGeom::nearPoint(Base::Vector2D p)
|
||||
if (count != 0) {
|
||||
gp_Pnt p1;
|
||||
p1 = extss.PointOnShape1(1);
|
||||
result = Base::Vector2D(p1.X(),p1.Y());
|
||||
result = Base::Vector2d(p1.X(),p1.Y());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -173,10 +173,10 @@ Base::Vector2D BaseGeom::nearPoint(Base::Vector2D p)
|
||||
|
||||
std::string BaseGeom::dump()
|
||||
{
|
||||
Base::Vector2D start = getStartPoint();
|
||||
Base::Vector2D end = getEndPoint();
|
||||
Base::Vector2d start = getStartPoint();
|
||||
Base::Vector2d end = getEndPoint();
|
||||
std::stringstream ss;
|
||||
ss << "BaseGeom: s:(" << start.fX << "," << start.fY << ") e:(" << end.fX << "," << end.fY << ") ";
|
||||
ss << "BaseGeom: s:(" << start.x << "," << start.y << ") e:(" << end.x << "," << end.y << ") ";
|
||||
ss << "type: " << geomType << " class: " << classOfEdge << " viz: " << visible << " rev: " << reversed;
|
||||
return ss.str();
|
||||
}
|
||||
@@ -265,7 +265,7 @@ Ellipse::Ellipse(const TopoDS_Edge &e)
|
||||
gp_Elips ellp = c.Ellipse();
|
||||
const gp_Pnt &p = ellp.Location();
|
||||
|
||||
center = Base::Vector2D(p.X(), p.Y());
|
||||
center = Base::Vector2d(p.X(), p.Y());
|
||||
|
||||
major = ellp.MajorRadius();
|
||||
minor = ellp.MinorRadius();
|
||||
@@ -296,9 +296,9 @@ AOE::AOE(const TopoDS_Edge &e) : Ellipse(e)
|
||||
cw = (a < 0) ? true: false;
|
||||
largeArc = (l-f > M_PI) ? true : false;
|
||||
|
||||
startPnt = Base::Vector2D(s.X(), s.Y());
|
||||
endPnt = Base::Vector2D(ePt.X(), ePt.Y());
|
||||
midPnt = Base::Vector2D(m.X(), m.Y());
|
||||
startPnt = Base::Vector2d(s.X(), s.Y());
|
||||
endPnt = Base::Vector2d(ePt.X(), ePt.Y());
|
||||
midPnt = Base::Vector2d(m.X(), m.Y());
|
||||
}
|
||||
|
||||
|
||||
@@ -312,7 +312,7 @@ Circle::Circle(const TopoDS_Edge &e)
|
||||
const gp_Pnt& p = circ.Location();
|
||||
|
||||
radius = circ.Radius();
|
||||
center = Base::Vector2D(p.X(), p.Y());
|
||||
center = Base::Vector2d(p.X(), p.Y());
|
||||
}
|
||||
|
||||
|
||||
@@ -337,9 +337,9 @@ AOC::AOC(const TopoDS_Edge &e) : Circle(e)
|
||||
cw = (a < 0) ? true: false;
|
||||
largeArc = (l-f > M_PI) ? true : false;
|
||||
|
||||
startPnt = Base::Vector2D(s.X(), s.Y());
|
||||
endPnt = Base::Vector2D(ePt.X(), ePt.Y());
|
||||
midPnt = Base::Vector2D(m.X(), m.Y());
|
||||
startPnt = Base::Vector2d(s.X(), s.Y());
|
||||
endPnt = Base::Vector2d(ePt.X(), ePt.Y());
|
||||
midPnt = Base::Vector2d(m.X(), m.Y());
|
||||
}
|
||||
|
||||
bool AOC::isOnArc(Base::Vector3d p)
|
||||
@@ -363,7 +363,7 @@ bool AOC::isOnArc(Base::Vector3d p)
|
||||
|
||||
double AOC::distToArc(Base::Vector3d p)
|
||||
{
|
||||
Base::Vector2D p2(p.x,p.y);
|
||||
Base::Vector2d p2(p.x,p.y);
|
||||
double result = minDist(p2);
|
||||
return result;
|
||||
}
|
||||
@@ -406,14 +406,14 @@ Generic::Generic(const TopoDS_Edge &e)
|
||||
if (!polygon.IsNull()) {
|
||||
const TColgp_Array1OfPnt &nodes = polygon->Nodes();
|
||||
for (int i = nodes.Lower(); i <= nodes.Upper(); i++){
|
||||
points.push_back(Base::Vector2D(nodes(i).X(), nodes(i).Y()));
|
||||
points.push_back(Base::Vector2d(nodes(i).X(), nodes(i).Y()));
|
||||
}
|
||||
} else {
|
||||
//no polygon representation? approximate with line
|
||||
gp_Pnt p = BRep_Tool::Pnt(TopExp::FirstVertex(occEdge));
|
||||
points.push_back(Base::Vector2D(p.X(), p.Y()));
|
||||
points.push_back(Base::Vector2d(p.X(), p.Y()));
|
||||
p = BRep_Tool::Pnt(TopExp::LastVertex(occEdge));
|
||||
points.push_back(Base::Vector2D(p.X(), p.Y()));
|
||||
points.push_back(Base::Vector2d(p.X(), p.Y()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,9 +471,9 @@ BSpline::BSpline(const TopoDS_Edge &e)
|
||||
BezierSegment tempSegment;
|
||||
tempSegment.poles = 3;
|
||||
tempSegment.degree = 2;
|
||||
tempSegment.pnts.push_back(Base::Vector2D(s.X(),s.Y()));
|
||||
tempSegment.pnts.push_back(Base::Vector2D(m.X(),m.Y()));
|
||||
tempSegment.pnts.push_back(Base::Vector2D(ePt.X(),ePt.Y()));
|
||||
tempSegment.pnts.push_back(Base::Vector2d(s.X(),s.Y()));
|
||||
tempSegment.pnts.push_back(Base::Vector2d(m.X(),m.Y()));
|
||||
tempSegment.pnts.push_back(Base::Vector2d(ePt.X(),ePt.Y()));
|
||||
segments.push_back(tempSegment);
|
||||
} else {
|
||||
for (Standard_Integer i = 1; i <= crt.NbArcs(); ++i) {
|
||||
@@ -486,7 +486,7 @@ BSpline::BSpline(const TopoDS_Edge &e)
|
||||
tempSegment.degree = bezier->Degree();
|
||||
for (int pole = 1; pole <= tempSegment.poles; ++pole) {
|
||||
controlPoint = bezier->Pole(pole);
|
||||
tempSegment.pnts.push_back(Base::Vector2D(controlPoint.X(), controlPoint.Y()));
|
||||
tempSegment.pnts.push_back(Base::Vector2d(controlPoint.X(), controlPoint.Y()));
|
||||
}
|
||||
segments.push_back(tempSegment);
|
||||
}
|
||||
@@ -519,7 +519,7 @@ BezierSegment::BezierSegment(const TopoDS_Edge &e)
|
||||
}
|
||||
for (int i = 1; i <= poles; ++i) {
|
||||
gp_Pnt controlPoint = bez->Pole(i);
|
||||
pnts.push_back(Base::Vector2D(controlPoint.X(), controlPoint.Y()));
|
||||
pnts.push_back(Base::Vector2d(controlPoint.X(), controlPoint.Y()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -527,7 +527,7 @@ BezierSegment::BezierSegment(const TopoDS_Edge &e)
|
||||
//**** Vertex
|
||||
Vertex::Vertex(double x, double y)
|
||||
{
|
||||
pnt = Base::Vector2D(x, y);
|
||||
pnt = Base::Vector2d(x, y);
|
||||
extractType = ExtractionType::Plain; //obs?
|
||||
visible = false;
|
||||
ref3D = -1; //obs. never used.
|
||||
@@ -561,7 +561,7 @@ BaseGeomPtrVector GeometryUtils::chainGeoms(BaseGeomPtrVector geoms)
|
||||
} else {
|
||||
//start with first edge
|
||||
result.push_back(geoms[0]);
|
||||
Base::Vector2D atPoint = (geoms[0])->getEndPoint();
|
||||
Base::Vector2d atPoint = (geoms[0])->getEndPoint();
|
||||
used[0] = true;
|
||||
for (unsigned int i = 1; i < geoms.size(); i++) { //do size-1 more edges
|
||||
auto next( nextGeom(atPoint, geoms, used, Precision::Confusion()) );
|
||||
@@ -586,7 +586,7 @@ BaseGeomPtrVector GeometryUtils::chainGeoms(BaseGeomPtrVector geoms)
|
||||
|
||||
|
||||
/*static*/ GeometryUtils::ReturnType GeometryUtils::nextGeom(
|
||||
Base::Vector2D atPoint,
|
||||
Base::Vector2d atPoint,
|
||||
BaseGeomPtrVector geoms,
|
||||
std::vector<bool> used,
|
||||
double tolerance )
|
||||
|
||||
@@ -74,12 +74,12 @@ class TechDrawExport BaseGeom
|
||||
int ref3D; //obs?
|
||||
TopoDS_Edge occEdge; //projected Edge
|
||||
|
||||
std::vector<Base::Vector2D> findEndPoints();
|
||||
Base::Vector2D getStartPoint();
|
||||
Base::Vector2D getEndPoint();
|
||||
double minDist(Base::Vector2D p);
|
||||
Base::Vector2D nearPoint(Base::Vector2D p);
|
||||
Base::Vector2D nearPoint(const BaseGeom* p);
|
||||
std::vector<Base::Vector2d> findEndPoints();
|
||||
Base::Vector2d getStartPoint();
|
||||
Base::Vector2d getEndPoint();
|
||||
double minDist(Base::Vector2d p);
|
||||
Base::Vector2d nearPoint(Base::Vector2d p);
|
||||
Base::Vector2d nearPoint(const BaseGeom* p);
|
||||
static BaseGeom* baseFactory(TopoDS_Edge edge);
|
||||
std::string dump();
|
||||
};
|
||||
@@ -93,7 +93,7 @@ class TechDrawExport Circle: public BaseGeom
|
||||
~Circle() = default;
|
||||
|
||||
public:
|
||||
Base::Vector2D center;
|
||||
Base::Vector2d center;
|
||||
double radius;
|
||||
};
|
||||
|
||||
@@ -104,7 +104,7 @@ class TechDrawExport Ellipse: public BaseGeom
|
||||
~Ellipse() = default;
|
||||
|
||||
public:
|
||||
Base::Vector2D center;
|
||||
Base::Vector2d center;
|
||||
double minor;
|
||||
double major;
|
||||
|
||||
@@ -119,9 +119,9 @@ class TechDrawExport AOE: public Ellipse
|
||||
~AOE() = default;
|
||||
|
||||
public:
|
||||
Base::Vector2D startPnt; //TODO: The points are used for drawing, the angles for bounding box calcs - seems redundant
|
||||
Base::Vector2D endPnt;
|
||||
Base::Vector2D midPnt;
|
||||
Base::Vector2d startPnt; //TODO: The points are used for drawing, the angles for bounding box calcs - seems redundant
|
||||
Base::Vector2d endPnt;
|
||||
Base::Vector2d midPnt;
|
||||
|
||||
/// Angle in radian
|
||||
double startAngle;
|
||||
@@ -141,9 +141,9 @@ class TechDrawExport AOC: public Circle
|
||||
~AOC() = default;
|
||||
|
||||
public:
|
||||
Base::Vector2D startPnt;
|
||||
Base::Vector2D endPnt;
|
||||
Base::Vector2D midPnt;
|
||||
Base::Vector2d startPnt;
|
||||
Base::Vector2d endPnt;
|
||||
Base::Vector2d midPnt;
|
||||
|
||||
/// Angle in radian ??angle with horizontal?
|
||||
double startAngle;
|
||||
@@ -170,8 +170,8 @@ public:
|
||||
int poles;
|
||||
int degree;
|
||||
|
||||
//Base::Vector2D pnts[4];
|
||||
std::vector<Base::Vector2D> pnts;
|
||||
//Base::Vector2d pnts[4];
|
||||
std::vector<Base::Vector2d> pnts;
|
||||
};
|
||||
|
||||
class TechDrawExport BSpline: public BaseGeom
|
||||
@@ -192,7 +192,7 @@ class TechDrawExport Generic: public BaseGeom
|
||||
Generic();
|
||||
~Generic() = default;
|
||||
|
||||
std::vector<Base::Vector2D> points;
|
||||
std::vector<Base::Vector2d> points;
|
||||
};
|
||||
|
||||
|
||||
@@ -222,19 +222,19 @@ class TechDrawExport Vertex
|
||||
{
|
||||
public:
|
||||
Vertex(double x, double y);
|
||||
Vertex(Base::Vector2D v) : Vertex(v.fX,v.fY) {}
|
||||
Vertex(Base::Vector2d v) : Vertex(v.x,v.y) {}
|
||||
~Vertex() = default;
|
||||
|
||||
Base::Vector2D pnt;
|
||||
Base::Vector2d pnt;
|
||||
ExtractionType extractType; //obs?
|
||||
bool visible;
|
||||
int ref3D; //obs. never used.
|
||||
bool isCenter;
|
||||
TopoDS_Vertex occVertex;
|
||||
bool isEqual(Vertex* v, double tol);
|
||||
Base::Vector3d getAs3D(void) {return Base::Vector3d(pnt.fX,pnt.fY,0.0);}
|
||||
double x() {return pnt.fX;}
|
||||
double y() {return pnt.fY;}
|
||||
Base::Vector3d getAs3D(void) {return Base::Vector3d(pnt.x,pnt.y,0.0);}
|
||||
double x() {return pnt.x;}
|
||||
double y() {return pnt.y;}
|
||||
};
|
||||
|
||||
/// Encapsulates some useful static methods
|
||||
@@ -255,7 +255,7 @@ class TechDrawExport GeometryUtils
|
||||
/*!
|
||||
* returns index[1:geoms.size()),reversed [true,false]
|
||||
*/
|
||||
static ReturnType nextGeom( Base::Vector2D atPoint,
|
||||
static ReturnType nextGeom( Base::Vector2d atPoint,
|
||||
std::vector<TechDrawGeometry::BaseGeom*> geoms,
|
||||
std::vector<bool> used,
|
||||
double tolerance );
|
||||
|
||||
@@ -414,7 +414,7 @@ Base::BoundBox3d GeometryObject::calcBoundingBox() const
|
||||
}
|
||||
|
||||
//! does this GeometryObject already have this vertex
|
||||
bool GeometryObject::findVertex(Base::Vector2D v)
|
||||
bool GeometryObject::findVertex(Base::Vector2d v)
|
||||
{
|
||||
bool found = false;
|
||||
std::vector<Vertex*>::iterator it = vertexGeom.begin();
|
||||
|
||||
@@ -113,7 +113,7 @@ protected:
|
||||
std::vector<Vertex *> vertexGeom;
|
||||
std::vector<Face *> faceGeom;
|
||||
|
||||
bool findVertex(Base::Vector2D v);
|
||||
bool findVertex(Base::Vector2d v);
|
||||
|
||||
double Scale;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user