MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / populateFixedLayoutGroup

Method populateFixedLayoutGroup

app/src/DataModel/ProjectModel.cpp:4740–4822  ·  view source on GitHub ↗

* @brief Fills a group with the three-axis canonical datasets for sensor-style widgets. */

Source from the content-addressed store, hash-verified

4738 * @brief Fills a group with the three-axis canonical datasets for sensor-style widgets.
4739 */
4740bool DataModel::ProjectModel::populateFixedLayoutGroup(DataModel::Group& grp,
4741 SerialStudio::GroupWidget widget)
4742{
4743 const int baseIndex = nextDatasetIndex();
4744
4745 if (widget == SerialStudio::Accelerometer) {
4746 // code-verify off
4747 ThreeAxisLayout layout{
4748 "accelerometer",
4749 { "x","y", "z" },
4750 { "m/s²", "m/s²", "m/s²"},
4751 {tr("Accelerometer %1").arg("X"),
4752 tr("Accelerometer %1").arg("Y"),
4753 tr("Accelerometer %1").arg("Z") },
4754 { 0, 0, 0},
4755 { 0, 0, 0},
4756 true
4757 };
4758 // code-verify on
4759 populateThreeAxisDatasets(grp, baseIndex, layout);
4760 return true;
4761 }
4762
4763 if (widget == SerialStudio::Gyroscope) {
4764 ThreeAxisLayout layout{
4765 "gyro",
4766 { "x", "y", "z"},
4767 { "deg/s", "deg/s", "deg/s"},
4768 {tr("Gyro %1").arg("X"), tr("Gyro %1").arg("Y"), tr("Gyro %1").arg("Z")},
4769 { 0, 0, 0},
4770 { 0, 0, 0},
4771 true
4772 };
4773 populateThreeAxisDatasets(grp, baseIndex, layout);
4774 return true;
4775 }
4776
4777 if (widget == SerialStudio::GPS) {
4778 // code-verify off
4779 ThreeAxisLayout layout{
4780 "map",
4781 { "lat", "lon", "alt"},
4782 { "°", "°", "m"},
4783 {tr("Latitude"), tr("Longitude"), tr("Altitude")},
4784 { -90.0, -180.0, -500.0},
4785 { 90.0, 180.0, 1000000.0},
4786 false
4787 };
4788 // code-verify on
4789 populateThreeAxisDatasets(grp, baseIndex, layout);
4790 return true;
4791 }
4792
4793 if (widget == SerialStudio::Plot3D) {
4794 ThreeAxisLayout layout{
4795 "plot3d",
4796 { "x", "y", "z"},
4797 { "", "", ""},

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected