tracer/src/Types/Interior.hs
2018-07-30 21:10:42 +02:00

188 lines
5.4 KiB
Haskell

module Types.Interior where
import Data.Matrix as M
import Linear.V2
-- internal imports
import Types.Map
import Types.ReachPoint
import Types.ImgId
import Types.Direction
data Cluster
= ClusterBox1
| ClusterTable1
| ClusterTable2
| ClusterTable3
| ClusterTable4
| ClusterCornerTable
| ClusterTableGroup
| ClusterCopier
| ClusterFlipchart
| ClusterConferenceTable1
| ClusterConferenceTable2
deriving (Enum, Bounded)
clusterMat :: Cluster -> Matrix (Maybe ImgId)
clusterMat ClusterBox1 =
M.fromLists
-- [ [ Nothing]
[ [Just ImgMiscBox1]
-- , [Nothing, Nothing, Nothing]
]
clusterMat ClusterTable1 =
M.fromLists
[[Just ImgEmpty, Just ImgMiscTable1]]
clusterMat ClusterTable2 =
M.fromLists
[ [Just ImgMiscTable2]
, [Just ImgEmpty]
]
clusterMat ClusterTable3 =
M.fromLists
[[Just ImgMiscTable3, Just ImgEmpty]]
clusterMat ClusterTable4 =
M.fromLists
[ [Just ImgEmpty]
, [Just ImgMiscTable4]
]
clusterMat ClusterCornerTable =
M.fromLists
[ [Just ImgMiscTable2, Just ImgMiscTableCorner]
, [Just ImgEmpty, Just ImgMiscTable1]
]
clusterMat ClusterTableGroup =
M.fromLists
[ [ Just ImgEmpty, Just ImgMiscTable2, Just ImgMiscTableCorner
, Just ImgEmpty, Just ImgMiscTable2, Just ImgMiscTableCorner
]
, [ Just ImgEmpty, Just ImgEmpty, Just ImgMiscTable1
, Just ImgEmpty, Just ImgEmpty, Just ImgMiscTable1
]
, [ Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
]
, [ Nothing, Nothing, Nothing
, Just ImgEmpty, Just ImgMiscTable2, Just ImgMiscTableCorner
]
, [ Nothing, Nothing, Nothing
, Just ImgEmpty, Just ImgEmpty, Just ImgMiscTable1
]
]
clusterMat ClusterCopier =
M.fromLists
[ [ Just ImgEmptyNoWalk]
, [ Just ImgEmpty]
]
clusterMat ClusterFlipchart =
M.fromLists
[ [ Just ImgMiscFlipchart]
, [ Just ImgEmpty]
]
clusterMat ClusterConferenceTable1 =
M.fromLists
[ [ Just ImgEmpty, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTableC4, Just ImgMiscTable4, Just ImgMiscTable4
, Just ImgMiscTable4, Just ImgMiscTable4, Just ImgMiscTableC3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTable1, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgMiscTable3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTable1, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgMiscTable3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTableC1, Just ImgMiscTable2, Just ImgMiscTable2
, Just ImgMiscTable2, Just ImgMiscTable2, Just ImgMiscTableC2, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
]
]
clusterMat ClusterConferenceTable2 =
M.fromLists
[ [ Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTableC4, Just ImgMiscTable4
, Just ImgMiscTable4, Just ImgMiscTableC3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTable1, Just ImgEmpty
, Just ImgEmpty, Just ImgMiscTable3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTableC1, Just ImgMiscTable2
, Just ImgMiscTable2, Just ImgMiscTableC2, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
]
]
clusterRoom :: Cluster -> TileState
clusterRoom ClusterBox1 = Offi
clusterRoom ClusterTable1 = Offi
clusterRoom ClusterTable2 = Offi
clusterRoom ClusterTable3 = Offi
clusterRoom ClusterTable4 = Offi
clusterRoom ClusterCornerTable = Offi
clusterRoom ClusterTableGroup = Offi
clusterRoom ClusterCopier = Offi
clusterRoom ClusterFlipchart = Offi
clusterRoom ClusterConferenceTable1 = Offi
clusterRoom ClusterConferenceTable2 = Offi
clusterPoints :: Cluster -> [ReachPoint]
clusterPoints ClusterBox1 = []
clusterPoints ClusterTable1 =
[ ReachPoint Table (V2 1 1) NE]
clusterPoints ClusterTable2 =
[ ReachPoint Table (V2 2 1) NW]
clusterPoints ClusterTable3 =
[ ReachPoint Table (V2 1 2) SW]
clusterPoints ClusterTable4 =
[ ReachPoint Table (V2 1 1) SE]
clusterPoints ClusterCornerTable =
[ ReachPoint Computer (V2 2 1) N
]
clusterPoints ClusterTableGroup =
[ ReachPoint Computer (V2 2 2) N
, ReachPoint Computer (V2 2 5) N
, ReachPoint Computer (V2 5 5) N
]
clusterPoints ClusterCopier =
[ ReachPoint Copier (V2 2 1) NW
]
clusterPoints ClusterFlipchart =
[ ReachPoint Table (V2 2 1) NW
]
clusterPoints ClusterConferenceTable1 =
[ ReachPoint Table (V2 1 3) SE
, ReachPoint Table (V2 1 4) SE
, ReachPoint Table (V2 1 5) SE
, ReachPoint Table (V2 1 6) SE
, ReachPoint Table (V2 3 1) NE
, ReachPoint Table (V2 3 8) SW
, ReachPoint Table (V2 4 1) NE
, ReachPoint Table (V2 4 8) SW
, ReachPoint Table (V2 6 3) NW
, ReachPoint Table (V2 6 4) NW
, ReachPoint Table (V2 6 5) NW
, ReachPoint Table (V2 6 6) NW
]
clusterPoints ClusterConferenceTable2 =
[ ReachPoint Table (V2 1 3) SE
, ReachPoint Table (V2 1 4) SE
, ReachPoint Table (V2 3 1) NE
, ReachPoint Table (V2 3 6) SW
, ReachPoint Table (V2 5 3) NW
, ReachPoint Table (V2 5 4) NW
]
instance Size Cluster where
size c =
let mat = clusterMat c
in fromIntegral ((nrows mat) * (ncols mat))