surroundPalace method

  1. @override
IFunctionlSurpalaces? surroundPalace(
  1. PalaceName palaceName,
  2. Scope scope
)
override

获取运限指定宫位的三方四正宫位 palaceName 宫位名称 scope 指定获取那个运限的宫位

Implementation

@override
IFunctionlSurpalaces? surroundPalace(PalaceName palaceName, Scope scope) {
  // TODO: implement surroundPalace
  if (scope == Scope.origin) {
    return astrolabe.surroundedPalaces(palaceName);
  }
  var targetPalaceIndex = 0;
  switch (scope) {
    case Scope.origin:
      targetPalaceIndex = 0;
    case Scope.daily:
      targetPalaceIndex = daily.palaceNames.indexOf(palaceName);
    case Scope.decadal:
      targetPalaceIndex = decadal.palaceNames.indexOf(palaceName);
    case Scope.hourly:
      targetPalaceIndex = hourly.palaceNames.indexOf(palaceName);
    case Scope.monthly:
      targetPalaceIndex = monthly.palaceNames.indexOf(palaceName);
    case Scope.yearly:
      targetPalaceIndex = yearly.palaceNames.indexOf(palaceName);
  }
  return astrolabe.surroundedPalaces(targetPalaceIndex);
}