withOptions function
获取排盘信息。
@param param0 排盘参数 @returns 星盘信息
Implementation
FunctionalAstrolabe withOptions(Option option) {
if (option.config != null) {
config(option.config!);
}
FunctionalAstrolabe result;
if (option.type == OptionType.solar) {
result = bySolar(
option.dateStr,
option.timeIndex,
option.gender,
option.fixLeap,
);
} else {
result = byLunar(
option.dateStr,
option.timeIndex,
option.gender,
option.isLeapMonth,
option.fixLeap,
);
}
if (option.astroType != null) {
switch (option.astroType) {
case AstroType.earth:
final bodyPalace = result.palace(PalaceName.bodyPalace);
return rearrangeAstrolabe(
ZhongZhouHeavenEarth(
heavenlyStem: bodyPalace!.heavenlySten,
earthlyBranch: bodyPalace.earthlyBranch,
),
result,
option,
);
case AstroType.human:
final bodyPalace = result.palace(PalaceName.spiritPalace);
return rearrangeAstrolabe(
ZhongZhouHeavenEarth(
heavenlyStem: bodyPalace!.heavenlySten,
earthlyBranch: bodyPalace.earthlyBranch,
),
result,
option,
);
default:
return result;
}
}
return result;
}