@@ -9,6 +9,14 @@ class QgsStyleV2
99 QgsStyleV2 ();
1010 ~QgsStyleV2 ();
1111
12+ // ! Enum for Entities involved in a style
13+ /* !
14+ The enumerator is used for identifying the entity being operated on when generic
15+ database functions are being run.
16+ \sa group(), rename(), remove(), symbolsOfGroup(), symbolsWithTag(), symbolsOfSmartgroup()
17+ */
18+ enum StyleEntity { SymbolEntity, GroupEntity, TagEntity, ColorrampEntity, SmartgroupEntity };
19+
1220 // ! add color ramp to style. takes ramp's ownership
1321 /* !
1422 * \note Adding a color ramp with the name of existing one replaces it.
@@ -85,7 +93,7 @@ class QgsStyleV2
8593 * \param tags is the list of the tags that are to be applied as QStringList
8694 * \return returns the success state of the operation
8795 */
88- bool tagSymbol ( int type, QString symbol, QStringList tags );
96+ bool tagSymbol ( StyleEntity type, QString symbol, QStringList tags );
8997
9098 // ! detags the symbol with the given list
9199 /* !
@@ -95,7 +103,7 @@ class QgsStyleV2
95103 * \param tags is the list of tags that are to be removed as QStringList
96104 * \return returns the success state of the operation
97105 */
98- bool detagSymbol ( int type, QString symbol, QStringList tags );
106+ bool detagSymbol ( StyleEntity type, QString symbol, QStringList tags );
99107
100108 // ! remove symbol from style (and delete it)
101109 bool removeSymbol ( QString name );
@@ -135,15 +143,15 @@ class QgsStyleV2
135143 * \param groupid is id of the group to which the symbols belong to, as int
136144 * \return A QStringList of the symbol or colorramp names for the given group id
137145 */
138- QStringList symbolsOfGroup ( int type, int groupid );
146+ QStringList symbolsOfGroup ( StyleEntity type, int groupid );
139147
140148 // ! returns the symbol names with which have the given tag
141149 /* !
142150 * \param type is either SymbolEntity or ColorampEntity
143151 * \param tagid is id of the tag which has been applied over the symbol as int
144152 * \return A QStringList of the symbol or colorramp names for the given tag id
145153 */
146- QStringList symbolsWithTag ( int type, int tagid );
154+ QStringList symbolsWithTag ( StyleEntity type, int tagid );
147155
148156 // ! applies the specifed group to the symbol or colorramp specified by StyleEntity
149157 /* !
@@ -152,22 +160,22 @@ class QgsStyleV2
152160 * \param groupid is the id of the group to which the entity is assigned
153161 * \return returns the success state as bool
154162 */
155- bool group ( int type, QString name, int groupid );
163+ bool group ( StyleEntity type, QString name, int groupid );
156164
157165 // ! rename the given entity with the specified id
158166 /* !
159167 * \param type is any of the style entites. Refer enum StyleEntity.
160168 * \param id is the DB id of the entity which is to be renamed
161169 * \param newName is the new name of the entity
162170 */
163- void rename ( int type, int id, QString newName );
171+ void rename ( StyleEntity type, int id, QString newName );
164172
165173 // ! remove the specified entity from the db
166174 /* !
167175 * \param type is any of the style entites. Refer enum StyleEntity.
168176 * \param id is the DB id of the entity to be removed
169177 */
170- void remove ( int type, int id );
178+ void remove ( StyleEntity type, int id );
171179
172180 // ! add the symbol to the DB with the tags
173181 /* !
@@ -218,7 +226,7 @@ class QgsStyleV2
218226 * \param symbol is the name of the symbol or color ramp
219227 * \return A QStringList of the tags that have been applied to that symbol/colorramp
220228 */
221- QStringList tagsOfSymbol ( int type, QString symbol );
229+ QStringList tagsOfSymbol ( StyleEntity type, QString symbol );
222230
223231 // ! returns the smart groups map with id as key and name as value
224232 QMap<int , QString> smartgroupsListMap ();
@@ -234,7 +242,7 @@ class QgsStyleV2
234242 QString smartgroupOperator ( int id );
235243
236244 // ! returns the symbols for the smartgroup
237- QStringList symbolsOfSmartgroup ( int type, int id );
245+ QStringList symbolsOfSmartgroup ( StyleEntity type, int id );
238246
239247 // ! Exports the style as a XML file
240248 bool exportXML ( QString filename );
@@ -265,5 +273,5 @@ class QgsStyleV2
265273 * \param name is the name of an existing symbol or a color ramp
266274 * \return Success state of the update operation
267275 */
268- bool updateSymbol ( int type, QString name );
276+ bool updateSymbol ( StyleEntity type, QString name );
269277};
0 commit comments