Skip to content

Commit

Permalink
clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
schaumb committed Dec 6, 2024
1 parent cc3bd4e commit 50b3b1a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 23 deletions.
1 change: 1 addition & 0 deletions src/base/alg/union_foreach.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef ALG_UNION_FOREACH_H
#define ALG_UNION_FOREACH_H

#include <functional>
#include <ranges>

#include "union_foreach.h"
Expand Down
25 changes: 12 additions & 13 deletions src/chart/generator/plotbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,24 +335,23 @@ void PlotBuilder::calcAxises(const Data::DataTable &dataTable,

auto mainBoundRect = plot->getMarkersBounds(mainAxis);
auto subBoundRect = plot->getMarkersBounds(!mainAxis);
if (mainAxis != AxisId::x) std::swap(mainBoundRect, subBoundRect);

plot->getOptions()->setAutoRange(!std::signbit(mainBoundRect.min),
!std::signbit(subBoundRect.min));

if (mainAxis != AxisId::x) std::swap(mainBoundRect, subBoundRect);
plot->getOptions()->setAutoRange(
!std::signbit(
(mainAxis == AxisId::x ? mainBoundRect : subBoundRect)
.min),
!std::signbit(
(mainAxis == AxisId::x ? subBoundRect : mainBoundRect)
.min));

mainBoundRect =
plot->getOptions()->getChannels().at(mainAxis).range.getRange(
mainBoundRect);
subBoundRect = plot->getOptions()
->getChannels()
.at(!mainAxis)
.range.getRange(subBoundRect);
plot->getOptions()->mainAxis().range.getRange(mainBoundRect);
subBoundRect =
plot->getOptions()->subAxis().range.getRange(subBoundRect);

for (auto &&[axis, ranges, boundSize] :
{std::tuple{mainAxis, &mainRanges, std::move(mainBoundRect)},
{!mainAxis, &subRanges, std::move(subBoundRect)}}) {
{std::tuple{mainAxis, &mainRanges, mainBoundRect},
{!mainAxis, &subRanges, subBoundRect}}) {
for (auto &marker : plot->markers) {
auto &&markerSize = marker.getSizeBy(axis);
if (!boundSize.positive().intersects(
Expand Down
3 changes: 1 addition & 2 deletions src/chart/options/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ AxisId Options::getHorizontalChannel() const

AxisId Options::getVerticalChannel() const
{
return getHorizontalChannel() == AxisId::x ? AxisId::y
: AxisId::x;
return !getHorizontalChannel();
}

bool Options::isShapeValid(const ShapeType &shapeType) const
Expand Down
16 changes: 8 additions & 8 deletions src/chart/rendering/drawaxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ namespace Vizzu::Draw

void DrawAxes::drawGeometries() const
{
for (auto &xSplit : std::views::values(splits[Gen::AxisId::x]))
for (auto &ySplit :
for (auto &&xSplit : std::views::values(splits[Gen::AxisId::x]))
for (auto &&ySplit :
std::views::values(splits[Gen::AxisId::y])) {
double weight =
auto weight =
Math::FuzzyBool::And(xSplit.weight, ySplit.weight);
if (Math::Floating::is_zero(weight)) continue;

Geom::AffineTransform tr{xSplit.range.size(),
const Geom::AffineTransform tr{xSplit.range.size(),
0.0,
xSplit.range.min,
0.0,
Expand All @@ -70,14 +70,14 @@ void DrawAxes::drawGeometries() const

void DrawAxes::drawLabels() const
{
for (auto &xSplit : std::views::values(splits[Gen::AxisId::x]))
for (auto &ySplit :
for (auto &&xSplit : std::views::values(splits[Gen::AxisId::x]))
for (auto &&ySplit :
std::views::values(splits[Gen::AxisId::y])) {
double weight =
auto weight =
Math::FuzzyBool::And(xSplit.weight, ySplit.weight);
if (Math::Floating::is_zero(weight)) continue;

Geom::AffineTransform tr{xSplit.range.size(),
const Geom::AffineTransform tr{xSplit.range.size(),
0.0,
xSplit.range.min,
0.0,
Expand Down

0 comments on commit 50b3b1a

Please sign in to comment.