remove unused files
This commit is contained in:
parent
10fa1e4a69
commit
2ad90ac2bb
|
@ -72,41 +72,44 @@ namespace
|
||||||
sensor->setTickmarksLabels( axis, labels );
|
sensor->setTickmarksLabels( axis, labels );
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_REQUIRED_RESULT QskSlider* makeTickmarksSlider( const Qt::Axis axis, QskLevelingSensor* const sensor, int min, int max, std::function<QskIntervalF(qreal)> intervalA, std::function<QskIntervalF(qreal)> intervalB, QQuickItem* const parent = nullptr )
|
Q_REQUIRED_RESULT QskSlider* makeTickmarksSlider( const Qt::Axis axis,
|
||||||
|
QskLevelingSensor* const sensor, int min, int max,
|
||||||
|
std::function< QskIntervalF( qreal ) > intervalA,
|
||||||
|
std::function< QskIntervalF( qreal ) > intervalB, QQuickItem* const parent = nullptr )
|
||||||
{
|
{
|
||||||
auto* const slider = new QskSlider( Qt::Horizontal, parent );
|
auto* const slider = new QskSlider( Qt::Horizontal, parent );
|
||||||
slider->setMinimum( min );
|
slider->setMinimum( min );
|
||||||
slider->setMaximum( max );
|
slider->setMaximum( max );
|
||||||
|
|
||||||
QObject::connect(slider, &QskSlider::valueChanged, sensor, [ = ]( const qreal degree ) {
|
QObject::connect( slider, &QskSlider::valueChanged, sensor, [ = ]( const qreal degree ) {
|
||||||
updateTickmarks( axis, intervalA(degree), intervalB(degree), sensor );
|
updateTickmarks( axis, intervalA( degree ), intervalB( degree ), sensor );
|
||||||
updateTickmarksLabels( axis, intervalA( degree ), intervalB( degree ), 10, sensor );
|
updateTickmarksLabels( axis, intervalA( degree ), intervalB( degree ), 10, sensor );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
return slider;
|
return slider;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_REQUIRED_RESULT QskSlider* makeRotationSlider(
|
Q_REQUIRED_RESULT QskSlider* makeRotationSlider( const Qt::Axis axis,
|
||||||
const Qt::Axis axis, QskLevelingSensor* const sensor, const QskAspect::Subcontrol subControl, QQuickItem* const parent = nullptr )
|
QskLevelingSensor* const sensor, const QskAspect::Subcontrol subControl,
|
||||||
|
QQuickItem* const parent = nullptr )
|
||||||
{
|
{
|
||||||
auto* const slider = new QskSlider( Qt::Horizontal, parent );
|
auto* const slider = new QskSlider( Qt::Horizontal, parent );
|
||||||
slider->setMinimum( -360 );
|
slider->setMinimum( -360 );
|
||||||
slider->setMaximum( +360 );
|
slider->setMaximum( +360 );
|
||||||
|
|
||||||
QObject::connect( sensor, &QskLevelingSensor::subControlRotationChanged, slider,
|
QObject::connect( sensor, &QskLevelingSensor::subControlRotationChanged, slider,
|
||||||
[ = ]( const QskAspect::Subcontrol control, const QVector3D& degree ) {
|
[ = ]( const QskAspect::Subcontrol control, const QVector3D& degree ) {
|
||||||
if(control == subControl)
|
if ( control == subControl )
|
||||||
{
|
{
|
||||||
slider->setValue( degree[ axis ] );
|
slider->setValue( degree[ axis ] );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
QObject::connect( slider, &QskSlider::valueChanged, sensor,
|
QObject::connect( slider, &QskSlider::valueChanged, sensor, [ = ]( const qreal degree ) {
|
||||||
[ = ]( const qreal degree ) {
|
auto d = sensor->subControlRotation( subControl );
|
||||||
auto d = sensor->subControlRotation( subControl );
|
d[ axis ] = degree;
|
||||||
d[ axis ] = degree;
|
sensor->setSubControlRotation( subControl, d );
|
||||||
sensor->setSubControlRotation( subControl, d );
|
} );
|
||||||
} );
|
|
||||||
|
|
||||||
return slider;
|
return slider;
|
||||||
}
|
}
|
||||||
|
@ -117,24 +120,33 @@ namespace
|
||||||
Window()
|
Window()
|
||||||
{
|
{
|
||||||
auto* const root = new QskLinearBox( Qt::Horizontal, contentItem() );
|
auto* const root = new QskLinearBox( Qt::Horizontal, contentItem() );
|
||||||
root->setSpacing(8);
|
root->setSpacing( 8 );
|
||||||
root->setMargins(8);
|
root->setMargins( 8 );
|
||||||
auto* const left = new QskLinearBox( Qt::Vertical, root );
|
auto* const left = new QskLinearBox( Qt::Vertical, root );
|
||||||
auto* const right = new QskLinearBox( Qt::Vertical, root );
|
auto* const right = new QskLinearBox( Qt::Vertical, root );
|
||||||
auto* const sensor = new QskLevelingSensor( left );
|
auto* const sensor = new QskLevelingSensor( left );
|
||||||
|
|
||||||
auto linearIntervalA = [](const qreal degree)->QskIntervalF{ return {-degree, +degree};};
|
auto linearIntervalA = []( const qreal degree ) -> QskIntervalF {
|
||||||
auto linearIntervalB = [](const qreal degree)->QskIntervalF{ return {}; };
|
return { -degree, +degree };
|
||||||
|
};
|
||||||
auto radialIntervalA = [](const qreal degree)->QskIntervalF{ return {-degree, +degree};};
|
auto linearIntervalB = []( const qreal degree ) -> QskIntervalF { return {}; };
|
||||||
auto radialIntervalB = [](const qreal degree)->QskIntervalF{ return {180-degree, 180+degree};};
|
|
||||||
|
auto radialIntervalA = []( const qreal degree ) -> QskIntervalF {
|
||||||
|
return { -degree, +degree };
|
||||||
|
};
|
||||||
|
auto radialIntervalB = []( const qreal degree ) -> QskIntervalF {
|
||||||
|
return { 180 - degree, 180 + degree };
|
||||||
|
};
|
||||||
|
|
||||||
( void ) new QskTextLabel( "Tickmarks X", right );
|
( void ) new QskTextLabel( "Tickmarks X", right );
|
||||||
auto* const sliderTickmarksX = makeTickmarksSlider( Qt::XAxis, sensor, 0, 90, linearIntervalA, linearIntervalB, right );
|
auto* const sliderTickmarksX = makeTickmarksSlider(
|
||||||
|
Qt::XAxis, sensor, 0, 90, linearIntervalA, linearIntervalB, right );
|
||||||
( void ) new QskTextLabel( "Tickmarks Y", right );
|
( void ) new QskTextLabel( "Tickmarks Y", right );
|
||||||
auto* const sliderTickmarksY = makeTickmarksSlider( Qt::YAxis, sensor, 0, 90, linearIntervalA, linearIntervalB, right );
|
auto* const sliderTickmarksY = makeTickmarksSlider(
|
||||||
|
Qt::YAxis, sensor, 0, 90, linearIntervalA, linearIntervalB, right );
|
||||||
( void ) new QskTextLabel( "Tickmarks Z", right );
|
( void ) new QskTextLabel( "Tickmarks Z", right );
|
||||||
auto* const sliderTickmarksZ = makeTickmarksSlider( Qt::ZAxis, sensor, 0, 90, radialIntervalA, radialIntervalB, right );
|
auto* const sliderTickmarksZ = makeTickmarksSlider(
|
||||||
|
Qt::ZAxis, sensor, 0, 90, radialIntervalA, radialIntervalB, right );
|
||||||
|
|
||||||
( void ) new QskTextLabel( "Rotation X Plane", right );
|
( void ) new QskTextLabel( "Rotation X Plane", right );
|
||||||
( void ) makeRotationSlider( Qt::XAxis, sensor, QskLevelingSensor::TickmarksX, right );
|
( void ) makeRotationSlider( Qt::XAxis, sensor, QskLevelingSensor::TickmarksX, right );
|
||||||
|
@ -149,9 +161,9 @@ namespace
|
||||||
( void ) makeRotationSlider( Qt::YAxis, sensor, QskLevelingSensor::TickmarksZ, right );
|
( void ) makeRotationSlider( Qt::YAxis, sensor, QskLevelingSensor::TickmarksZ, right );
|
||||||
( void ) makeRotationSlider( Qt::ZAxis, sensor, QskLevelingSensor::TickmarksZ, right );
|
( void ) makeRotationSlider( Qt::ZAxis, sensor, QskLevelingSensor::TickmarksZ, right );
|
||||||
|
|
||||||
sliderTickmarksX->setValue(15);
|
sliderTickmarksX->setValue( 15 );
|
||||||
sliderTickmarksY->setValue(15);
|
sliderTickmarksY->setValue( 15 );
|
||||||
sliderTickmarksZ->setValue(30);
|
sliderTickmarksZ->setValue( 30 );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,10 +175,10 @@ private:
|
||||||
QVector3D m_tickmarkSize = { 1.0, 2.0, 4.0 };
|
QVector3D m_tickmarkSize = { 1.0, 2.0, 4.0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
class PolygonClipNode final : public QSGClipNode
|
class RadialClipNode final : public QSGClipNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PolygonClipNode() : m_geometry(QSGGeometry::defaultAttributes_Point2D(), 0)
|
RadialClipNode() : m_geometry(QSGGeometry::defaultAttributes_Point2D(), 0)
|
||||||
{
|
{
|
||||||
m_geometry.setVertexDataPattern(QSGGeometry::DynamicPattern);
|
m_geometry.setVertexDataPattern(QSGGeometry::DynamicPattern);
|
||||||
m_geometry.setDrawingMode(QSGGeometry::DrawTriangleFan);
|
m_geometry.setDrawingMode(QSGGeometry::DrawTriangleFan);
|
||||||
|
|
|
@ -252,7 +252,7 @@ QSGNode* QskLevelingSensorSkinlet::updateSubNode< R::TickmarksX >(
|
||||||
const auto r3 = state.r1 * scale.height();
|
const auto r3 = state.r1 * scale.height();
|
||||||
|
|
||||||
auto* const clipping =
|
auto* const clipping =
|
||||||
ensureNode< PolygonClipNode, QSGTransformNode, LinearTickmarksNode >(
|
ensureNode< RadialClipNode, QSGTransformNode, LinearTickmarksNode >(
|
||||||
node );
|
node );
|
||||||
auto* const transform = static_cast< QSGTransformNode* >( clipping->firstChild() );
|
auto* const transform = static_cast< QSGTransformNode* >( clipping->firstChild() );
|
||||||
auto* const tickmarks = static_cast< LinearTickmarksNode* >( transform->firstChild() );
|
auto* const tickmarks = static_cast< LinearTickmarksNode* >( transform->firstChild() );
|
||||||
|
@ -285,7 +285,7 @@ QSGNode* QskLevelingSensorSkinlet::updateSubNode< R::TickmarksY >(
|
||||||
const auto rotation = sensor->subControlRotation( subControl );
|
const auto rotation = sensor->subControlRotation( subControl );
|
||||||
|
|
||||||
auto* const cNode =
|
auto* const cNode =
|
||||||
ensureNode< PolygonClipNode,QSGTransformNode, LinearTickmarksNode>(
|
ensureNode< RadialClipNode,QSGTransformNode, LinearTickmarksNode>(
|
||||||
node );
|
node );
|
||||||
auto* const tNode = static_cast< QSGTransformNode* >( cNode->firstChild() );
|
auto* const tNode = static_cast< QSGTransformNode* >( cNode->firstChild() );
|
||||||
auto* const lNode = static_cast< LinearTickmarksNode* >( tNode->firstChild() );
|
auto* const lNode = static_cast< LinearTickmarksNode* >( tNode->firstChild() );
|
||||||
|
@ -336,7 +336,7 @@ QSGNode* QskLevelingSensorSkinlet::updateSubNode< R::TickmarksXLabels >(
|
||||||
const auto translation = state.translation().toVector2D() + QVector2D{0, r3};
|
const auto translation = state.translation().toVector2D() + QVector2D{0, r3};
|
||||||
|
|
||||||
auto* const cNode =
|
auto* const cNode =
|
||||||
ensureNode< PolygonClipNode, QSGTransformNode, LinearTickmarksLabelsNode >( node );
|
ensureNode< RadialClipNode, QSGTransformNode, LinearTickmarksLabelsNode >( node );
|
||||||
auto* const tNode = static_cast< QSGTransformNode* >( cNode->firstChild() );
|
auto* const tNode = static_cast< QSGTransformNode* >( cNode->firstChild() );
|
||||||
auto* const lNode = static_cast< LinearTickmarksLabelsNode* >( tNode->firstChild() );
|
auto* const lNode = static_cast< LinearTickmarksLabelsNode* >( tNode->firstChild() );
|
||||||
cNode->setGeometryProperties( state.r1, state.cX, state.cY );
|
cNode->setGeometryProperties( state.r1, state.cX, state.cY );
|
||||||
|
@ -359,7 +359,7 @@ QSGNode* QskLevelingSensorSkinlet::updateSubNode< R::TickmarksYLabels >(
|
||||||
const auto rotation = sensor->subControlRotation( subControl );
|
const auto rotation = sensor->subControlRotation( subControl );
|
||||||
const auto translation = state.translation().toVector2D() + QVector2D( r3, 0 );
|
const auto translation = state.translation().toVector2D() + QVector2D( r3, 0 );
|
||||||
|
|
||||||
auto* const cNode = ensureNode< PolygonClipNode, QSGTransformNode, LinearTickmarksLabelsNode >( node );
|
auto* const cNode = ensureNode< RadialClipNode, QSGTransformNode, LinearTickmarksLabelsNode >( node );
|
||||||
auto* const tNode = static_cast< QSGTransformNode* >( cNode->firstChild() );
|
auto* const tNode = static_cast< QSGTransformNode* >( cNode->firstChild() );
|
||||||
auto* const lNode = static_cast< LinearTickmarksLabelsNode* >( tNode->firstChild() );
|
auto* const lNode = static_cast< LinearTickmarksLabelsNode* >( tNode->firstChild() );
|
||||||
cNode->setGeometryProperties( state.r1, state.cX, state.cY );
|
cNode->setGeometryProperties( state.r1, state.cX, state.cY );
|
||||||
|
@ -391,7 +391,7 @@ QSGNode* QskLevelingSensorSkinlet::updateSubNode< R::HorizonClip >(
|
||||||
const auto cY = center( sensor ).y();
|
const auto cY = center( sensor ).y();
|
||||||
const auto r1 = innerRadius( sensor );
|
const auto r1 = innerRadius( sensor );
|
||||||
|
|
||||||
auto* const clipNode = ensureNode< PolygonClipNode >( node );
|
auto* const clipNode = ensureNode< RadialClipNode >( node );
|
||||||
clipNode->setGeometryProperties( r1, cX, cY );
|
clipNode->setGeometryProperties( r1, cX, cY );
|
||||||
return clipNode;
|
return clipNode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
#include "QskLevelingSensorUtility.h"
|
|
Loading…
Reference in New Issue