VPTissue Reference Manual
RectangularTile.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
20 #include "RectangularTile.h"
21 
22 namespace SimPT_Editor {
23 
24 const double RectangularTile::g_side_length = 10.0;
25 const QPolygonF RectangularTile::g_start_polygon(QRectF(0, 0, g_side_length, g_side_length));
26 
27 namespace {
28 
29 QPainterPath PolygonToPath(const QPolygonF &polygon)
30 {
31  QPainterPath path;
32  path.moveTo(polygon.first());
33  path.lineTo(polygon.at(1));
34  path.lineTo(polygon.at(2));
35  return path;
36 }
37 
38 }
39 
41  : RectangularTile(g_start_polygon, nullptr)
42 {
43 }
44 
46 {
47 }
48 
50 {
51  return new RectangularTile(m_polygon.translated(-g_side_length, 0), parentItem());
52 }
53 
55 {
56  return new RectangularTile(m_polygon.translated(g_side_length, 0), parentItem());
57 }
58 
60 {
61  return new RectangularTile(m_polygon.translated(0, -g_side_length), parentItem());
62 }
63 
65 {
66  return new RectangularTile(m_polygon.translated(0, g_side_length), parentItem());
67 }
68 
69 RectangularTile::RectangularTile(const QPolygonF &polygon, QGraphicsItem *parentItem)
70  : Tile(polygon, PolygonToPath(polygon))
71 {
72  setParentItem(parentItem);
73 }
74 
75 } // namespace
virtual RectangularTile * Up() const
Creates a new tile on the row under this tile (should normally be the opposite of Tile::Down()) Paren...
Namespace for SimPT tissue editor package.
Definition: Cell.h:32
virtual RectangularTile * Left() const
Creates a new tile to the left of this tile (should normally be the opposite of Tile::Right()) Parent...
virtual ~RectangularTile()
Destructor.
Abstract base class for cell pattern tiles.
Definition: Tile.h:29
virtual RectangularTile * Right() const
Creates a new tile to the right of this tile (should normally be the opposite of Tile::Left()) Parent...
virtual RectangularTile * Down() const
Creates a new tile on the row under this tile (should normally be the opposite of Tile::Up()) Parent ...
Interface for RectangularTile.
see the online Qt documentation