Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich2 committed Jan 7, 2023
1 parent 6152bac commit 47d7269
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
7 changes: 3 additions & 4 deletions Dev/srcGrand/dless/DLessGui.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ case class DLessGui(canv: CanvasPlatform, scenIn: DLessScen, viewIn: HGView, isF

def polyFills: RArr[PolygonFill] = terrs.projRowsCombinePolygons.map { pp => pp.a1.fill(pp.a2.colour) }
def actives: RArr[PolygonActive] = proj.tileActives
def sides1: GraphicElems = sTerrs.projTruesLineSegMap{ls => Rectangle.fromAxisRatio(ls, 0.3).fill(Colour.DarkBlue) }
def lines: RArr[LineSegDraw] = terrs.projLinksLineOptMap{ (ls, t1, t2 ) => ife(t1 == t2, Some(ls.draw(t1.contrastBW)), None) }
def straits: GraphicElems = sTerrs.projTruesLineSegMap{ls => Rectangle.fromAxisRatio(ls, 0.3).fill(Colour.DarkBlue) }

def lines2: RArr[LineSegDraw] = sTerrs.projFalseLinksScLineSegOptMap(proj){ (hs, ls) =>
def lines: RArr[LineSegDraw] = sTerrs.projFalseLinksHsLineSegOptMap{ (hs, ls) =>
val t1 = terrs(hs.tile1Reg)
val t2 = terrs(hs.tile2Reg)
ife( t1 == t2, Some(ls.draw(t1.contrastBW)), None)
Expand Down Expand Up @@ -52,7 +51,7 @@ case class DLessGui(canv: CanvasPlatform, scenIn: DLessScen, viewIn: HGView, isF
def thisTop(): Unit = reTop(bTurn %: proj.buttons)

thisTop()
override def frame: GraphicElems = polyFills ++ actives ++ sides1 ++ lines2 ++ hexStrs
override def frame: GraphicElems = polyFills ++ actives ++ straits ++ lines ++ hexStrs

proj.getFrame = () => frame
proj.setStatusText = { str =>
Expand Down
2 changes: 1 addition & 1 deletion Dev/srcGrand/p305/Bc305Gui.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ case class Bc305Gui(canv: CanvasPlatform, scenIn: BcScen, viewIn: HGView, isFlat
def sides1: GraphicElems = sTerrs.projTruesLineSegMap{ls => Rectangle.fromAxisRatio(ls, 0.3).fill(Colour.DarkBlue) }
def lines: RArr[LineSegDraw] = terrs.projLinksLineOptMap{ (ls, t1, t2 ) => ife(t1 == t2, Some(ls.draw(t1.contrastBW)), None) }

def lines2: RArr[LineSegDraw] = sTerrs.projFalseLinksScLineSegOptMap(proj){ (hs, ls) =>
def lines2: RArr[LineSegDraw] = sTerrs.projFalseLinksHsLineSegOptMap(proj){ (hs, ls) =>
val t1 = terrs(hs.tile1Reg)
val t2 = terrs(hs.tile2Reg)
ife( t1 == t2, Some(ls.draw(t1.contrastBW)), None)
Expand Down
2 changes: 1 addition & 1 deletion Dev/srcGrand/pnap/NapGui.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ case class NapGui(canv: CanvasPlatform, scenIn: NapScen, viewIn: HGView, isFlat:
def sides1: GraphicElems = sTerrs.projTruesLineSegMap{ls => Rectangle.fromAxisRatio(ls, 0.3).fill(Colour.DarkBlue) }
def lines: RArr[LineSegDraw] = terrs.projLinksLineOptMap{ (ls, t1, t2 ) => ife(t1 == t2, Some(ls.draw(t1.contrastBW)), None) }

def lines2: RArr[LineSegDraw] = sTerrs.projFalseLinksScLineSegOptMap(proj){ (hs, ls) =>
def lines2: RArr[LineSegDraw] = sTerrs.projFalseLinksHsLineSegOptMap(proj){ (hs, ls) =>
val t1 = terrs(hs.tile1Reg)
val t2 = terrs(hs.tile2Reg)
ife( t1 == t2, Some(ls.draw(t1.contrastBW)), None)
Expand Down
2 changes: 1 addition & 1 deletion Dev/srcGrand/pww1/WW1Gui.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ case class WW1Gui(canv: CanvasPlatform, scenIn: WW1Scen, viewIn: HGView, isFlat:
def sides1: GraphicElems = sTerrs.projTruesLineSegMap{ls => Rectangle.fromAxisRatio(ls, 0.3).fill(Colour.DarkBlue) }
def lines: RArr[LineSegDraw] = terrs.projLinksLineOptMap{ (ls, t1, t2 ) => ife(t1 == t2, Some(ls.draw(t1.contrastBW)), None) }

def lines2: RArr[LineSegDraw] = sTerrs.projFalseLinksScLineSegOptMap(proj){ (hs, ls) =>
def lines2: RArr[LineSegDraw] = sTerrs.projFalseLinksHsLineSegOptMap(proj){ (hs, ls) =>
val t1 = terrs(hs.tile1Reg)
val t2 = terrs(hs.tile2Reg)
ife( t1 == t2, Some(ls.draw(t1.contrastBW)), None)
Expand Down
7 changes: 6 additions & 1 deletion Tiling/src/egrid/GridWorldGui.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class GridWorldGui(val canv: CanvasPlatform, scenIn: EScenBasic, viewIn: HGView,

val terrs: HCenLayer[WTile] = scen.terrs
val sTerrs: HSideBoolLayer = scen.sTerrs
//sTerrs.truesHsForeach(println)

val g0Str: String = gridSys match
{ case hgm: HGridMulti => s"grid0: ${hgm.grids(0).numSides}"
case _ => "Single grid"
Expand Down Expand Up @@ -49,6 +49,11 @@ class GridWorldGui(val canv: CanvasPlatform, scenIn: EScenBasic, viewIn: HGView,
def tiles = gridSys.optMap{ hc => proj.transTile(hc).map(poly => poly.fill(terrs(hc).colour)) }
def sides1: GraphicElems = sTerrs.projTruesLineSegMap{ls => Rectangle.fromAxisRatio(ls, 0.3).fill(Colour.DarkBlue) }

def lines: RArr[LineSegDraw] = sTerrs.projFalseLinksHsLineSegOptMap { (hs, ls) =>
val t1 = terrs(hs.tile1Reg)
val t2 = terrs(hs.tile2Reg)
ife(t1 == t2, Some(ls.draw(t1.contrastBW)), None)
}
def linkLines1 = sTerrs.projFalsesLineSegMap{ls => ls.draw(White) }
def linkLines2 = ifGScale(5, linkLines1)
def linkLines3: RArr[LineSegDraw] = terrs.projLinksHsLineOptMap((hs, line, t1, t2) => ife(t1 == t2 & !sTerrs(hs), Some(line.draw(t1.contrastBW)), None))
Expand Down
9 changes: 7 additions & 2 deletions Tiling/src/prid/phex/HSideBoolLayer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ final class HSideBoolLayer(val unsafeArray: Array[Boolean]) extends AnyVal with
else None
}

def projFalsesScLineSegOptMap[B, ArrB <: Arr[B]](proj: HSysProjection)(f: (HSide, LineSeg) => Option[B])(implicit build: ArrMapBuilder[B, ArrB]): ArrB =
def projFalsesHsLineSegOptMap[B, ArrB <: Arr[B]](proj: HSysProjection)(f: (HSide, LineSeg) => Option[B])(implicit build: ArrMapBuilder[B, ArrB]): ArrB =
{ val buff = build.newBuff()
proj.gChild.sidesForeach { hs =>
if (!apply(hs)(proj.parent))
Expand All @@ -80,7 +80,12 @@ final class HSideBoolLayer(val unsafeArray: Array[Boolean]) extends AnyVal with
build.buffToSeqLike(buff)
}

def projFalseLinksScLineSegOptMap[B, ArrB <: Arr[B]](proj: HSysProjection)(f: (HSide, LineSeg) => Option[B])(implicit build: ArrMapBuilder[B, ArrB]): ArrB = {
/** Projection OptMaps over the [[HSide]] and [[LineSeg]] of eahc false [[HSide]] link. */
def projFalseLinksHsLineSegOptMap[B, ArrB <: Arr[B]](f: (HSide, LineSeg) => Option[B])(
implicit proj: HSysProjection, build: ArrMapBuilder[B, ArrB]): ArrB = projFalseLinksHsLineSegOptMap(proj)(f)(build)

/** Projection OptMaps over the [[HSide]] and [[LineSeg]] of eahc false [[HSide]] link. */
def projFalseLinksHsLineSegOptMap[B, ArrB <: Arr[B]](proj: HSysProjection)(f: (HSide, LineSeg) => Option[B])(implicit build: ArrMapBuilder[B, ArrB]): ArrB = {
val buff = build.newBuff()
proj.gChild.linksForeach { hs =>
if (!apply(hs)(proj.parent))
Expand Down

0 comments on commit 47d7269

Please sign in to comment.