remove obsolete 3D reference code
This commit is contained in:
@@ -281,142 +281,16 @@ const std::vector<TechDrawGeometry::Vertex *> & DrawViewPart::getVertexGeometry(
|
||||
return geometryObject->getVertexGeometry();
|
||||
}
|
||||
|
||||
const std::vector<int> & DrawViewPart::getVertexReferences() const
|
||||
{
|
||||
return geometryObject->getVertexRefs();
|
||||
}
|
||||
|
||||
const std::vector<TechDrawGeometry::Face *> & DrawViewPart::getFaceGeometry() const
|
||||
{
|
||||
return geometryObject->getFaceGeometry();
|
||||
}
|
||||
|
||||
const std::vector<int> & DrawViewPart::getFaceReferences() const
|
||||
{
|
||||
return geometryObject->getFaceRefs();
|
||||
}
|
||||
|
||||
const std::vector<TechDrawGeometry::BaseGeom *> & DrawViewPart::getEdgeGeometry() const
|
||||
{
|
||||
return geometryObject->getEdgeGeometry();
|
||||
}
|
||||
|
||||
const std::vector<int> & DrawViewPart::getEdgeReferences() const
|
||||
{
|
||||
return geometryObject->getEdgeRefs();
|
||||
}
|
||||
|
||||
//! project Source Edge(idx) to 2D BaseGeom
|
||||
TechDrawGeometry::BaseGeom *DrawViewPart::getCompleteEdge(int idx) const
|
||||
{
|
||||
//NOTE: idx is in fact a Reference to an Edge in Source
|
||||
//returns projection of ref'd Edge as BaseGeom. Why not just use existing BaseGeom(idx)?
|
||||
App::DocumentObject* link = Source.getValue();
|
||||
|
||||
if (!link || !link->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))
|
||||
return 0;
|
||||
|
||||
const Part::TopoShape &topoShape = static_cast<Part::Feature*>(link)->Shape.getShape();
|
||||
std::stringstream str;
|
||||
str << "Edge" << idx;
|
||||
TopoDS_Shape shape = topoShape.getSubShape(str.str().c_str());
|
||||
|
||||
|
||||
const TopoDS_Shape &support = static_cast<Part::Feature*>(link)->Shape.getValue();
|
||||
//TODO: make sure prjShape gets deleted
|
||||
|
||||
TechDrawGeometry::BaseGeom* prjShape = 0;
|
||||
try {
|
||||
prjShape = geometryObject->projectEdge(shape, support, Direction.getValue(), getValidXDir());
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
Base::Console().Error("getCompleteEdge - OCC Error - could not project Edge: %d\n",idx);
|
||||
return 0;
|
||||
}
|
||||
catch (exception& e) {
|
||||
Base::Console().Error("getCompleteEdge - unknown exception on Edge: %d - %s\n",idx,e.what());
|
||||
return 0;
|
||||
}
|
||||
catch(...) {
|
||||
Base::Console().Error("getCompleteEdge - unknown error on Edge: %d\n",idx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return prjShape;
|
||||
}
|
||||
|
||||
//! project Source Vertex(idx) to 2D geometry
|
||||
TechDrawGeometry::Vertex * DrawViewPart::getVertex(int idx) const
|
||||
{
|
||||
//## Get the Part Link ##/
|
||||
App::DocumentObject* link = Source.getValue();
|
||||
|
||||
if (!link || !link->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))
|
||||
return 0;
|
||||
|
||||
const Part::TopoShape &topoShape = static_cast<Part::Feature*>(link)->Shape.getShape();
|
||||
std::stringstream str;
|
||||
str << "Vertex" << idx;
|
||||
TopoDS_Shape shape = topoShape.getSubShape(str.str().c_str());
|
||||
|
||||
const TopoDS_Shape &support = static_cast<Part::Feature*>(link)->Shape.getValue();
|
||||
//TODO: Make sure prjShape gets deleted
|
||||
TechDrawGeometry::Vertex *prjShape = geometryObject->projectVertex(shape, support, Direction.getValue(), getValidXDir());
|
||||
//Base::Console().Log("vert %f, %f \n", prjShape->pnt.fX, prjShape->pnt.fY);
|
||||
return prjShape;
|
||||
}
|
||||
|
||||
TechDrawGeometry::Vertex* DrawViewPart::getVertexGeomByRef(int ref) const
|
||||
{
|
||||
const std::vector<TechDrawGeometry::Vertex *> &verts = getVertexGeometry();
|
||||
if (verts.empty()) {
|
||||
Base::Console().Log("INFO - getVertexGeomByRef(%d) - no Vertex Geometry. Probably restoring?\n",ref);
|
||||
return NULL;
|
||||
}
|
||||
const std::vector<int> &vertRefs = getVertexReferences();
|
||||
std::vector<TechDrawGeometry::Vertex *>::const_iterator vert = verts.begin();
|
||||
bool found = false;
|
||||
for(int i = 0 ; vert != verts.end(); ++vert, i++) {
|
||||
if (vertRefs[i] == ref) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
return (*vert);
|
||||
} else {
|
||||
std::stringstream error;
|
||||
error << "getVertexGeomByRef: no vertex geometry for ref: " << ref;
|
||||
throw Base::Exception(error.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
//! returns existing BaseGeom of Edge with 3D Reference = ref
|
||||
TechDrawGeometry::BaseGeom* DrawViewPart::getEdgeGeomByRef(int ref) const
|
||||
{
|
||||
const std::vector<TechDrawGeometry::BaseGeom *> &geoms = getEdgeGeometry();
|
||||
if (geoms.empty()) {
|
||||
Base::Console().Log("INFO - getEdgeGeomByRef(%d) - no Edge Geometry. Probably restoring?\n",ref);
|
||||
return NULL;
|
||||
}
|
||||
const std::vector<int> &refs = getEdgeReferences();
|
||||
std::vector<TechDrawGeometry::BaseGeom*>::const_iterator it = geoms.begin();
|
||||
bool found = false;
|
||||
for(int i = 0 ; it != geoms.end(); ++it, i++) {
|
||||
if (refs[i] == ref) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
return (*it);
|
||||
} else {
|
||||
std::stringstream error;
|
||||
error << "getEdgeGeomByRef: no edge geometry for ref: " << ref;
|
||||
throw Base::Exception(error.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
//! returns existing BaseGeom of 2D Edge(idx)
|
||||
TechDrawGeometry::BaseGeom* DrawViewPart::getProjEdgeByIndex(int idx) const
|
||||
{
|
||||
@@ -439,26 +313,6 @@ TechDrawGeometry::Vertex* DrawViewPart::getProjVertexByIndex(int idx) const
|
||||
return geoms[idx];
|
||||
}
|
||||
|
||||
int DrawViewPart::getEdgeRefByIndex(int idx) const
|
||||
{
|
||||
const std::vector<int> &refs = getEdgeReferences();
|
||||
if (refs.empty()) {
|
||||
Base::Console().Log("INFO - getEdgeRefByIndex(%d) - no Edge Geometry. Probably restoring?\n",idx);
|
||||
return -1;
|
||||
}
|
||||
return refs[idx];
|
||||
}
|
||||
|
||||
int DrawViewPart::getVertexRefByIndex(int idx) const
|
||||
{
|
||||
const std::vector<int> &refs = getVertexReferences();
|
||||
if (refs.empty()) {
|
||||
Base::Console().Log("INFO - getVertexRefByIndex(%d) - no Vertex Geometry. Probably restoring?\n",idx);
|
||||
return -1;
|
||||
}
|
||||
return refs[idx];
|
||||
}
|
||||
|
||||
Base::BoundBox3d DrawViewPart::getBoundingBox() const
|
||||
{
|
||||
return bbox;
|
||||
@@ -547,17 +401,6 @@ Base::Vector3d DrawViewPart::getValidXDir() const
|
||||
return xDir;
|
||||
}
|
||||
|
||||
void DrawViewPart::dumpVertexRefs(char* text) const
|
||||
{
|
||||
Base::Console().Message("DUMP - %s\n",text);
|
||||
const std::vector<int> &refs = getVertexReferences();
|
||||
std::vector<int>::const_iterator it = refs.begin();
|
||||
int i = 0;
|
||||
for( ; it != refs.end(); it++, i++) {
|
||||
Base::Console().Message("DUMP - Vertex: %d ref: %d\n",i,(*it));
|
||||
}
|
||||
}
|
||||
|
||||
void DrawViewPart::dumpVertexes(const char* text, const TopoDS_Shape& s)
|
||||
{
|
||||
Base::Console().Message("DUMP - %s\n",text);
|
||||
|
||||
@@ -75,19 +75,6 @@ public:
|
||||
TechDrawGeometry::BaseGeom* getProjEdgeByIndex(int idx) const; //get existing geom for edge idx in projection
|
||||
TechDrawGeometry::Vertex* getProjVertexByIndex(int idx) const; //get existing geom for vertex idx in projection
|
||||
|
||||
int getEdgeRefByIndex(int idx) const; //get reference to Source edge for Projected edge idx
|
||||
int getVertexRefByIndex(int idx) const; //get reference to Source Vertex for Projected Vertex idx
|
||||
|
||||
TechDrawGeometry::BaseGeom * getCompleteEdge(int idx) const; //project source edge idx
|
||||
TechDrawGeometry::Vertex * getVertex(int idx) const; //project source vertex
|
||||
TechDrawGeometry::Vertex* getVertexGeomByRef(int ref) const;
|
||||
TechDrawGeometry::BaseGeom* getEdgeGeomByRef(int ref) const;
|
||||
|
||||
/// Get References for geometric features
|
||||
const std::vector<int> & getVertexReferences() const;
|
||||
const std::vector<int> & getEdgeReferences() const;
|
||||
const std::vector<int> & getFaceReferences() const;
|
||||
|
||||
virtual Base::BoundBox3d getBoundingBox() const;
|
||||
|
||||
short mustExecute() const;
|
||||
@@ -105,7 +92,6 @@ public:
|
||||
//return PyObject as DrawViewPartPy
|
||||
virtual PyObject *getPyObject(void);
|
||||
|
||||
void dumpVertexRefs(char* text) const;
|
||||
void dumpVertexes(const char* text, const TopoDS_Shape& s);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -160,13 +160,8 @@ void GeometryObject::clear()
|
||||
}
|
||||
|
||||
vertexGeom.clear();
|
||||
vertexReferences.clear();
|
||||
|
||||
faceGeom.clear();
|
||||
faceReferences.clear();
|
||||
|
||||
edgeGeom.clear();
|
||||
edgeReferences.clear();
|
||||
}
|
||||
|
||||
//!set up a hidden line remover and project a shape with it
|
||||
@@ -175,8 +170,7 @@ void GeometryObject::projectShape(const TopoDS_Shape& input,
|
||||
const Base::Vector3d& direction,
|
||||
const Base::Vector3d& xAxis)
|
||||
{
|
||||
// Clear previous Geometry and References that may have been stored
|
||||
//TODO: hate losing references on recompute! if Shape has changed, aren't reference potentially invalid anyway?
|
||||
// Clear previous Geometry
|
||||
clear();
|
||||
|
||||
Handle_HLRBRep_Algo brep_hlr = NULL;
|
||||
@@ -290,7 +284,6 @@ void GeometryObject::addGeomFromCompound(TopoDS_Shape edgeCompound, edgeClass ca
|
||||
base->classOfEdge = category;
|
||||
base->visible = visible;
|
||||
edgeGeom.push_back(base);
|
||||
edgeReferences.push_back(-1);
|
||||
|
||||
//add vertices of new edge if not already in list
|
||||
if (visible) {
|
||||
@@ -311,14 +304,12 @@ void GeometryObject::addGeomFromCompound(TopoDS_Shape edgeCompound, edgeClass ca
|
||||
if (v1Add) {
|
||||
vertexGeom.push_back(v1);
|
||||
v1->visible = true;
|
||||
vertexReferences.push_back(-1);
|
||||
} else {
|
||||
delete v1;
|
||||
}
|
||||
if (v2Add) {
|
||||
vertexGeom.push_back(v2);
|
||||
v2->visible = true;
|
||||
vertexReferences.push_back(-1);
|
||||
} else {
|
||||
delete v2;
|
||||
}
|
||||
@@ -327,11 +318,6 @@ void GeometryObject::addGeomFromCompound(TopoDS_Shape edgeCompound, edgeClass ca
|
||||
}
|
||||
}
|
||||
|
||||
//!find the 3D edges & vertices that correspond to 2D edges & vertices
|
||||
void GeometryObject::update3DRefs()
|
||||
{
|
||||
}
|
||||
|
||||
//! empty Face geometry
|
||||
void GeometryObject::clearFaceGeom()
|
||||
{
|
||||
@@ -636,189 +622,6 @@ Base::BoundBox3d GeometryObject::calcBoundingBox() const
|
||||
return bbox;
|
||||
}
|
||||
|
||||
////////////////// Project TopoDS_xxxxx routines
|
||||
|
||||
//! only ever called from FVP::getVertex which is never used, so obs?
|
||||
TechDrawGeometry::Vertex * GeometryObject::projectVertex(const TopoDS_Shape &vert,
|
||||
const TopoDS_Shape &support,
|
||||
const Base::Vector3d &direction,
|
||||
const Base::Vector3d &projXAxis) const
|
||||
{
|
||||
if(vert.IsNull())
|
||||
throw Base::Exception("Projected vertex is null");
|
||||
TechDrawGeometry::Vertex* result = NULL;
|
||||
return result;
|
||||
#if 0
|
||||
gp_Pnt supportCentre = findCentroid(support, direction, projXAxis);
|
||||
|
||||
// mirror+scale vert around centre of support
|
||||
gp_Trsf mat;
|
||||
mat.SetMirror(gp_Ax2(supportCentre, gp_Dir(0, 1, 0)));
|
||||
gp_Trsf matScale;
|
||||
matScale.SetScale(supportCentre, Scale);
|
||||
mat.Multiply(matScale);
|
||||
|
||||
//TODO: See if it makes sense to use gp_Trsf::Transforms() instead
|
||||
BRepBuilderAPI_Transform mkTrfScale(vert, mat);
|
||||
const TopoDS_Vertex &refVert = TopoDS::Vertex(mkTrfScale.Shape());
|
||||
|
||||
gp_Ax2 transform;
|
||||
transform = gp_Ax2(supportCentre,
|
||||
gp_Dir(direction.x, direction.y, direction.z),
|
||||
gp_Dir(projXAxis.x, projXAxis.y, projXAxis.z));
|
||||
|
||||
HLRAlgo_Projector projector = HLRAlgo_Projector( transform );
|
||||
projector.Scaled(true);
|
||||
// If the index was found and is unique, the point is projected using the HLR Projector Algorithm //wf: what index?
|
||||
gp_Pnt2d prjPnt;
|
||||
projector.Project(BRep_Tool::Pnt(refVert), prjPnt);
|
||||
TechDrawGeometry::Vertex *myVert = new Vertex(prjPnt.X(), prjPnt.Y());
|
||||
return myVert;
|
||||
#endif
|
||||
}
|
||||
|
||||
//! only ever called from fvp::getCompleteEdge which is only ever called from CmdCreateDim for true dims. so obs?
|
||||
TechDrawGeometry::BaseGeom * GeometryObject::projectEdge(const TopoDS_Shape &edge,
|
||||
const TopoDS_Shape &support,
|
||||
const Base::Vector3d &direction,
|
||||
const Base::Vector3d &projXAxis) const
|
||||
{
|
||||
if(edge.IsNull())
|
||||
throw Base::Exception("Projected edge is null");
|
||||
// Invert y function using support to calculate bounding box
|
||||
|
||||
TechDrawGeometry::BaseGeom *result = 0;
|
||||
return result;
|
||||
#if 0
|
||||
gp_Pnt supportCentre = findCentroid(support, direction, projXAxis);
|
||||
|
||||
gp_Trsf mat;
|
||||
mat.SetMirror(gp_Ax2(supportCentre, gp_Dir(0, 1, 0)));
|
||||
gp_Trsf matScale;
|
||||
matScale.SetScale(supportCentre, Scale);
|
||||
mat.Multiply(matScale);
|
||||
BRepBuilderAPI_Transform mkTrfScale(edge, mat);
|
||||
|
||||
const TopoDS_Edge &refEdge = TopoDS::Edge(mkTrfScale.Shape());
|
||||
|
||||
gp_Ax2 transform;
|
||||
transform = gp_Ax2(supportCentre,
|
||||
gp_Dir(direction.x, direction.y, direction.z),
|
||||
gp_Dir(projXAxis.x, projXAxis.y, projXAxis.z));
|
||||
|
||||
BRepAdaptor_Curve refCurve(refEdge);
|
||||
HLRAlgo_Projector projector = HLRAlgo_Projector( transform );
|
||||
projector.Scaled(true);
|
||||
|
||||
if (refCurve.GetType() == GeomAbs_Line) {
|
||||
// Use the simpler algorithm for lines
|
||||
gp_Pnt p1 = refCurve.Value(refCurve.FirstParameter());
|
||||
gp_Pnt p2 = refCurve.Value(refCurve.LastParameter());
|
||||
|
||||
// Project the points
|
||||
gp_Pnt2d pnt1, pnt2;
|
||||
projector.Project(p1, pnt1);
|
||||
projector.Project(p2, pnt2);
|
||||
|
||||
TechDrawGeometry::Generic *line = new TechDrawGeometry::Generic();
|
||||
|
||||
line->points.push_back(Base::Vector2D(pnt1.X(), pnt1.Y()));
|
||||
line->points.push_back(Base::Vector2D(pnt2.X(), pnt2.Y()));
|
||||
|
||||
return line;
|
||||
|
||||
} else {
|
||||
|
||||
HLRBRep_Curve curve;
|
||||
curve.Curve(refEdge);
|
||||
|
||||
curve.Projector(&projector);
|
||||
|
||||
TechDrawGeometry::BaseGeom *result = 0;
|
||||
TopoDS_Edge e = BRepBuilderAPI_MakeEdge(curve.Curve());
|
||||
switch(HLRBRep_BCurveTool::GetType(curve.Curve()))
|
||||
{
|
||||
case GeomAbs_Line: {
|
||||
TechDrawGeometry::Generic *line = new TechDrawGeometry::Generic(e,ecTrue,true);
|
||||
|
||||
// gp_Pnt2d pnt1 = curve.Value(curve.FirstParameter());
|
||||
// gp_Pnt2d pnt2 = curve.Value(curve.LastParameter());
|
||||
|
||||
// line->points.push_back(Base::Vector2D(pnt1.X(), pnt1.Y()));
|
||||
// line->points.push_back(Base::Vector2D(pnt2.X(), pnt2.Y()));
|
||||
|
||||
result = line;
|
||||
}break;
|
||||
case GeomAbs_Circle: {
|
||||
TechDrawGeometry::Circle *circle = new TechDrawGeometry::Circle(e,ecTrue,true));
|
||||
gp_Circ2d prjCirc = curve.Circle();
|
||||
|
||||
double f = curve.FirstParameter();
|
||||
double l = curve.LastParameter();
|
||||
gp_Pnt2d s = curve.Value(f);
|
||||
gp_Pnt2d e = curve.Value(l);
|
||||
|
||||
if (fabs(l-f) > 1.0 && s.SquareDistance(e) < 0.001) {
|
||||
circle->radius = prjCirc.Radius();
|
||||
circle->center = Base::Vector2D(prjCirc.Location().X(), prjCirc.Location().Y());
|
||||
result = circle;
|
||||
} else {
|
||||
AOC *aoc = new AOC(curve.Curve());
|
||||
aoc->radius = prjCirc.Radius();
|
||||
aoc->center = Base::Vector2D(prjCirc.Location().X(), prjCirc.Location().Y());
|
||||
double ax = s.X() - aoc->center.fX;
|
||||
double ay = s.Y() - aoc->center.fY;
|
||||
double bx = e.X() - aoc->center.fX;
|
||||
double by = e.Y() - aoc->center.fY;
|
||||
|
||||
aoc->startAngle = atan2(ay,ax);
|
||||
float range = atan2(-ay*bx+ax*by, ax*bx+ay*by);
|
||||
|
||||
aoc->endAngle = aoc->startAngle + range;
|
||||
result = aoc;
|
||||
}
|
||||
} break;
|
||||
case GeomAbs_Ellipse: {
|
||||
gp_Elips2d prjEllipse = curve.Ellipse();
|
||||
|
||||
double f = curve.FirstParameter();
|
||||
double l = curve.LastParameter();
|
||||
gp_Pnt2d s = curve.Value(f);
|
||||
gp_Pnt2d e = curve.Value(l);
|
||||
|
||||
if (fabs(l-f) > 1.0 && s.SquareDistance(e) < 0.001) {
|
||||
Ellipse *ellipse = new Ellipse();
|
||||
ellipse->major = prjEllipse.MajorRadius();
|
||||
ellipse->minor = prjEllipse.MinorRadius();
|
||||
ellipse->center = Base::Vector2D(prjEllipse.Location().X(),
|
||||
prjEllipse.Location().Y());
|
||||
result = ellipse;
|
||||
// TODO: Finish implementing ellipsey stuff
|
||||
} else {
|
||||
// TODO implement this correctly
|
||||
AOE *aoe = new AOE();
|
||||
aoe->major = prjEllipse.MajorRadius();
|
||||
aoe->minor = prjEllipse.MinorRadius();
|
||||
aoe->center = Base::Vector2D(prjEllipse.Location().X(),
|
||||
prjEllipse.Location().Y());
|
||||
result = aoe;
|
||||
}
|
||||
} break;
|
||||
case GeomAbs_BSplineCurve: {
|
||||
// TODO: Project BSpline here?
|
||||
} break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
//! does this GeometryObject already have this vertex
|
||||
bool GeometryObject::findVertex(Base::Vector2D v)
|
||||
{
|
||||
|
||||
@@ -73,27 +73,11 @@ public:
|
||||
const std::vector<BaseGeom *> & getEdgeGeometry() const { return edgeGeom; };
|
||||
const std::vector<Face *> & getFaceGeometry() const { return faceGeom; };
|
||||
|
||||
const std::vector<int> & getVertexRefs() const { return vertexReferences; };
|
||||
const std::vector<int> & getEdgeRefs() const { return edgeReferences; };
|
||||
const std::vector<int> & getFaceRefs() const { return faceReferences; };
|
||||
|
||||
//begin obs?
|
||||
BaseGeom* projectEdge(const TopoDS_Shape &edge,
|
||||
const TopoDS_Shape &support,
|
||||
const Base::Vector3d &direction,
|
||||
const Base::Vector3d &projXAxis) const;
|
||||
Vertex* projectVertex(const TopoDS_Shape &vert,
|
||||
const TopoDS_Shape &support,
|
||||
const Base::Vector3d &direction,
|
||||
const Base::Vector3d &projXAxis) const;
|
||||
//end obs?
|
||||
|
||||
void projectShape(const TopoDS_Shape &input,
|
||||
const gp_Pnt& inputCenter,
|
||||
const Base::Vector3d &direction,
|
||||
const Base::Vector3d &xAxis);
|
||||
void extractGeometry(edgeClass category, bool visible);
|
||||
void update3DRefs();
|
||||
void addFaceGeom(Face * f);
|
||||
void clearFaceGeom();
|
||||
|
||||
@@ -140,11 +124,6 @@ protected:
|
||||
|
||||
bool findVertex(Base::Vector2D v);
|
||||
|
||||
// indexes to geometry in Source object
|
||||
std::vector<int> vertexReferences;
|
||||
std::vector<int> edgeReferences;
|
||||
std::vector<int> faceReferences;
|
||||
|
||||
double Tolerance;
|
||||
double Scale;
|
||||
};
|
||||
|
||||
@@ -365,7 +365,6 @@ void MDIViewPage::preSelectionChanged(const QPoint &pos)
|
||||
|
||||
TechDraw::DrawView *viewObj = viewItem->getViewObject();
|
||||
std::stringstream ss;
|
||||
//ss << "Edge" << edge->getReference();
|
||||
ss << "Edge" << edge->getProjIndex();
|
||||
//bool accepted =
|
||||
static_cast<void> (Gui::Selection().setPreselect(viewObj->getDocument()->getName()
|
||||
@@ -376,8 +375,6 @@ void MDIViewPage::preSelectionChanged(const QPoint &pos)
|
||||
,0));
|
||||
|
||||
} else if(vert) {
|
||||
// Find the parent view that this edges is contained within
|
||||
//WF: sb Vertex??
|
||||
QGraphicsItem*parent = vert->parentItem();
|
||||
if(!parent)
|
||||
return;
|
||||
@@ -388,7 +385,7 @@ void MDIViewPage::preSelectionChanged(const QPoint &pos)
|
||||
|
||||
TechDraw::DrawView *viewObj = viewItem->getViewObject();
|
||||
std::stringstream ss;
|
||||
ss << "Edge" << vert->getReference(); //WF: sb Vertex??
|
||||
ss << "Vertex" << vert->getProjIndex();
|
||||
//bool accepted =
|
||||
static_cast<void> (Gui::Selection().setPreselect(viewObj->getDocument()->getName()
|
||||
,viewObj->getNameInDocument()
|
||||
@@ -397,8 +394,6 @@ void MDIViewPage::preSelectionChanged(const QPoint &pos)
|
||||
,pos.y()
|
||||
,0));
|
||||
} else {
|
||||
// Check if an edge was preselected
|
||||
//WF: sb View?
|
||||
QGIView *view = qobject_cast<QGIView *>(obj);
|
||||
|
||||
if(!view)
|
||||
|
||||
@@ -50,9 +50,6 @@ public:
|
||||
QPainterPath shape() const;
|
||||
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
|
||||
|
||||
//TODO: edge doesn't need ref to 3D, just index in projection. links to 3D handled in Features.
|
||||
int getReference() const { return reference; }
|
||||
void setReference(int ref) {reference = ref; }
|
||||
int getProjIndex() const { return projIndex; }
|
||||
|
||||
void setHighlighted(bool state);
|
||||
@@ -72,7 +69,6 @@ protected:
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
|
||||
int projIndex; //index of edge in Projection. must exist.
|
||||
int reference; //index of edge in DrawViewPart Source. may not exist(-1).
|
||||
|
||||
bool isHighlighted;
|
||||
bool isCosmetic;
|
||||
|
||||
@@ -85,23 +85,6 @@ QGIHatch::~QGIHatch()
|
||||
{
|
||||
}
|
||||
|
||||
#if 0
|
||||
void QGIHatch::draw()
|
||||
{
|
||||
const std::vector<App::DocumentObject*> &objects = hatch->Edges.getValues();
|
||||
//const std::vector<std::string> &SubNames = hatch->Edges.getSubValues();
|
||||
//const TechDraw::DrawViewPart *refObj = static_cast<const TechDraw::DrawViewPart*>(objects[0]);
|
||||
|
||||
//for edgeName in SubNames
|
||||
// iEdge = _getIndexFromName(edgeName) //from CommandCreateDims.cpp
|
||||
// geom = refObj->getEdgeGeomByRef(iEdge)
|
||||
// subPath = drawPainterPath(geom) //from qgiViewPart
|
||||
// m_path.addPath(subPath)
|
||||
//m_path = m_path.simplified() //????
|
||||
//m_face->setPath(m_path);
|
||||
}
|
||||
#endif
|
||||
|
||||
QVariant QGIHatch::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
if (change == ItemSelectedHasChanged && scene()) {
|
||||
|
||||
@@ -48,8 +48,6 @@ public:
|
||||
int type() const { return Type;}
|
||||
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
|
||||
|
||||
int getReference() const { return reference; }
|
||||
void setReference(int ref) {reference = ref; }
|
||||
int getProjIndex() const { return projIndex; }
|
||||
|
||||
float getRadius() { return m_radius; }
|
||||
@@ -68,7 +66,6 @@ protected:
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
|
||||
int projIndex; //index of vertex in Projection. must exist.
|
||||
int reference; //index of vertex in DrawView Source. may not exist(-1).
|
||||
|
||||
bool isHighlighted;
|
||||
|
||||
|
||||
@@ -359,7 +359,6 @@ void QGIViewPart::drawViewPart()
|
||||
|
||||
// Draw Edges
|
||||
const std::vector<TechDrawGeometry::BaseGeom *> &geoms = viewPart->getEdgeGeometry();
|
||||
const std::vector<int> &refs = viewPart->getEdgeReferences();
|
||||
std::vector<TechDrawGeometry::BaseGeom *>::const_iterator itEdge = geoms.begin();
|
||||
QGIEdge* item;
|
||||
|
||||
@@ -379,7 +378,6 @@ void QGIViewPart::drawViewPart()
|
||||
}
|
||||
if (showEdge) {
|
||||
item = new QGIEdge(i);
|
||||
item->setReference(refs.at(i));
|
||||
addToGroup(item); //item is at scene(0,0), not group(0,0)
|
||||
item->setPos(0.0,0.0);
|
||||
item->setPath(drawPainterPath(*itEdge));
|
||||
@@ -403,11 +401,9 @@ void QGIViewPart::drawViewPart()
|
||||
|
||||
// Draw Vertexs:
|
||||
const std::vector<TechDrawGeometry::Vertex *> &verts = viewPart->getVertexGeometry();
|
||||
const std::vector<int> &vertRefs = viewPart->getVertexReferences();
|
||||
std::vector<TechDrawGeometry::Vertex *>::const_iterator vert = verts.begin();
|
||||
for(int i = 0 ; vert != verts.end(); ++vert, i++) {
|
||||
QGIVertex *item = new QGIVertex(i);
|
||||
item->setReference(vertRefs.at(i));
|
||||
addToGroup(item);
|
||||
item->setPos((*vert)->pnt.fX, (*vert)->pnt.fY); //this is in ViewPart coords
|
||||
item->setRadius(lineWidth * vertexScaleFactor);
|
||||
@@ -578,28 +574,6 @@ void QGIViewPart::pathArcSegment(QPainterPath &path,
|
||||
a00 * x3 + a01 * y3, a10 * x3 + a11 * y3);
|
||||
}
|
||||
|
||||
QGIEdge * QGIViewPart::findRefEdge(int idx)
|
||||
{
|
||||
QList<QGraphicsItem*> items = childItems();
|
||||
for(QList<QGraphicsItem*>::iterator it = items.begin(); it != items.end(); it++) {
|
||||
QGIEdge *edge = dynamic_cast<QGIEdge *>(*it);
|
||||
if(edge && edge->getReference() == idx)
|
||||
return edge;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
QGIVertex * QGIViewPart::findRefVertex(int idx)
|
||||
{
|
||||
QList<QGraphicsItem*> items = childItems();
|
||||
for(QList<QGraphicsItem*>::iterator it = items.begin(); it != items.end(); it++) {
|
||||
QGIVertex *vert = dynamic_cast<QGIVertex *>(*it);
|
||||
if(vert && vert->getReference() == idx)
|
||||
return vert;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void QGIViewPart::toggleCache(bool state)
|
||||
{
|
||||
QList<QGraphicsItem*> items = childItems();
|
||||
|
||||
@@ -70,9 +70,6 @@ Q_SIGNALS:
|
||||
void dirty();
|
||||
|
||||
protected:
|
||||
QGIEdge * findRefEdge(int i);
|
||||
QGIVertex * findRefVertex(int idx);
|
||||
|
||||
/// Helper for pathArc()
|
||||
/*!
|
||||
* x_axis_rotation is in radian
|
||||
|
||||
Reference in New Issue
Block a user