Commit 5a01c13e authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by Kitware Robot
Browse files

Merge topic '13468_cube_axis_inner_grid_visibility'

c208ac9c Add support for CubeAxes origin definition inside property panel
0e14ecfe Fix cube axis to support independant grid/axis flying mode
parents e83f939e c208ac9c
......@@ -387,6 +387,7 @@ void vtkCubeAxesRepresentation::SetXTitle(const char* val)
void vtkCubeAxesRepresentation::SetXAxisVisibility(int val)
{
this->CubeAxesActor->SetXAxisVisibility(val);
this->CubeAxesActor->SetXAxisLabelVisibility(val);
}
//----------------------------------------------------------------------------
......@@ -417,6 +418,7 @@ void vtkCubeAxesRepresentation::SetYTitle(const char* val)
void vtkCubeAxesRepresentation::SetYAxisVisibility(int val)
{
this->CubeAxesActor->SetYAxisVisibility(val);
this->CubeAxesActor->SetYAxisLabelVisibility(val);
}
//----------------------------------------------------------------------------
......@@ -447,6 +449,7 @@ void vtkCubeAxesRepresentation::SetZTitle(const char* val)
void vtkCubeAxesRepresentation::SetZAxisVisibility(int val)
{
this->CubeAxesActor->SetZAxisVisibility(val);
this->CubeAxesActor->SetZAxisLabelVisibility(val);
}
//----------------------------------------------------------------------------
......@@ -472,6 +475,23 @@ void vtkCubeAxesRepresentation::SetGridLineLocation(int val)
{
this->CubeAxesActor->SetGridLineLocation(val);
}
//----------------------------------------------------------------------------
void vtkCubeAxesRepresentation::SetUseOfAxesOrigin(int val)
{
this->CubeAxesActor->SetUseAxisOrigin(val);
}
//----------------------------------------------------------------------------
void vtkCubeAxesRepresentation::SetAxesOrigin(double valX, double valY, double valZ)
{
this->CubeAxesActor->SetAxisOrigin(valX, valY, valZ);
}
//----------------------------------------------------------------------------
void vtkCubeAxesRepresentation::SetAxesOrigin(double val[3])
{
this->CubeAxesActor->SetAxisOrigin(val);
}
//----------------------------------------------------------------------------
void vtkCubeAxesRepresentation::ConfigureCubeAxes(vtkDataObject* input)
......@@ -560,18 +580,4 @@ void vtkCubeAxesRepresentation::ConfigureCubeAxes(vtkDataObject* input)
this->UseOrientedBounds = false;
this->CubeAxesActor->SetUseOrientedBounds(0);
}
// Make sure we enable the custom origin if any
vtkFloatArray* customOrigin =
vtkFloatArray::SafeDownCast(fieldData->GetArray("AxisOrigin"));
if(customOrigin)
{
this->CubeAxesActor->SetUseAxisOrigin(1);
this->CubeAxesActor->SetAxisOrigin(customOrigin->GetTuple(0));
}
else
{
this->CubeAxesActor->SetUseAxisOrigin(0);
}
}
......@@ -158,6 +158,11 @@ public:
virtual void SetDrawZGridlines(int val);
virtual void SetGridLineLocation(int val);
virtual void SetUseOfAxesOrigin(int val);
virtual void SetAxesOrigin(double valX, double valY, double valZ);
virtual void SetAxesOrigin(double val[3]);
//BTX
protected:
vtkCubeAxesRepresentation();
......
......@@ -1261,6 +1261,8 @@
<Property name="OriginalBoundsRangeActive" />
<Property name="CustomRange" />
<Property name="CustomRangeActive" />
<Property name="UseAxesOrigin" />
<Property name="AxesOrigin" />
</PropertyGroup>
</ExposedProperties>
<ShareProperties subproxy="SurfaceRepresentation">
......@@ -2936,6 +2938,19 @@
</EnumerationDomain>
<Documentation>Set the location of tick marks.</Documentation>
</IntVectorProperty>
<DoubleVectorProperty command="SetAxesOrigin"
default_values="0 0 0"
name="AxesOrigin"
number_of_elements="3">
<DoubleRangeDomain name="range" />
</DoubleVectorProperty>
<IntVectorProperty command="SetUseOfAxesOrigin"
default_values="0"
name="UseAxesOrigin"
number_of_elements="1">
<BooleanDomain name="bool" />
<Documentation>Specify if the AxesCenter should be used to draw the axes.</Documentation>
</IntVectorProperty>
<!-- End of CubeAxesRepresentation -->
</RepresentationProxy>
<!-- ================================================================== -->
......@@ -4302,6 +4317,8 @@
<Property name="OriginalBoundsRangeActive" />
<Property name="CustomRange" />
<Property name="CustomRangeActive" />
<Property name="UseAxesOrigin" />
<Property name="AxesOrigin" />
</PropertyGroup>
</ExposedProperties>
<ShareProperties subproxy="SurfaceRepresentation">
......
......@@ -42,18 +42,6 @@
</Documentation>
</DoubleVectorProperty>
<DoubleVectorProperty
name="AxisOrigin"
command="SetAxisOrigin"
number_of_elements="3"
default_values="0.0 0.0 0.0"
panel_visibility="default" >
<DoubleRangeDomain name="range"/>
<Documentation>
The values of this property set the corresponding X axis direction.
</Documentation>
</DoubleVectorProperty>
<DoubleVectorProperty
name="OrientedBoundingBox"
label="Oriented bounds"
......@@ -113,16 +101,6 @@
<BooleanDomain name="bool"/>
</IntVectorProperty>
<IntVectorProperty
name="EnableCustomBounds"
label="Use Bounds"
command="SetEnableCustomBounds"
number_of_elements="1"
default_values="0"
panel_visibility="default">
<BooleanDomain name="bool"/>
</IntVectorProperty>
<IntVectorProperty
name="EnableCustomTitle"
label="Use Titles"
......@@ -133,16 +111,6 @@
<BooleanDomain name="bool"/>
</IntVectorProperty>
<IntVectorProperty
name="EnableCustomOrigin"
label="Axes Origin"
command="SetEnableCustomOrigin"
number_of_elements="1"
default_values="0"
panel_visibility="default">
<BooleanDomain name="bool"/>
</IntVectorProperty>
<IntVectorProperty
name="EnableTimeLabel"
label="Use Time label"
......
......@@ -37,14 +37,12 @@ vtkStandardNewMacro(vtkShearedCubeSource);
vtkShearedCubeSource::vtkShearedCubeSource()
{
this->EnableCustomBase = 0;
this->EnableCustomBounds = 0;
this->EnableCustomTitle = 0;
this->EnableCustomOrigin = 0;
this->EnableTimeLabel = 0;
for(int i=0; i < 3; i++)
{
this->BaseU[i] = this->BaseV[i] = this->BaseW[i] = this->AxisOrigin[i] = 0;
this->BaseU[i] = this->BaseV[i] = this->BaseW[i] = 0;
this->OrientedBoundingBox[i*2] = -0.5;
this->OrientedBoundingBox[i*2 + 1] = +0.5;
}
......@@ -186,7 +184,6 @@ void vtkShearedCubeSource::UpdateMetaData(vtkDataSet* ds)
fieldData->RemoveArray("AxisBaseForY");
fieldData->RemoveArray("AxisBaseForZ");
fieldData->RemoveArray("OrientedBoundingBox");
fieldData->RemoveArray("AxisOrigin");
fieldData->RemoveArray("AxisTitleForX");
fieldData->RemoveArray("AxisTitleForY");
fieldData->RemoveArray("AxisTitleForZ");
......@@ -214,10 +211,7 @@ void vtkShearedCubeSource::UpdateMetaData(vtkDataSet* ds)
wBase->SetName("AxisBaseForZ");
wBase->SetTuple(0, this->BaseW);
fieldData->AddArray(wBase.GetPointer());
}
if(this->EnableCustomBounds)
{
// New oriented bounding box
vtkNew<vtkFloatArray> orientedBoundingBox;
orientedBoundingBox->SetNumberOfComponents(6);
......@@ -227,17 +221,6 @@ void vtkShearedCubeSource::UpdateMetaData(vtkDataSet* ds)
fieldData->AddArray(orientedBoundingBox.GetPointer());
}
if(this->EnableCustomOrigin)
{
// Axis meta-data
vtkNew<vtkFloatArray> axisOrigin;
axisOrigin->SetNumberOfComponents(3);
axisOrigin->SetNumberOfTuples(1);
axisOrigin->SetName("AxisOrigin");
axisOrigin->SetTuple(0, this->AxisOrigin);
fieldData->AddArray(axisOrigin.GetPointer());
}
if(this->EnableCustomTitle)
{
// Axis titles
......
......@@ -45,11 +45,6 @@ public:
vtkSetVector3Macro(BaseW,double);
vtkGetVectorMacro(BaseW,double,3);
// Description:
// Set the origin of the cub axis
vtkSetVector3Macro(AxisOrigin,double);
vtkGetVectorMacro(AxisOrigin,double,3);
// Description:
// Set the oriented bounding box
vtkSetVector6Macro(OrientedBoundingBox,double);
......@@ -69,22 +64,11 @@ public:
vtkSetMacro(EnableCustomBase, int);
vtkGetMacro(EnableCustomBase, int);
// Description:
// Enable/Disable field generation for oriented bounding box annotation
vtkSetMacro(EnableCustomBounds, int);
vtkGetMacro(EnableCustomBounds, int);
// Description:
// Enable/Disable field generation for oriented bounding box annotation
vtkSetMacro(EnableCustomTitle, int);
vtkGetMacro(EnableCustomTitle, int);
// Description:
// Enable/Disable field generation for oriented bounding box annotation
vtkSetMacro(EnableCustomOrigin, int);
vtkGetMacro(EnableCustomOrigin, int);
// Description:
// Enable/Disable field generation for label that will be used for "Time:"
vtkSetMacro(EnableTimeLabel, int);
......@@ -111,16 +95,13 @@ protected:
double BaseV[3];
double BaseW[3];
double OrientedBoundingBox[6];
double AxisOrigin[3];
char* AxisUTitle;
char* AxisVTitle;
char* AxisWTitle;
char* TimeLabel;
int EnableCustomBase;
int EnableCustomBounds;
int EnableCustomTitle;
int EnableCustomOrigin;
int EnableTimeLabel;
private:
......
......@@ -7,106 +7,14 @@
<x>0</x>
<y>0</y>
<width>338</width>
<height>601</height>
<height>676</height>
</rect>
</property>
<property name="windowTitle">
<string>Edit Cube Axes Properties</string>
</property>
<layout class="QGridLayout">
<item row="7" column="0" colspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>313</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="CubeAxesTickLocation">
<item>
<property name="text">
<string>Inside</string>
</property>
</item>
<item>
<property name="text">
<string>Outside</string>
</property>
</item>
<item>
<property name="text">
<string>Both</string>
</property>
</item>
</widget>
</item>
<item row="3" column="1" rowspan="2">
<widget class="QDoubleSpinBox" name="CubeAxesCornerOffset">
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.050000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0" rowspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Tick Location</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Corner Offset</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="CubeAxesFlyMode">
<item>
<property name="text">
<string>Outer Edges</string>
</property>
</item>
<item>
<property name="text">
<string>Closest Triad</string>
</property>
</item>
<item>
<property name="text">
<string>Furthest Triad</string>
</property>
</item>
<item>
<property name="text">
<string>Static Triad</string>
</property>
</item>
<item>
<property name="text">
<string>Static Edges</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Fly Mode</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
......@@ -539,41 +447,161 @@
</widget>
</widget>
</item>
<item row="8" column="0" colspan="2">
<layout class="QHBoxLayout">
<property name="spacing">
<number>4</number>
<item>
<layout class="QGridLayout" name="FormLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Fly Mode</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="CubeAxesFlyMode">
<item>
<property name="text">
<string>Outer Edges</string>
</property>
</item>
<item>
<property name="text">
<string>Closest Triad</string>
</property>
</item>
<item>
<property name="text">
<string>Furthest Triad</string>
</property>
</item>
<item>
<property name="text">
<string>Static Triad</string>
</property>
</item>
<item>
<property name="text">
<string>Static Edges</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Tick Location</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="CubeAxesTickLocation">
<item>
<property name="text">
<string>Inside</string>
</property>
</item>
<item>
<property name="text">
<string>Outside</string>
</property>
</item>
<item>
<property name="text">
<string>Both</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Corner Offset</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="CubeAxesCornerOffset">
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.050000000000000</double>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Grid Line Location</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="CubeAxesGridLineLocation">
<item>
<property name="text">
<string>All Faces</string>
</property>
</item>
<item>
<property name="text">
<string>Furthest Faces</string>
</property>
</item>
<item>
<property name="text">
<string>Closest Faces</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Custom Axes origin</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="UseAxesOrigin">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="AxesOriginLayout">
<property name="topMargin">
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
<widget class="QLineEdit" name="AxesOriginX">
<property name="enabled">
<bool>true</bool>
</property>
</spacer>
</widget>
</item>
<item>
<widget class="QPushButton" name="Ok">
<property name="text">
<string>Ok</string>
<widget class="QLineEdit" name="AxesOriginY">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="Cancel">
<property name="text">
<string>Cancel</string>
<widget class="QLineEdit" name="AxesOriginZ">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="0" colspan="2">
<item>
<widget class="pqStandardColorButton" name="Color">
<property name="enabled">
<bool>true</bool>
......@@ -592,31 +620,52 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="CubeAxesGridLineLocation">
<item>
<spacer name="VerticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>313</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="ButtonLayout">
<property name="spacing">
<number>4</number>
</property>
<item>
<property name="text">
<string>All Faces</string>
</property>
<spacer name="HorizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>