Sketcher: Settings - Allow to set the number of segments per geometry

This commit is contained in:
Abdullah Tahiri 2017-02-12 18:27:50 +01:00 committed by wmayer
parent 00aadc4581
commit d92b3fcc07
3 changed files with 53 additions and 26 deletions

View File

@ -122,6 +122,7 @@ void SketcherSettings::saveSettings()
// Sketch editing
ui->EditSketcherFontSize->onSave();
ui->SegmentsPerGeometry->onSave();
ui->dialogOnDistanceConstraint->onSave();
ui->continueMode->onSave();
ui->checkBoxAdvancedSolverTaskBox->onSave();
@ -164,6 +165,7 @@ void SketcherSettings::loadSettings()
// Sketch editing
ui->EditSketcherFontSize->onRestore();
ui->SegmentsPerGeometry->onRestore();
ui->dialogOnDistanceConstraint->onRestore();
ui->continueMode->onRestore();
ui->checkBoxAdvancedSolverTaskBox->onRestore();

View File

@ -527,6 +527,19 @@
<string>Sketch editing</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="minimumSize">
<size>
<width>182</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Font size</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::PrefSpinBox" name="EditSketcherFontSize">
<property name="suffix">
@ -562,19 +575,6 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="minimumSize">
<size>
<width>182</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Font size</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBox">
<property name="currentIndex">
@ -582,7 +582,7 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item row="4" column="0" colspan="2">
<widget class="Gui::PrefCheckBox" name="dialogOnDistanceConstraint">
<property name="text">
<string>Ask for value after creating a distance constraint</string>
@ -598,9 +598,6 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="EditSketcherMarkerSize"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
@ -608,7 +605,10 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<item row="1" column="1">
<widget class="QComboBox" name="EditSketcherMarkerSize"/>
</item>
<item row="5" column="0" colspan="2">
<widget class="Gui::PrefCheckBox" name="continueMode">
<property name="text">
<string>Geometry Creation &quot;Continue Mode&quot;</string>
@ -624,7 +624,7 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_3">
<property name="enabled">
<bool>true</bool>
@ -771,6 +771,29 @@
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Segments per geometry</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Gui::PrefSpinBox" name="SegmentsPerGeometry">
<property name="minimum">
<number>50</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>SegmentsPerGeometry</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -3216,6 +3216,8 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
// end information layer
int GeoId = 0;
int stdcountsegments = hGrp->GetInt("SegmentsPerGeometry", 50);
// RootPoint
Points.push_back(Base::Vector3d(0.,0.,0.));
@ -3241,7 +3243,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
const Part::GeomCircle *circle = static_cast<const Part::GeomCircle *>(*it);
Handle_Geom_Circle curve = Handle_Geom_Circle::DownCast(circle->handle());
int countSegments = 50;
int countSegments = stdcountsegments;
Base::Vector3d center = circle->getCenter();
double segment = (2 * M_PI) / countSegments;
for (int i=0; i < countSegments; i++) {
@ -3260,7 +3262,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
const Part::GeomEllipse *ellipse = static_cast<const Part::GeomEllipse *>(*it);
Handle_Geom_Ellipse curve = Handle_Geom_Ellipse::DownCast(ellipse->handle());
int countSegments = 50;
int countSegments = stdcountsegments;
Base::Vector3d center = ellipse->getCenter();
double segment = (2 * M_PI) / countSegments;
for (int i=0; i < countSegments; i++) {
@ -3285,7 +3287,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
std::swap(startangle, endangle);
double range = endangle-startangle;
int countSegments = std::max(6, int(50.0 * range / (2 * M_PI)));
int countSegments = std::max(6, int(stdcountsegments * range / (2 * M_PI)));
double segment = range / countSegments;
Base::Vector3d center = arc->getCenter();
@ -3318,7 +3320,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
std::swap(startangle, endangle);
double range = endangle-startangle;
int countSegments = std::max(6, int(50.0 * range / (2 * M_PI)));
int countSegments = std::max(6, int(stdcountsegments * range / (2 * M_PI)));
double segment = range / countSegments;
Base::Vector3d center = arc->getCenter();
@ -3351,7 +3353,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
std::swap(startangle, endangle);
double range = endangle-startangle;
int countSegments = std::max(6, int(50.0 * range / (2 * M_PI)));
int countSegments = std::max(6, int(stdcountsegments * range / (2 * M_PI)));
double segment = range / countSegments;
Base::Vector3d center = aoh->getCenter();
@ -3384,7 +3386,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
std::swap(startangle, endangle);
double range = endangle-startangle;
int countSegments = std::max(6, int(50.0 * range / (2 * M_PI)));
int countSegments = std::max(6, int(stdcountsegments * range / (2 * M_PI)));
double segment = range / countSegments;
Base::Vector3d center = aop->getCenter();
@ -3420,7 +3422,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
std::swap(first, last);
double range = last-first;
int countSegments = 50;
int countSegments = stdcountsegments;
double segment = range / countSegments;
for (int i=0; i < countSegments; i++) {