DrawViewSymbol forgets Scale on restore

This commit is contained in:
WandererFan 2016-07-12 15:20:08 -04:00
parent 2ac560e7b0
commit 1a87644f44
3 changed files with 12 additions and 6 deletions

View File

@ -70,7 +70,7 @@ DrawView::DrawView(void)
ScaleType.setEnums(ScaleTypeEnums); ScaleType.setEnums(ScaleTypeEnums);
ADD_PROPERTY_TYPE(ScaleType,((long)0),group, App::Prop_None, "Scale Type"); ADD_PROPERTY_TYPE(ScaleType,((long)0),group, App::Prop_None, "Scale Type");
ADD_PROPERTY_TYPE(Scale ,(1.0),group,App::Prop_None,"Scale factor of the view"); ADD_PROPERTY_TYPE(Scale ,(1.0),group,App::Prop_None,"Scale factor of the view");
Scale.setStatus(App::Property::ReadOnly,true); //Scale.setStatus(App::Property::ReadOnly,true);
autoPos = true; autoPos = true;
@ -119,14 +119,15 @@ void DrawView::onChanged(const App::Property* prop)
TechDraw::DrawPage *page = findParentPage(); TechDraw::DrawPage *page = findParentPage();
if(page) { if(page) {
if(std::abs(page->Scale.getValue() - Scale.getValue()) > FLT_EPSILON) { if(std::abs(page->Scale.getValue() - Scale.getValue()) > FLT_EPSILON) {
Scale.setValue(page->Scale.getValue()); // Recalculate scale from page Scale.setValue(page->Scale.getValue()); // Reset scale from page
Scale.touch(); Scale.touch();
} }
} }
Scale.setStatus(App::Property::ReadOnly,true); Scale.setStatus(App::Property::ReadOnly,true);
App::GetApplication().signalChangePropertyEditor(Scale); App::GetApplication().signalChangePropertyEditor(Scale);
} else if (ScaleType.isValue("Custom") && } else if ( ScaleType.isValue("Custom") ) {
Scale.testStatus(App::Property::ReadOnly)) { // } else if (ScaleType.isValue("Custom") &&
// Scale.testStatus(App::Property::ReadOnly)) {
Scale.setStatus(App::Property::ReadOnly,false); Scale.setStatus(App::Property::ReadOnly,false);
App::GetApplication().signalChangePropertyEditor(Scale); App::GetApplication().signalChangePropertyEditor(Scale);
} }

View File

@ -251,7 +251,9 @@ void QGIView::updateView(bool update)
if (update || if (update ||
getViewObject()->Rotation.isTouched()) { getViewObject()->Rotation.isTouched()) {
//NOTE: QPainterPaths have to be rotated individually. This transform handles everything else. //NOTE: QPainterPaths have to be rotated individually. This transform handles Rotation for everything else.
//Scale is handled in GeometryObject for DVP & descendents
//Objects not descended from DVP must setScale for themselves
double rot = getViewObject()->Rotation.getValue(); double rot = getViewObject()->Rotation.getValue();
QPointF centre = boundingRect().center(); QPointF centre = boundingRect().center();
setTransform(QTransform().translate(centre.x(), centre.y()).rotate(-rot).translate(-centre.x(), -centre.y())); setTransform(QTransform().translate(centre.x(), centre.y()).rotate(-rot).translate(-centre.x(), -centre.y()));

View File

@ -89,7 +89,6 @@ void QGIViewSymbol::updateView(bool update)
} }
if (viewSymbol->Scale.isTouched()) { if (viewSymbol->Scale.isTouched()) {
setScale(viewSymbol->Scale.getValue());
draw(); draw();
} }
@ -102,6 +101,10 @@ void QGIViewSymbol::draw()
return; return;
} }
//note: svg's are overscaled by (72 pixels(pts actually) /in)*(1 in/25.4 mm) = 2.834645669 (could be 96/25.4(CSS)? 110/25.4?)
//due to 1 sceneUnit (1mm) = 1 pixel for some QtSvg functions
TechDraw::DrawViewSymbol *viewSymbol = dynamic_cast<TechDraw::DrawViewSymbol *>(getViewObject());
setScale(viewSymbol->Scale.getValue());
drawSvg(); drawSvg();
if (borderVisible) { if (borderVisible) {
drawBorder(); drawBorder();