...
 
Commits (2)
  • David Thompson's avatar
    Improvements to the bounding box widget. · 4220f4d6
    David Thompson authored
    + Accept bounding boxes defined via either a single
      DoubleItem or a Group containing DoubleItems in a
      variety of configurations (including some with and
      some without Tait-Bryan angles, which are similar
      to Euler angles).
    + Properly restore bounding box state from saved items.
    4220f4d6
  • David Thompson's avatar
    Add a release note. · 00d79b0f
    David Thompson authored
    00d79b0f
# ParaView Extensions
## Widgets
The box widget now accepts a single DoubleItem (with 6 entries)
specifying an axis-aligned bounding box or a GroupItem
containing multiple DoubleItems that configure a bounding box
in different ways depending on how they are used.
See the pqSMTKBoxItemWidget header for details.
...@@ -1816,6 +1816,42 @@ ...@@ -1816,6 +1816,42 @@
</PropertyGroup> </PropertyGroup>
</Proxy> </Proxy>
<!-- Axis-aligned box widget -->
<Proxy
name="SMTKAxisAlignedBoxWidget"
class="vtkPVBox"
>
<DoubleVectorProperty command="SetBounds"
default_values="0 1 0 1 0 1"
name="Bounds"
number_of_elements="6"></DoubleVectorProperty>
<DoubleVectorProperty animateable="1"
command="SetPosition"
default_values="0.0 0.0 0.0"
name="Position"
number_of_elements="3">
<DoubleRangeDomain name="range" />
<Documentation>
Set the position of the box.
</Documentation>
</DoubleVectorProperty>
<DoubleVectorProperty animateable="1"
command="SetScale"
default_values="1.0 1.0 1.0"
name="Scale"
number_of_elements="3">
<DoubleRangeDomain name="range" />
<Documentation>
Set the size of the box via a scale factor.
</Documentation>
</DoubleVectorProperty>
<PropertyGroup panel_widget="InteractiveBox" label="Box Parameters">
<Property function="Position" name="Position" />
<Property function="Scale" name="Scale" />
<Property function="PlaceWidget" name="Bounds" />
</PropertyGroup>
</Proxy>
</ProxyGroup> </ProxyGroup>
<ProxyGroup name="settings"> <ProxyGroup name="settings">
......
...@@ -39,16 +39,29 @@ public: ...@@ -39,16 +39,29 @@ public:
static qtItem* createBoxItemWidget(const AttributeItemInfo& info); static qtItem* createBoxItemWidget(const AttributeItemInfo& info);
bool createProxyAndWidget(vtkSMProxy*& proxy, pqInteractivePropertyWidget*& widget) override; bool createProxyAndWidget(vtkSMProxy*& proxy, pqInteractivePropertyWidget*& widget) override;
/// Retrieve property values from ParaView proxy and store them in the attribute's Item.
void updateItemFromWidget() override; void updateItemFromWidget() override;
/// Retrieve property values from the attribute's Item and update the ParaView proxy.
void updateWidgetFromItem() override;
protected: protected:
/// Describe how an attribute's items specify a bounding box.
enum class ItemBindings enum class ItemBindings
{ {
AxisAlignedBounds, //!< 1 item with 6 values (xmin, xmax, ymin, ymax, zmin, zmax) /// 1 item with 6 values (xmin, xmax, ymin, ymax, zmin, zmax)
AxisAlignedMinMax, //!< 2 items with 3 values each (xlo, ylo, zlo), (xhi, yhi, zhi) AxisAlignedBounds,
AxisAlignedCenterDeltas, //!< 2 items with 3 values each (xc, yc, zc), (dx, dy, dz) /// 2 items with 3 values each (xlo, ylo, zlo), (xhi, yhi, zhi)
EulerAngleMinMax, //!< 3 items with 3 values each (xlo, ylo, zlo), (xhi, yhi, zhi), (roll, pitch, yaw) AxisAlignedMinMax,
EulerAngleCenterDeltas //!< 3 items with 3 values each (xc, yc, zc), (dx, dy, dz), (roll, pitch, yaw) /// 2 items with 3 values each (xc, yc, zc), (dx, dy, dz)
AxisAlignedCenterDeltas,
/// 1 item with 6 values (min/max as above), 1 item with (roll, pitch, yaw)
EulerAngleBounds,
/// 3 items with 3 values each (xlo, ylo, zlo), (xhi, yhi, zhi), (roll, pitch, yaw)
EulerAngleMinMax,
/// 3 items with 3 values each (xc, yc, zc), (dx, dy, dz), (roll, pitch, yaw)
EulerAngleCenterDeltas,
/// No consistent set of items detected.
Invalid
}; };
/**\brief Starting with the widget's assigned item (which may /**\brief Starting with the widget's assigned item (which may
* be a GroupItem or a DoubleItem), determine and return bound items. * be a GroupItem or a DoubleItem), determine and return bound items.
...@@ -56,15 +69,14 @@ protected: ...@@ -56,15 +69,14 @@ protected:
* If errors are encountered, this method returns false. * If errors are encountered, this method returns false.
* If the name of a DoubleItem is provided, then the AxisAlignedBounds binding * If the name of a DoubleItem is provided, then the AxisAlignedBounds binding
* is assumed and that item is returned as the sole entry of \items. * is assumed and that item is returned as the sole entry of \items.
* Otherwise, the named item must be a Group holding items called out as one * Otherwise, the named item must be a Group holding items called out as via
* of the following: * one of the remaining valid ItemBindings enumerants.
* + AxisAlignedMinMax: "Min", "Max" with numberOfValues == 3
* + AxisAlignedCenterDeltas: "Center", "Deltas", with numberOfValues == 3
* + EulerAngleMinMax: "Angles", "Min", "Max" with numberOfValues == 3
* + EulerAngleCenterDeltas: "Angles, "Center", "Deltas" with numberOfValues == 3
* *
* Euler angles must be provided in degrees and are roll, pitch, and yaw * Angles must be provided in degrees and are Tait-Bryan angles
* (i.e., rotation about the x, y, and z axes, respectively). * as used by VTK (i.e., rotations about y then x then z axes).
* These are similar to Euler angles and sometimes called as such.
* See https://en.wikipedia.org/wiki/Euler_angles#Intrinsic_rotations
* for more information. VTK uses the Y_1 X_2 Z_3 ordering.
*/ */
bool fetchBoxItems(ItemBindings& binding, std::vector<smtk::attribute::DoubleItemPtr>& items); bool fetchBoxItems(ItemBindings& binding, std::vector<smtk::attribute::DoubleItemPtr>& items);
}; };
......