Merge remote-tracking branch 'svn/trunk'
This commit is contained in:
@@ -156,6 +156,7 @@ void PartExport initPart()
|
||||
Part::CurveNet ::init();
|
||||
Part::Polygon ::init();
|
||||
Part::Circle ::init();
|
||||
Part::Ellipse ::init();
|
||||
Part::Vertex ::init();
|
||||
Part::Line ::init();
|
||||
Part::Ellipsoid ::init();
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
# include <BRepBuilderAPI_MakeSolid.hxx>
|
||||
# include <BRepBuilderAPI_GTransform.hxx>
|
||||
# include <gp_Circ.hxx>
|
||||
# include <gp_Elips.hxx>
|
||||
# include <gp_GTrsf.hxx>
|
||||
# include <GCE2d_MakeSegment.hxx>
|
||||
# include <Geom_Plane.hxx>
|
||||
@@ -725,3 +726,61 @@ void Wedge::onChanged(const App::Property* prop)
|
||||
}
|
||||
Part::Primitive::onChanged(prop);
|
||||
}
|
||||
|
||||
App::PropertyFloatConstraint::Constraints Ellipse::angleRange = {0.0,360.0,1.0};
|
||||
|
||||
PROPERTY_SOURCE(Part::Ellipse, Part::Primitive)
|
||||
|
||||
|
||||
Ellipse::Ellipse()
|
||||
{
|
||||
ADD_PROPERTY(MajorRadius,(4.0f));
|
||||
ADD_PROPERTY(MinorRadius,(4.0f));
|
||||
ADD_PROPERTY(Angle0,(0.0f));
|
||||
Angle0.setConstraints(&angleRange);
|
||||
ADD_PROPERTY(Angle1,(360.0f));
|
||||
Angle1.setConstraints(&angleRange);
|
||||
}
|
||||
|
||||
Ellipse::~Ellipse()
|
||||
{
|
||||
}
|
||||
|
||||
short Ellipse::mustExecute() const
|
||||
{
|
||||
if (Angle0.isTouched() ||
|
||||
Angle1.isTouched() ||
|
||||
MajorRadius.isTouched() ||
|
||||
MinorRadius.isTouched())
|
||||
return 1;
|
||||
return Part::Feature::mustExecute();
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn *Ellipse::execute(void)
|
||||
{
|
||||
gp_Elips ellipse;
|
||||
ellipse.SetMajorRadius(this->MajorRadius.getValue());
|
||||
ellipse.SetMinorRadius(this->MinorRadius.getValue());
|
||||
|
||||
BRepBuilderAPI_MakeEdge clMakeEdge(ellipse, Base::toRadians<double>(this->Angle0.getValue()),
|
||||
Base::toRadians<double>(this->Angle1.getValue()));
|
||||
const TopoDS_Edge& edge = clMakeEdge.Edge();
|
||||
this->Shape.setValue(edge);
|
||||
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
|
||||
void Ellipse::onChanged(const App::Property* prop)
|
||||
{
|
||||
if (!isRestoring()) {
|
||||
if (prop == &MajorRadius || prop == &MinorRadius || prop == &Angle0 || prop == &Angle1){
|
||||
try {
|
||||
App::DocumentObjectExecReturn *ret = recompute();
|
||||
delete ret;
|
||||
}
|
||||
catch (...) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Part::Feature::onChanged(prop);
|
||||
}
|
||||
|
||||
@@ -265,6 +265,31 @@ protected:
|
||||
void onChanged(const App::Property* prop);
|
||||
};
|
||||
|
||||
class Ellipse : public Part::Primitive
|
||||
{
|
||||
PROPERTY_HEADER(Part::Ellipse);
|
||||
|
||||
public:
|
||||
Ellipse();
|
||||
virtual ~Ellipse();
|
||||
|
||||
App::PropertyFloat MajorRadius;
|
||||
App::PropertyFloat MinorRadius;
|
||||
App::PropertyAngle Angle0;
|
||||
App::PropertyAngle Angle1;
|
||||
|
||||
/** @name methods override feature */
|
||||
//@{
|
||||
/// recalculate the Feature
|
||||
App::DocumentObjectExecReturn *execute(void);
|
||||
short mustExecute() const;
|
||||
void onChanged(const App::Property*);
|
||||
//@}
|
||||
|
||||
private:
|
||||
static App::PropertyFloatConstraint::Constraints angleRange;
|
||||
};
|
||||
|
||||
} //namespace Part
|
||||
|
||||
|
||||
|
||||
@@ -312,7 +312,23 @@ void DlgPrimitives::createPrimitive(const QString& placement)
|
||||
.arg(ui.circleAngle1->value(),0,'f',2)
|
||||
.arg(placement);
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 10) { // vertex
|
||||
else if (ui.comboBox1->currentIndex() == 10) { // ellipse
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Ellipse").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Ellipse\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.MajorRadius=%2\n"
|
||||
"App.ActiveDocument.%1.MinorRadius=%3\n"
|
||||
"App.ActiveDocument.%1.Angle0=%4\n"
|
||||
"App.ActiveDocument.%1.Angle1=%5\n"
|
||||
"App.ActiveDocument.%1.Placement=%6\n")
|
||||
.arg(name)
|
||||
.arg(ui.ellipseMajorRadius->value(),0,'f',2)
|
||||
.arg(ui.ellipseMinorRadius->value(),0,'f',2)
|
||||
.arg(ui.ellipseAngle0->value(),0,'f',2)
|
||||
.arg(ui.ellipseAngle1->value(),0,'f',2)
|
||||
.arg(placement);
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 11) { // vertex
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Vertex").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Vertex\",\"%1\")\n"
|
||||
@@ -326,7 +342,7 @@ void DlgPrimitives::createPrimitive(const QString& placement)
|
||||
.arg(ui.vertexZ->value(),0,'f',2)
|
||||
.arg(placement);
|
||||
}
|
||||
else if (ui.comboBox1->currentIndex() == 11) { // line
|
||||
else if (ui.comboBox1->currentIndex() == 12) { // line
|
||||
name = QString::fromAscii(doc->getUniqueObjectName("Line").c_str());
|
||||
cmd = QString::fromAscii(
|
||||
"App.ActiveDocument.addObject(\"Part::Line\",\"%1\")\n"
|
||||
|
||||
@@ -84,6 +84,11 @@
|
||||
<string>Circle</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Ellipse</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Point</string>
|
||||
@@ -966,7 +971,7 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="wedgeXmin">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -976,7 +981,7 @@
|
||||
<item row="0" column="2">
|
||||
<widget class="QDoubleSpinBox" name="wedgeXmax">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -996,7 +1001,7 @@
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="wedgeYmin">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -1006,7 +1011,7 @@
|
||||
<item row="1" column="2">
|
||||
<widget class="QDoubleSpinBox" name="wedgeYmax">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -1026,7 +1031,7 @@
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="wedgeZmin">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -1036,7 +1041,7 @@
|
||||
<item row="2" column="2">
|
||||
<widget class="QDoubleSpinBox" name="wedgeZmax">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -1056,7 +1061,7 @@
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="wedgeX2min">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -1069,7 +1074,7 @@
|
||||
<item row="3" column="2">
|
||||
<widget class="QDoubleSpinBox" name="wedgeX2max">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -1089,7 +1094,7 @@
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="wedgeZ2min">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -1102,7 +1107,7 @@
|
||||
<item row="4" column="2">
|
||||
<widget class="QDoubleSpinBox" name="wedgeZ2max">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -1320,6 +1325,101 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QGridLayout" name="gridLayout_11">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_10">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelEllMajorRadius">
|
||||
<property name="text">
|
||||
<string>Major radius:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="ellipseMajorRadius">
|
||||
<property name="maximum">
|
||||
<double>1000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>4.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelEllMinorRadius">
|
||||
<property name="text">
|
||||
<string>Minor radius:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="ellipseMinorRadius">
|
||||
<property name="maximum">
|
||||
<double>1000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>2.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelEllAngle1">
|
||||
<property name="text">
|
||||
<string>Angle 1:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="ellipseAngle0">
|
||||
<property name="maximum">
|
||||
<double>360.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelEllAngle2">
|
||||
<property name="text">
|
||||
<string>Angle 2:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="ellipseAngle1">
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>360.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>360.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>131</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page10_vertex">
|
||||
<layout class="QGridLayout" name="gridLayout_9">
|
||||
<item row="0" column="0">
|
||||
|
||||
@@ -241,9 +241,6 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
|
||||
|
||||
state->push();
|
||||
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, srcw);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||
|
||||
glPushAttrib(GL_ENABLE_BIT | GL_PIXEL_MODE_BIT | GL_COLOR_BUFFER_BIT);
|
||||
glDisable(GL_LIGHTING);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@@ -282,7 +279,7 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
|
||||
glEnd();
|
||||
|
||||
// Reset the Mode
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||
|
||||
glPopAttrib();
|
||||
state->pop();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user