tracer/src/Types/Interior.hs
2018-07-31 13:30:17 +02:00

194 lines
5.5 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
| ClusterPlant1
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 ImgTable1]]
clusterMat ClusterTable2 =
M.fromLists
[ [Just ImgTable2]
, [Just ImgEmpty]
]
clusterMat ClusterTable3 =
M.fromLists
[[Just ImgTable3, Just ImgEmpty]]
clusterMat ClusterTable4 =
M.fromLists
[ [Just ImgEmpty]
, [Just ImgTable4]
]
clusterMat ClusterCornerTable =
M.fromLists
[ [Just ImgTable2, Just ImgTableCorner]
, [Just ImgEmpty, Just ImgTable1]
]
clusterMat ClusterTableGroup =
M.fromLists
[ [ Just ImgEmpty, Just ImgTable2, Just ImgTableCorner
, Just ImgEmpty, Just ImgTable2, Just ImgTableCorner
]
, [ Just ImgEmpty, Just ImgEmpty, Just ImgTable1
, Just ImgEmpty, Just ImgEmpty, Just ImgTable1
]
, [ Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
]
, [ Nothing, Nothing, Nothing
, Just ImgEmpty, Just ImgTable2, Just ImgTableCorner
]
, [ Nothing, Nothing, Nothing
, Just ImgEmpty, Just ImgEmpty, Just ImgTable1
]
]
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 ImgTableC4, Just ImgTable4, Just ImgTable4
, Just ImgTable4, Just ImgTable4, Just ImgTableC3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgTable1, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgTable3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgTable1, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgTable3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgTableC1, Just ImgTable2, Just ImgTable2
, Just ImgTable2, Just ImgTable2, Just ImgTableC2, 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 ImgTableC4, Just ImgTable4
, Just ImgTable4, Just ImgTableC3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgTable1, Just ImgEmpty
, Just ImgEmpty, Just ImgTable3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgTableC1, Just ImgTable2
, Just ImgTable2, Just ImgTableC2, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
]
]
clusterMat ClusterPlant1 =
M.fromLists
[ [ Just ImgMiscPlant1 ] ]
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]
clusterRoom ClusterPlant1 = [Offi, Hall]
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
]
clusterPoints _ = []
instance Size Cluster where
size c =
let mat = clusterMat c
in fromIntegral ((nrows mat) * (ncols mat))