Skip to content

Commit e2a8a3a

Browse files
committed
Rename options to it's names, add default ConfigAccessor
1 parent 97c7391 commit e2a8a3a

File tree

18 files changed

+148
-179
lines changed

18 files changed

+148
-179
lines changed

src/chart/animator/animation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ void Animation::addKeyframe(const Gen::PlotPtr &next,
8383
!target->getOptions()->getChannels().anyAxisSet()
8484
&& next->getOptions()->getChannels().anyAxisSet();
8585

86-
auto geometryChanges = target->getOptions()->shapeType
87-
!= next->getOptions()->shapeType;
86+
auto geometryChanges = target->getOptions()->geometry
87+
!= next->getOptions()->geometry;
8888

8989
auto basedOnSource =
9090
loosingCoordsys || (!gainingCoordsys && geometryChanges);

src/chart/animator/morph.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ void Shape::transform(const Gen::Options &source,
9999
Gen::Options &actual,
100100
double factor) const
101101
{
102-
actual.shapeType = interpolate(source.shapeType,
103-
target.shapeType,
102+
actual.geometry = interpolate(source.geometry,
103+
target.geometry,
104104
factor);
105105
}
106106

@@ -148,9 +148,9 @@ void Connection::transform(const Gen::Options &source,
148148
double factor) const
149149
{
150150
auto sourceIsConnecting =
151-
Vizzu::Gen::isConnecting(source.shapeType.get());
151+
Vizzu::Gen::isConnecting(source.geometry.get());
152152
auto targetIsConnecting =
153-
Vizzu::Gen::isConnecting(target.shapeType.get());
153+
Vizzu::Gen::isConnecting(target.geometry.get());
154154

155155
if (sourceIsConnecting && !targetIsConnecting) {
156156
actual.horizontal = source.horizontal;

src/chart/animator/planner.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ void Planner::createPlan(const Gen::Plot &source,
101101
addMorph(SectionId::coordSystem, std::max(step, posDuration));
102102

103103
const auto &geomEasing =
104-
srcOpt->shapeType == Gen::ShapeType::circle ? in3
105-
: trgOpt->shapeType == Gen::ShapeType::circle ? out3
106-
: srcOpt->shapeType == Gen::ShapeType::line ? in3
107-
: trgOpt->shapeType == Gen::ShapeType::line ? out3
108-
: inOut5;
104+
srcOpt->geometry == Gen::ShapeType::circle ? in3
105+
: trgOpt->geometry == Gen::ShapeType::circle ? out3
106+
: srcOpt->geometry == Gen::ShapeType::line ? in3
107+
: trgOpt->geometry == Gen::ShapeType::line ? out3
108+
: inOut5;
109109

110110
addMorph(SectionId::geometry,
111111
std::max(step, posDuration),
@@ -249,7 +249,7 @@ void Planner::calcNeeded()
249249
|| srcOpt->angle != trgOpt->angle;
250250

251251
animNeeded[SectionId::geometry] =
252-
srcOpt->shapeType != trgOpt->shapeType;
252+
srcOpt->geometry != trgOpt->geometry;
253253

254254
animNeeded[SectionId::y] = needVertical();
255255
animNeeded[SectionId::x] = needHorizontal();
@@ -282,8 +282,8 @@ bool Planner::positionMorphNeeded() const
282282
{
283283
typedef Gen::ShapeType ST;
284284

285-
auto &srcShape = source->getOptions()->shapeType;
286-
auto &trgShape = target->getOptions()->shapeType;
285+
auto &srcShape = source->getOptions()->geometry;
286+
auto &trgShape = target->getOptions()->geometry;
287287

288288
auto anyCircle = srcShape == ST::circle || trgShape == ST::circle;
289289

src/chart/generator/guides.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ bool GuidesByAxis::operator==(const GuidesByAxis &other) const
3131
void Guides::init(const Axises &axises, const Options &options)
3232
{
3333
auto isCircle =
34-
options.shapeType.get() == ShapeType::circle;
35-
auto isLine = options.shapeType.get() == ShapeType::line;
34+
options.geometry.get() == ShapeType::circle;
35+
auto isLine = options.geometry.get() == ShapeType::line;
3636
auto isHorizontal = static_cast<bool>(options.horizontal);
3737
auto yIsMeasure = static_cast<bool>(
3838
axises.at(ChannelId::y).enabled.calculate<Math::FuzzyBool>());
@@ -79,7 +79,7 @@ void Guides::init(const Axises &axises, const Options &options)
7979

8080
auto stretchedPolar =
8181
isPolar && !yIsMeasure
82-
&& (options.alignType == Base::Align::Type::stretch);
82+
&& (options.align == Base::Align::Type::stretch);
8383

8484
y.labels = yOpt.axisLabels.getValue(
8585
!stretchedPolar

src/chart/generator/marker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Marker::Marker(const Options &options,
6767

6868
mainId = Id(data, options.mainAxis().dimensionIds, index);
6969

70-
auto stackInhibitingShape = options.shapeType == ShapeType::area;
70+
auto stackInhibitingShape = options.geometry == ShapeType::area;
7171
if (stackInhibitingShape) {
7272
Data::SeriesList subIds(options.subAxis().dimensionIds);
7373
subIds.remove(options.mainAxis().dimensionIds);

src/chart/generator/plot.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Plot::Plot(const Data::DataTable &dataTable,
113113
if (gotSpecLayout) {
114114
calcDimensionAxises(dataTable);
115115
normalizeColors();
116-
if (options->shapeType != ShapeType::circle)
116+
if (options->geometry != ShapeType::circle)
117117
normalizeSizes();
118118
calcAxises(dataTable);
119119
}
@@ -315,7 +315,7 @@ Axis Plot::calcAxis(ChannelId type, const Data::DataTable &dataTable)
315315
: scale.title;
316316

317317
if (type == options->subAxisType()
318-
&& options->alignType == Base::Align::Type::stretch) {
318+
&& options->align == Base::Align::Type::stretch) {
319319
return {Math::Range<double>(0, 100),
320320
title,
321321
"%",
@@ -397,12 +397,12 @@ void Plot::calcDimensionAxis(ChannelId type,
397397

398398
void Plot::addAlignment()
399399
{
400-
if (static_cast<bool>(options->splitted)) return;
400+
if (static_cast<bool>(options->split)) return;
401401

402402
auto &axis = axises.at(options->subAxisType());
403403
if (axis.range.getMin() < 0) return;
404404

405-
if (options->alignType == Base::Align::Type::none) return;
405+
if (options->align == Base::Align::Type::none) return;
406406

407407
for (auto &bucketIt : subBuckets) {
408408
Math::Range<double> range;
@@ -414,7 +414,7 @@ void Plot::addAlignment()
414414
range.include(size);
415415
}
416416

417-
Base::Align aligner(options->alignType,
417+
Base::Align aligner(options->align,
418418
Math::Range(0.0, 1.0));
419419
auto transform = aligner.getAligned(range) / range;
420420

@@ -431,10 +431,10 @@ void Plot::addAlignment()
431431

432432
void Plot::addSeparation()
433433
{
434-
if (static_cast<bool>(options->splitted)) {
435-
auto align = options->alignType == Base::Align::Type::none
434+
if (static_cast<bool>(options->split)) {
435+
auto align = options->align == Base::Align::Type::none
436436
? Base::Align::Type::min
437-
: options->alignType;
437+
: options->align;
438438

439439
std::vector<Math::Range<double>> ranges(mainBuckets.size(),
440440
Math::Range(0.0, 0.0));
@@ -481,8 +481,8 @@ void Plot::addSeparation()
481481

482482
void Plot::normalizeSizes()
483483
{
484-
if (options->shapeType == ShapeType::circle
485-
|| options->shapeType == ShapeType::line) {
484+
if (options->geometry == ShapeType::circle
485+
|| options->geometry == ShapeType::line) {
486486
Math::Range<double> size;
487487

488488
for (auto &marker : markers)

src/chart/main/stylesheet.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void Sheet::setMarkers()
110110
}
111111

112112
if (options->getChannels().anyAxisSet()
113-
&& options->shapeType == Gen::ShapeType::circle
113+
&& options->geometry == Gen::ShapeType::circle
114114
&& !options->getChannels()
115115
.at(Gen::ChannelId::size)
116116
.isDimension()
@@ -121,8 +121,7 @@ void Sheet::setMarkers()
121121
}
122122

123123
if (options->getChannels().anyAxisSet()
124-
&& options->shapeType
125-
== Gen::ShapeType::rectangle
124+
&& options->geometry == Gen::ShapeType::rectangle
126125
&& static_cast<bool>(options->polar)
127126
&& options->getVeritalAxis().isEmpty()) {
128127
defaultParams.plot.marker.rectangleSpacing = 0;
@@ -134,22 +133,18 @@ void Sheet::setMarkerLabels()
134133
auto &def = defaultParams.plot.marker.label;
135134

136135
if (options->getChannels().anyAxisSet()
137-
&& (!(options->shapeType
138-
== Gen::ShapeType::rectangle)
136+
&& (!(options->geometry == Gen::ShapeType::rectangle)
139137
|| options->subAxis().dimensionCount() == 0)) {
140-
if (options->shapeType
141-
== Gen::ShapeType::circle) {
138+
if (options->geometry == Gen::ShapeType::circle) {
142139
def.position = MarkerLabel::Position::right;
143140
}
144141
else {
145142
def.position = options->horizontal
146143
? MarkerLabel::Position::top
147144
: MarkerLabel::Position::right;
148145

149-
if (options->shapeType
150-
== Gen::ShapeType::area
151-
|| options->shapeType
152-
== Gen::ShapeType::line) {
146+
if (options->geometry == Gen::ShapeType::area
147+
|| options->geometry == Gen::ShapeType::line) {
153148
def.paddingBottom = Gfx::Length::Emphemeral(8 / 11.0);
154149
def.paddingLeft = Gfx::Length::Emphemeral(8 / 11.0);
155150
def.paddingTop = Gfx::Length::Emphemeral(8 / 11.0);

src/chart/options/advancedoptions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void OrientationSelector::fixHorizontal()
4545
std::optional<bool> OrientationSelector::horizontalOverride() const
4646
{
4747
if (options.getChannels().anyAxisSet()
48-
&& options.shapeType != ShapeType::circle) {
48+
&& options.geometry != ShapeType::circle) {
4949
auto &x = options.getChannels().at(ChannelId::x);
5050
auto &y = options.getChannels().at(ChannelId::y);
5151

0 commit comments

Comments
 (0)