[TD]Property types and spinboxes for Detail
This commit is contained in:
@@ -139,7 +139,6 @@ void DrawViewDetail::onChanged(const App::Property* prop)
|
||||
|
||||
App::DocumentObjectExecReturn* DrawViewDetail::execute()
|
||||
{
|
||||
// Base::Console().Message("DVD::execute() - %s\n", getNameInDocument());
|
||||
if (!keepUpdated()) {
|
||||
return DrawView::execute();
|
||||
}
|
||||
@@ -254,6 +253,7 @@ void DrawViewDetail::makeDetailShape(const TopoDS_Shape& shape3d, DrawViewPart*
|
||||
|
||||
TopoDS_Face extrusionFace;
|
||||
Base::Vector3d extrudeVec = dirDetail * extrudeLength;
|
||||
|
||||
gp_Vec extrudeDir(extrudeVec.x, extrudeVec.y, extrudeVec.z);
|
||||
TopoDS_Shape tool;
|
||||
if (Preferences::mattingStyle()) {
|
||||
@@ -381,7 +381,6 @@ void DrawViewDetail::makeDetailShape(const TopoDS_Shape& shape3d, DrawViewPart*
|
||||
|
||||
void DrawViewDetail::postHlrTasks(void)
|
||||
{
|
||||
// Base::Console().Message("DVD::postHlrTasks()\n");
|
||||
DrawViewPart::postHlrTasks();
|
||||
|
||||
geometryObject->pruneVertexGeom(Base::Vector3d(0.0, 0.0, 0.0),
|
||||
@@ -465,9 +464,35 @@ bool DrawViewDetail::debugDetail() const
|
||||
return Preferences::getPreferenceGroup("debug")->GetBool("debugDetail", false);
|
||||
}
|
||||
|
||||
void DrawViewDetail::handleChangedPropertyType(Base::XMLReader &reader, const char * TypeName, App::Property * prop)
|
||||
{
|
||||
if (prop == &AnchorPoint) {
|
||||
// AnchorPoint was PropertyVector but is now PropertyPosition
|
||||
App::PropertyVector tmp;
|
||||
if (strcmp(tmp.getTypeId().getName(), TypeName)==0) {
|
||||
tmp.setContainer(this);
|
||||
tmp.Restore(reader);
|
||||
auto tmpValue = tmp.getValue();
|
||||
AnchorPoint.setValue(tmpValue);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop == &Radius) {
|
||||
// Radius was PropertyFloat but is now PropertyLength
|
||||
App::PropertyLength tmp;
|
||||
if (strcmp(tmp.getTypeId().getName(), TypeName)==0) {
|
||||
tmp.setContainer(this);
|
||||
tmp.Restore(reader);
|
||||
auto tmpValue = tmp.getValue();
|
||||
Radius.setValue(tmpValue);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawViewDetail::unsetupObject()
|
||||
{
|
||||
// Base::Console().Message("DVD::unsetupObject()\n");
|
||||
App::DocumentObject* baseObj = BaseView.getValue();
|
||||
DrawView* base = dynamic_cast<DrawView*>(baseObj);
|
||||
if (base) {
|
||||
|
||||
@@ -57,8 +57,8 @@ public:
|
||||
~DrawViewDetail() override;
|
||||
|
||||
App::PropertyLink BaseView;
|
||||
App::PropertyVector AnchorPoint;
|
||||
App::PropertyFloat Radius;
|
||||
App::PropertyPosition AnchorPoint;
|
||||
App::PropertyLength Radius;
|
||||
App::PropertyString Reference;
|
||||
|
||||
App::PropertyBool ShowMatting;
|
||||
@@ -71,6 +71,8 @@ public:
|
||||
return "TechDrawGui::ViewProviderViewPart";
|
||||
}
|
||||
void unsetupObject() override;
|
||||
void handleChangedPropertyType(
|
||||
Base::XMLReader &reader, const char * TypeName, App::Property * prop) override;
|
||||
|
||||
|
||||
void detailExec(TopoDS_Shape& s,
|
||||
|
||||
@@ -6,10 +6,16 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>264</height>
|
||||
<width>497</width>
|
||||
<height>367</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Detail Anchor</string>
|
||||
</property>
|
||||
@@ -107,95 +113,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2" columnstretch="2,0,0">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string notr="true">X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsbX">
|
||||
<property name="toolTip">
|
||||
<string>x position of detail highlight within view</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string notr="true">Y</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsbY">
|
||||
<property name="toolTip">
|
||||
<string>y position of detail highlight within view</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Radius</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsbRadius">
|
||||
<property name="toolTip">
|
||||
<string>size of detail view</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<layout class="QGridLayout" name="gridLayout_2" columnstretch="1,0,2">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
@@ -203,35 +121,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QComboBox" name="cbScaleType">
|
||||
<item row="5" column="2">
|
||||
<widget class="QLineEdit" name="leReference">
|
||||
<property name="toolTip">
|
||||
<string>Page: scale factor of page is used
|
||||
Automatic: if the detail view is larger than the page,
|
||||
it will be scaled down to fit into the page
|
||||
Custom: custom scale factor is used</string>
|
||||
<string>reference label</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Page</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Automatic</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Custom</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Scale Factor</string>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -260,6 +156,60 @@ Custom: custom scale factor is used</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsbY">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>y position of detail highlight within view</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Scale Factor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsbRadius">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>size of detail view</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
@@ -267,16 +217,84 @@ Custom: custom scale factor is used</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QLineEdit" name="leReference">
|
||||
<item row="0" column="2">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsbX">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>reference label</string>
|
||||
<string>x position of detail highlight within view</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Radius</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string notr="true">X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QComboBox" name="cbScaleType">
|
||||
<property name="toolTip">
|
||||
<string>Page: scale factor of page is used
|
||||
Automatic: if the detail view is larger than the page,
|
||||
it will be scaled down to fit into the page
|
||||
Custom: custom scale factor is used</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Page</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Automatic</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Custom</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string notr="true">Y</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
Reference in New Issue
Block a user