Repository navigation
Expand file tree
/
Copy pathasgrid.cpp
More file actions
183 lines (145 loc) · 4.34 KB
/
Copy pathasgrid.cpp
File metadata and controls
183 lines (145 loc) · 4.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
// Implements the AsGrid class.
// $Author: Paul Wareing.
#include "asgrid.h"
#include "../io/asnode.h"
AsGrid::AsGrid( AsFactory *pAsFactory ) : AsRenderable( pAsFactory )
{
// Set the type property.
asSetType( AsObject::AS_OBJECT_GRID );
// Initialise the properties with primitive types.
m_dThumbNailScale = 1.0;
m_dDefaultScale = 1.0;
m_dScaleStep = 0.5;
m_bAllowSnap = false;
m_bOnTop = false;
m_bLevelEditor = false;
// Revisit ATE
QString sName = "Grid";
this->asSetName( sName );
}
AsGrid::AsGrid( const AsGrid& grid ) : AsRenderable( grid )
{
this->asCopy( grid );
}
AsGrid::~AsGrid()
{
}
void AsGrid::operator= ( const AsGrid& grid )
{
AsRenderable::operator =( grid );
this->asCopy( grid );
}
void AsGrid::asCopy( const AsGrid& grid )
{
this->m_dThumbNailScale = grid.asGetThumbNailScale();
this->m_dDefaultScale = grid.asGetDefaultScale();
this->m_dScaleStep = grid.asGetScaleStep();
this->m_bAllowSnap = grid.asGetAllowSnap();
this->m_bOnTop = grid.asGetOnTop();
this->m_bLevelEditor = grid.asGetLevelEditor();
}
QHash<QString, quint16>& AsGrid::m_lProperties( void )
{
static QHash<QString, quint16> HashProperties;
if ( HashProperties.isEmpty() )
{
// From AsObject...
// HashProperties.insert( "dateTimeCreated", ( quint16 )AsGrid::AS_PROPERTY_DATETIMECREATED );
// From AsRenderable...
HashProperties.insert( "transform", ( quint16 )AsGrid::AS_PROPERTY_TRANSFORM );
HashProperties.insert( "twips", ( quint16 )AsGrid::AS_PROPERTY_TWIPS );
HashProperties.insert( "name", ( quint16 )AsGrid::AS_PROPERTY_NAME );
HashProperties.insert( "keywords", ( quint16 )AsGrid::AS_PROPERTY_KEYWORDS );
HashProperties.insert( "visible", ( quint16 )AsGrid::AS_PROPERTY_VISIBLE );
HashProperties.insert( "boundingRect", ( quint16 )AsGrid::AS_PROPERTY_BOUNDINGRECT );
HashProperties.insert( "layer", ( quint16 )AsGrid::AS_PROPERTY_LAYER );
HashProperties.insert( "zOrder", ( quint16 )AsGrid::AS_PROPERTY_Z );
HashProperties.insert( "ink", ( quint16 )AsGrid::AS_PROPERTY_INK );
HashProperties.insert( "scaleOrigin", ( quint16 )AsGrid::AS_PROPERTY_SCALEORIGIN );
HashProperties.insert( "rotateOrigin", ( quint16 )AsGrid::AS_PROPERTY_ROTATEORIGIN );
// From AsGrid...
HashProperties.insert( "asThumbNailScale", ( quint16 )AsGrid::AS_PROPERTY_THUMBNAILSCALE );
HashProperties.insert( "defaultScale", ( quint16 )AsGrid::AS_PROPERTY_DEFAULTSCALE );
HashProperties.insert( "scaleStep", ( quint16 )AsGrid::AS_PROPERTY_SCALESTEP );
HashProperties.insert( "allowSnap", ( quint16 )AsGrid::AS_PROPERTY_ALLOWSNAP );
HashProperties.insert( "onTop", ( quint16 )AsGrid::AS_PROPERTY_ONTOP );
HashProperties.insert( "levelEditor", ( quint16 )AsGrid::AS_PROPERTY_LEVELEDITOR );
}
return HashProperties;
}
void AsGrid::asResetPropertyIndex( void )
{
AsObject::asSetPropertyIterator( &m_lProperties );
}
bool AsGrid::asCheckHit( const QPointF & /*worldPos*/ )
{
return false;
}
double AsGrid::asGetThumbNailScale( void ) const
{
return m_dThumbNailScale;
}
void AsGrid::asSetThumbNailScale( double d )
{
m_dThumbNailScale = d;
}
double AsGrid::asGetDefaultScale( void ) const
{
return m_dDefaultScale;
}
void AsGrid::asSetDefaultScale( double d )
{
m_dDefaultScale = d;
}
double AsGrid::asGetScaleStep( void ) const
{
return m_dScaleStep;
}
void AsGrid::asSetScaleStep( double d )
{
m_dScaleStep = d;
}
bool AsGrid::asGetAllowSnap( void ) const
{
return m_bAllowSnap;
}
void AsGrid::asSetAllowSnap( bool bAllowSnap )
{
m_bAllowSnap = bAllowSnap;
}
bool AsGrid::asGetOnTop() const
{
return m_bOnTop;
}
void AsGrid::asSetOnTop(bool bOnTop)
{
m_bOnTop = bOnTop;
}
bool AsGrid::asGetLevelEditor() const
{
return m_bLevelEditor;
}
void AsGrid::asSetLevelEditor(bool bLevelEditor)
{
m_bLevelEditor = bLevelEditor;
}
QPointF AsGrid::asGetNearestPoint( AsNode *pGridNode, const QPointF& point )
{
return QPointF();
}
bool AsGrid::asIsSelectable( void )
{
return false;
}
QString AsGrid::getPropertyNameById(int nID)
{
return m_lProperties().key(nID);
}
int AsGrid::getPropertyIdByName(QString name) const
{
return m_lProperties().value(name);
}
QString AsGrid::typeName()
{
return "grid";
}