Skip to content

Add circular coordinate system display - #333

Open
rick-vogel wants to merge 42 commits into
uwerat:masterfrom
rick-vogel:levelingsensor
Open

Add circular coordinate system display#333
rick-vogel wants to merge 42 commits into
uwerat:masterfrom
rick-vogel:levelingsensor

Conversation

@rick-vogel

@rick-vogel rick-vogel commented Jul 20, 2023

Copy link
Copy Markdown
Collaborator

image

  • provide fine granularity for rotating individual layers

Comment thread src/controls/LevelingSensor/QskLevelingSensor.h Outdated
Comment thread src/controls/LevelingSensor/QskLevelingSensor.h Outdated
Comment thread src/controls/LevelingSensor/QskLevelingSensor.h Outdated
Comment thread src/controls/LevelingSensor/QskLevelingSensor.cpp Outdated
return matrix_deg( 0, 0, rZ, cX, cY );
}
};

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

State is just a helper class for reoccuring calculations

gradient.setLinearDirection( Qt::Vertical );
gradient.setStops( { { 0.0, gradient.startColor() }, { pY, gradient.startColor() },
{ pY, gradient.endColor() }, { 1.0, gradient.endColor() } } );

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating a gradient with stops at 0%, 50%, 50% and 100% to achieve hard line

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When not having a stop at 0.0 the renderer takes the color of the first step and fills from 0.0 to the first position. Similar, when you do not have a stop at 1.0. So in this particular case it would be enough to have the 2 stops at pY.

auto* const transform = static_cast< QSGTransformNode* >( clipping->firstChild() );
auto* const tickmarks = static_cast< LinearTickmarksNode* >( transform->firstChild() );

auto size = qvariant_cast< QVector3D >( sensor->effectiveSkinHint( subControl ) ) * r3;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uwerat this is somewhat hacky to allow styling of tickmarks heights/width for major, medium and minor ticks

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My fist idea would be to use QskAspect::Variation, where you have Tiny/Small/Large/Huge. However this would block using other variations like Vertical/Horizontal. So maybe it is not a bad idea to introduce a class for a tuple of increasing sizes - in the best case something that works for other situations as well.

Of course QVector3D works out of the box, but the QVectorXD classes are float ( not qreal ) based and have primarily been made for OpenGL APIs.

@peter-ha peter-ha left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just voicing my thoughts; Uwe might have a different idea on how this should be structured, or whether this should be a Qsk* class now etc.

Comment thread playground/levelingsensor/Dashboard.cpp Outdated
Comment thread src/controls/LevelingSensor/QskLevelingSensor.h Outdated
Comment thread src/controls/LevelingSensor/QskLevelingSensor.h Outdated
Comment thread src/controls/LevelingSensor/QskLevelingSensor.cpp Outdated
Comment thread src/controls/LevelingSensor/QskLevelingSensor.h
Comment thread src/controls/LevelingSensor/QskLevelingSensorNodes.h Outdated
QskHashValue m_tickmarksHash{ 0 };
};

class LinearTickmarksNode final : public QSGGeometryNode

@peter-ha peter-ha Jul 25, 2023

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use QskTickmarksNode here? Or is there something missing? I guess in the long run it would be good to have one global tickmarks node class that covers all use cases...

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that there are some pending changes around the axes/scales in this branch: https://github.com/uwerat/qskinny/tree/features/plots I did not merge them to master, because I'm not 100% happy with everything ( f.e aligning the lines to avoid the unwanted OpenGL antialiasing of vertical/horizontal lines ).

There is another branch https://github.com/uwerat/qskinny/tree/features/geometrynode, where I'm trying to introduce a QskGeometryNode to simplify the implementation of geometry nodes in combination with QSGFlatColorMaterial/QSGVertexColorMaterial.

I was distracted by the ongoing changes because of the Fluent2 skin - however it might be worth to check if there is something of value for your work in these branches.

int m_count = 360;
};

template<typename CRTP>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does CRTP mean? Doesn't sound easy to understand...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const QskLevelingSensor* const sensor, const QRectF& contentsRect ) const = delete;

template<>
Q_REQUIRED_RESULT QRectF QskLevelingSensorSkinlet::subControlRect< R::OuterDisk >(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this template specialization is needed here

@rick-vogel rick-vogel Jul 25, 2023

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed, but subjectively nice to look at ;) + you don't need a function declaration for each role...

@rick-vogel
rick-vogel requested review from peter-ha and uwerat July 25, 2023 13:03
Sequential,
Recursive
};

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uwerat This function is a candidate for public API and could be moved to QskSGNode.h next to ensureNode

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't its be clearer to have one template for creating siblings and another for creating a hierarchy:

  • QskSGNode::ensureSiblings
  • QskSgNode::ensureHierarchy ( maybe there is a better name ? )

Comment thread src/controls/QskLevelingSensor.h
Comment thread src/controls/private/QskLevelingSensor.cpp Outdated
@peter-ha

peter-ha commented Aug 8, 2023

Copy link
Copy Markdown
Collaborator

Not trying to bring pressure or so, but @uwerat do you know whether this will be a Qsk* class, or rather a class in an example or so? We are wondering how we should use/name this internally...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants