Fix bad highlight position in Detail from ProjGroup
This commit is contained in:
@@ -380,6 +380,7 @@ App::DocumentObject * DrawProjGroup::addProjection(const char *viewProjType)
|
||||
view->Direction.setValue(vecs.first);
|
||||
view->RotationVector.setValue(vecs.second);
|
||||
} else { //Front
|
||||
//where do direction & Rotation Vector get set for front???
|
||||
view->LockPosition.setValue(true); //lock "Front" position within DPG (note not Page!).
|
||||
view->LockPosition.setStatus(App::Property::ReadOnly,true); //Front should stay locked.
|
||||
App::GetApplication().signalChangePropertyEditor(view->LockPosition);
|
||||
@@ -1055,7 +1056,7 @@ void DrawProjGroup::spinCW()
|
||||
Base::Vector3d org(0.0,0.0,0.0);
|
||||
Base::Vector3d curRot = anchor->RotationVector.getValue();
|
||||
Base::Vector3d curDir = anchor->Direction.getValue();
|
||||
Base::Vector3d newRot = DrawUtil::vecRotate(curRot,-angle,curDir,org);
|
||||
Base::Vector3d newRot = DrawUtil::vecRotate(curRot,angle,curDir,org);
|
||||
anchor->RotationVector.setValue(newRot);
|
||||
updateSecondaryDirs();
|
||||
}
|
||||
@@ -1068,7 +1069,7 @@ void DrawProjGroup::spinCCW()
|
||||
Base::Vector3d org(0.0,0.0,0.0);
|
||||
Base::Vector3d curRot = anchor->RotationVector.getValue();
|
||||
Base::Vector3d curDir = anchor->Direction.getValue();
|
||||
Base::Vector3d newRot = DrawUtil::vecRotate(curRot,angle,curDir,org);
|
||||
Base::Vector3d newRot = DrawUtil::vecRotate(curRot,-angle,curDir,org);
|
||||
anchor->RotationVector.setValue(newRot);
|
||||
|
||||
updateSecondaryDirs();
|
||||
|
||||
@@ -182,6 +182,8 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute(void)
|
||||
TopoDS_Shape shape;
|
||||
if (dvs != nullptr) {
|
||||
shape = dvs->getCutShape();
|
||||
} else if (dpgi != nullptr) {
|
||||
shape = dpgi->getSourceShapeFused();
|
||||
} else {
|
||||
shape = dvp->getSourceShapeFused();
|
||||
}
|
||||
@@ -207,25 +209,6 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute(void)
|
||||
gp_Ax2 vaBase;
|
||||
if (dpgi != nullptr) {
|
||||
viewAxis = dpgi->getViewAxis(shapeCenter, dirDetail);
|
||||
vaBase = TechDrawGeometry::getViewAxis(shapeCenter,dirDetail,false);
|
||||
|
||||
Base::Vector3d vaDir(vaBase.Direction().X(),vaBase.Direction().Y(),vaBase.Direction().Z());
|
||||
Base::Vector3d vabDir(vaBase.Direction().X(),vaBase.Direction().Y(),vaBase.Direction().Z());
|
||||
double vaDot = vaDir.Dot(vabDir);
|
||||
|
||||
if (DrawUtil::fpCompare(vaDot,-1.0)) { //anti-parallel, flip
|
||||
myShape = TechDrawGeometry::rotateShape(myShape,
|
||||
viewAxis,
|
||||
180.0);
|
||||
}
|
||||
Base::Vector3d vaxDir(vaBase.XDirection().X(),vaBase.XDirection().Y(),vaBase.XDirection().Z());
|
||||
Base::Vector3d vabxDir(vaBase.XDirection().X(),vaBase.XDirection().Y(),vaBase.XDirection().Z());
|
||||
double vaxDot = vaxDir.Dot(vabxDir);
|
||||
if (DrawUtil::fpCompare(vaxDot,-1.0)) {
|
||||
myShape = TechDrawGeometry::rotateShape(myShape,
|
||||
viewAxis,
|
||||
180.0);
|
||||
}
|
||||
} else {
|
||||
viewAxis = dvp->getViewAxis(shapeCenter, dirDetail,false);
|
||||
}
|
||||
@@ -311,9 +294,6 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute(void)
|
||||
viewAxis = getViewAxis(Base::Vector3d(inputCenter.X(),inputCenter.Y(),inputCenter.Z()),dirDetail);
|
||||
|
||||
double shapeRotate = dvp->Rotation.getValue(); //degrees CW?
|
||||
if (dpgi != nullptr) {
|
||||
shapeRotate += dpgi->getRotateAngle() * 180.0/M_PI; // to degrees from radians
|
||||
}
|
||||
|
||||
if (!DrawUtil::fpCompare(shapeRotate,0.0)) {
|
||||
mirroredShape = TechDrawGeometry::rotateShape(mirroredShape,
|
||||
|
||||
@@ -737,18 +737,15 @@ void QGIViewPart::drawHighlight(TechDraw::DrawViewDetail* viewDetail, bool b)
|
||||
return;
|
||||
}
|
||||
|
||||
TechDraw::DrawProjGroupItem* dpgi = nullptr;
|
||||
if (viewPart->isDerivedFrom(TechDraw::DrawProjGroupItem::getClassTypeId())) {
|
||||
dpgi = static_cast<TechDraw::DrawProjGroupItem*>(viewPart);
|
||||
}
|
||||
|
||||
if (b) {
|
||||
double fontSize = getPrefFontSize();
|
||||
QGIHighlight* highlight = new QGIHighlight();
|
||||
addToGroup(highlight);
|
||||
highlight->setPos(0.0,0.0); //sb setPos(center.x,center.y)?
|
||||
highlight->setReference(const_cast<char*>(viewDetail->Reference.getValue()));
|
||||
|
||||
Base::Vector3d center = viewDetail->AnchorPoint.getValue() * viewPart->getScale();
|
||||
|
||||
double radius = viewDetail->Radius.getValue() * viewPart->getScale();
|
||||
highlight->setBounds(center.x - radius, center.y + radius,center.x + radius, center.y - radius);
|
||||
highlight->setWidth(Rez::guiX(vp->IsoWidth.getValue()));
|
||||
@@ -757,11 +754,9 @@ void QGIViewPart::drawHighlight(TechDraw::DrawViewDetail* viewDetail, bool b)
|
||||
|
||||
QPointF rotCenter = highlight->mapFromParent(transformOriginPoint());
|
||||
highlight->setTransformOriginPoint(rotCenter);
|
||||
double rotation = viewPart->Rotation.getValue();
|
||||
if (dpgi != nullptr) {
|
||||
double rotDpgi = dpgi->getRotateAngle() * 180.0/M_PI;
|
||||
rotation += rotDpgi;
|
||||
}
|
||||
|
||||
double rotation = viewPart->Rotation.getValue() +
|
||||
vp->HighlightAdjust.getValue();
|
||||
highlight->setRotation(rotation);
|
||||
highlight->draw();
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ ViewProviderViewPart::ViewProviderViewPart()
|
||||
|
||||
static const char *group = "Lines";
|
||||
static const char *dgroup = "Decoration";
|
||||
static const char *hgroup = "Highlight";
|
||||
|
||||
//default line weights
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
@@ -86,6 +87,9 @@ ViewProviderViewPart::ViewProviderViewPart()
|
||||
|
||||
//properties that affect Section Line
|
||||
ADD_PROPERTY_TYPE(ShowSectionLine ,(true) ,dgroup,App::Prop_None,"Show/hide section line if applicable");
|
||||
|
||||
//properties that affect Detail Highlights
|
||||
ADD_PROPERTY_TYPE(HighlightAdjust,(0.0),hgroup,App::Prop_None,"Adjusts the rotation of the Detail highlight");
|
||||
}
|
||||
|
||||
ViewProviderViewPart::~ViewProviderViewPart()
|
||||
@@ -104,6 +108,7 @@ void ViewProviderViewPart::onChanged(const App::Property* prop)
|
||||
prop == &(HiddenWidth) ||
|
||||
prop == &(IsoWidth) ||
|
||||
prop == &(ExtraWidth) ||
|
||||
prop == &(HighlightAdjust) ||
|
||||
prop == &(ArcCenterMarks) ||
|
||||
prop == &(CenterScale) ||
|
||||
prop == &(ShowSectionLine) ||
|
||||
|
||||
@@ -52,6 +52,7 @@ public:
|
||||
App::PropertyBool HorizCenterLine;
|
||||
App::PropertyBool VertCenterLine;
|
||||
App::PropertyBool ShowSectionLine;
|
||||
App::PropertyFloat HighlightAdjust;
|
||||
|
||||
virtual void attach(App::DocumentObject *);
|
||||
virtual void setDisplayMode(const char* ModeName);
|
||||
|
||||
Reference in New Issue
Block a user