Fix bad highlight position in Detail from ProjGroup

This commit is contained in:
wandererfan
2019-02-20 16:11:19 -05:00
committed by wmayer
parent 19548b7d2f
commit fa5fb1ea9c
5 changed files with 16 additions and 34 deletions

View File

@@ -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();
}

View File

@@ -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) ||

View File

@@ -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);