Skip to content

Commit

Permalink
#194 More HCenLayer.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich2 committed Oct 6, 2022
1 parent f1650b4 commit f0d8a82
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions Tiling/ExsSrc/gFour/GFourGui.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ case class GFourGui(canv: CanvasPlatform, scenStart: FourScen) extends HGridSysG
implicit val proj: HSysProjection = gridSys.projection(mainPanel)
//proj.setView(viewIn)
val lines: Arr[LineSegDraw] = terrs.sideFlatMap((hs, _) => Arr(hs.draw()), (hs, t1, t2 ) => ife(t1 == t2, Arr(hs.draw(t1.contrastBW)), Arr()))
//terrs.innerSidesFlatMap{(hs, t1, t2 ) => ife(t1 == t2, Arr(hs.draw(t1.contrastBW)), Arr[LineSegDraw]()) }

val rows: Arr[HCenRowValue[Terr]] = terrs.rowsCombine
debvar(rows.length)
Expand Down
16 changes: 14 additions & 2 deletions Tiling/src/prid/phex/HCenLayer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ class HCenLayer[A <: AnyRef](val unsafeArray: Array[A]) extends AnyVal with TCen
/** Maps the sides to an immutable Array, using the data of this HCenArr. It takes two functions, one for the edges of the grid, that takes the
* [[HSide]] and the single adjacent hex tile data value and one for the inner sides of the grid that takes the [[HSide]] and the two adjacent hex
* tile data values. */
def innerSidesMap[B, BB <: SeqImut[B]](f1: (HSide, A) => B, f2: (HSide, A, A) => B)(implicit grid: HGridSys, build: ArrBuilder[B, BB]): BB =
def innerSidesMap[B, BB <: SeqImut[B]](f: (HSide, A, A) => B)(implicit grid: HGridSys, build: ArrBuilder[B, BB]): BB =
grid.innerSidesMap{ hs => hs.tiles match
{ case (c1, c2) => f2(hs, apply(c1), apply(c2))
{ case (c1, c2) => f(hs, apply(c1), apply(c2))
}
}

Expand All @@ -130,6 +130,18 @@ class HCenLayer[A <: AnyRef](val unsafeArray: Array[A]) extends AnyVal with TCen
}
}

/** Maps the sides to an immutable Array, using the data of this HCenArr. It takes two functions, one for the edges of the grid, that takes the
* [[HSide]] and the single adjacent hex tile data value and one for the inner sides of the grid that takes the [[HSide]] and the two adjacent hex
* tile data values. */
def innerSidesFlatMap[BB <: SeqImut[_]](f2: (HSide, A, A) => BB)(implicit grid: HGridSys, build: ArrFlatBuilder[BB]): BB =
grid.sidesFlatMap { hs =>
hs.tiles match {
case (c1, c2) => f2(hs, apply(c1), apply(c2))
//case (c1, _) if grid.hCenExists(c1) => f1(hs, apply(c1))
//case (_, c2) => f1(hs, apply(c2))
}
}

/** Maps the sides to an immutable Array, using the data of this HCenArr. It takes two functions, one for the edges of the grid, that takes the
* [[HSide]] and the single adjacent hex tile data value and one for the inner sides of the grid that takes the [[HSide]] and the two adjacent hex
* tile data values. */
Expand Down

0 comments on commit f0d8a82

Please sign in to comment.