tracer/src/Types/Interior.hs

207 lines
5.9 KiB
Haskell
Raw Normal View History

2018-03-03 16:03:17 +00:00
module Types.Interior where
import Data.Matrix as M
import Linear.V2
2018-03-03 16:03:17 +00:00
-- internal imports
import Types.Map
2018-04-14 16:43:05 +00:00
import Types.ReachPoint
import Types.ImgId
import Types.Direction
2018-03-03 16:03:17 +00:00
data Cluster
= ClusterBox1
2018-04-03 20:21:07 +00:00
| ClusterTable1
| ClusterTable2
2018-04-03 20:27:41 +00:00
| ClusterTable3
| ClusterTable4
2018-03-31 21:22:10 +00:00
| ClusterCornerTable
2018-04-01 02:51:15 +00:00
| ClusterTableGroup
2018-07-21 04:43:26 +00:00
| ClusterCopier
2018-07-30 13:34:45 +00:00
| ClusterFlipchart
2018-07-30 19:10:42 +00:00
| ClusterConferenceTable1
| ClusterConferenceTable2
2018-07-31 11:30:17 +00:00
| ClusterPlant1
2018-07-31 20:59:25 +00:00
| ClusterPlant2
| ClusterToilet
2018-03-03 16:03:17 +00:00
deriving (Enum, Bounded)
clusterMat :: Cluster -> Matrix (Maybe ImgId)
clusterMat ClusterBox1 =
M.fromLists
2018-03-05 20:11:38 +00:00
-- [ [ Nothing]
[ [Just ImgMiscBox1]
-- , [Nothing, Nothing, Nothing]
2018-03-03 16:03:17 +00:00
]
2018-04-03 20:21:07 +00:00
clusterMat ClusterTable1 =
M.fromLists
2018-07-31 11:30:17 +00:00
[[Just ImgEmpty, Just ImgTable1]]
2018-04-03 20:21:07 +00:00
clusterMat ClusterTable2 =
M.fromLists
2018-07-31 11:30:17 +00:00
[ [Just ImgTable2]
2018-07-21 18:37:01 +00:00
, [Just ImgEmpty]
2018-04-03 20:21:07 +00:00
]
2018-04-03 20:27:41 +00:00
clusterMat ClusterTable3 =
M.fromLists
2018-07-31 11:30:17 +00:00
[[Just ImgTable3, Just ImgEmpty]]
2018-04-03 20:27:41 +00:00
clusterMat ClusterTable4 =
M.fromLists
2018-07-21 18:37:01 +00:00
[ [Just ImgEmpty]
2018-07-31 11:30:17 +00:00
, [Just ImgTable4]
2018-04-03 20:27:41 +00:00
]
2018-03-31 21:22:10 +00:00
clusterMat ClusterCornerTable =
M.fromLists
2018-07-31 11:30:17 +00:00
[ [Just ImgTable2, Just ImgTableCorner]
, [Just ImgEmpty, Just ImgTable1]
2018-04-01 02:51:15 +00:00
]
clusterMat ClusterTableGroup =
M.fromLists
2018-07-31 11:30:17 +00:00
[ [ Just ImgEmpty, Just ImgTable2, Just ImgTableCorner
, Just ImgEmpty, Just ImgTable2, Just ImgTableCorner
2018-04-01 02:51:15 +00:00
]
2018-07-31 11:30:17 +00:00
, [ Just ImgEmpty, Just ImgEmpty, Just ImgTable1
, Just ImgEmpty, Just ImgEmpty, Just ImgTable1
2018-04-01 02:51:15 +00:00
]
2018-07-21 18:37:01 +00:00
, [ Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
2018-04-01 02:51:15 +00:00
]
, [ Nothing, Nothing, Nothing
2018-07-31 11:30:17 +00:00
, Just ImgEmpty, Just ImgTable2, Just ImgTableCorner
2018-04-01 02:51:15 +00:00
]
, [ Nothing, Nothing, Nothing
2018-07-31 11:30:17 +00:00
, Just ImgEmpty, Just ImgEmpty, Just ImgTable1
2018-04-01 02:51:15 +00:00
]
2018-03-31 21:22:10 +00:00
]
2018-07-21 04:43:26 +00:00
clusterMat ClusterCopier =
M.fromLists
2018-07-21 18:37:01 +00:00
[ [ Just ImgEmptyNoWalk]
, [ Just ImgEmpty]
2018-07-21 04:43:26 +00:00
]
2018-07-30 13:34:45 +00:00
clusterMat ClusterFlipchart =
M.fromLists
[ [ Just ImgMiscFlipchart]
, [ Just ImgEmpty]
]
2018-07-30 19:10:42 +00:00
clusterMat ClusterConferenceTable1 =
M.fromLists
[ [ Just ImgEmpty, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
]
2018-07-31 11:30:17 +00:00
, [ Just ImgEmpty, Just ImgTableC4, Just ImgTable4, Just ImgTable4
, Just ImgTable4, Just ImgTable4, Just ImgTableC3, Just ImgEmpty
2018-07-30 19:10:42 +00:00
]
2018-07-31 11:30:17 +00:00
, [ Just ImgEmpty, Just ImgTable1, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgTable3, Just ImgEmpty
2018-07-30 19:10:42 +00:00
]
2018-07-31 11:30:17 +00:00
, [ Just ImgEmpty, Just ImgTable1, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgTable3, Just ImgEmpty
2018-07-30 19:10:42 +00:00
]
2018-07-31 11:30:17 +00:00
, [ Just ImgEmpty, Just ImgTableC1, Just ImgTable2, Just ImgTable2
, Just ImgTable2, Just ImgTable2, Just ImgTableC2, Just ImgEmpty
2018-07-30 19:10:42 +00:00
]
, [ 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
]
2018-07-31 11:30:17 +00:00
, [ Just ImgEmpty, Just ImgTableC4, Just ImgTable4
, Just ImgTable4, Just ImgTableC3, Just ImgEmpty
2018-07-30 19:10:42 +00:00
]
2018-07-31 11:30:17 +00:00
, [ Just ImgEmpty, Just ImgTable1, Just ImgEmpty
, Just ImgEmpty, Just ImgTable3, Just ImgEmpty
2018-07-30 19:10:42 +00:00
]
2018-07-31 11:30:17 +00:00
, [ Just ImgEmpty, Just ImgTableC1, Just ImgTable2
, Just ImgTable2, Just ImgTableC2, Just ImgEmpty
2018-07-30 19:10:42 +00:00
]
, [ Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
]
]
2018-07-31 11:30:17 +00:00
clusterMat ClusterPlant1 =
M.fromLists
[ [ Just ImgMiscPlant1 ] ]
2018-07-31 20:59:25 +00:00
clusterMat ClusterPlant2 =
M.fromLists
[ [ Just ImgMiscPlant2 ] ]
clusterMat ClusterToilet =
M.fromLists
[ [ Just ImgEmpty, Just ImgEmptyNoWalk] ]
2018-03-03 16:03:17 +00:00
2018-07-31 11:30:17 +00:00
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]
2018-07-31 20:59:25 +00:00
clusterRoom ClusterPlant2 = [Offi, Hall]
clusterRoom ClusterToilet = [Toil]
2018-03-03 16:03:17 +00:00
clusterPoints :: Cluster -> [ReachPoint]
clusterPoints ClusterBox1 = []
2018-04-03 20:21:07 +00:00
clusterPoints ClusterTable1 =
[ ReachPoint Table (V2 1 1) NE]
2018-04-03 20:21:07 +00:00
clusterPoints ClusterTable2 =
[ ReachPoint Table (V2 2 1) NW]
2018-04-03 20:27:41 +00:00
clusterPoints ClusterTable3 =
[ ReachPoint Table (V2 1 2) SW]
2018-04-03 20:27:41 +00:00
clusterPoints ClusterTable4 =
[ ReachPoint Table (V2 1 1) SE]
clusterPoints ClusterCornerTable =
2018-07-30 12:34:46 +00:00
[ ReachPoint Computer (V2 2 1) N
]
clusterPoints ClusterTableGroup =
2018-07-30 12:34:46 +00:00
[ ReachPoint Computer (V2 2 2) N
, ReachPoint Computer (V2 2 5) N
, ReachPoint Computer (V2 5 5) N
]
2018-07-21 04:43:26 +00:00
clusterPoints ClusterCopier =
[ ReachPoint Copier (V2 2 1) NW
]
2018-07-30 13:34:45 +00:00
clusterPoints ClusterFlipchart =
[ ReachPoint Table (V2 2 1) NW
]
2018-07-30 19:10:42 +00:00
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
]
2018-07-31 20:59:25 +00:00
clusterPoints ClusterToilet =
[ ReachPoint Toilet (V2 1 1) NE
]
2018-07-31 11:30:17 +00:00
clusterPoints _ = []
2018-03-03 16:03:17 +00:00
instance Size Cluster where
size c =
let mat = clusterMat c
in fromIntegral ((nrows mat) * (ncols mat))