Developer documentation | Axl-2.5.1

axlAbstractDataWriter.cpp
Go to the documentation of this file.
1 /* axlAbstractDataWriter.cpp ---
2  *
3  * Author: Meriadeg Perrinel
4  * Copyright (C) 2008-2011 - Meriadeg Perrinel, Inria.
5  * Created: Wed Sep 21 10:38:57 2011 (+0200)
6  * Version: $Id$
7  * Last-Updated: Tue Jan 24 10:53:56 2012 (+0100)
8  * By: Julien Wintz
9  * Update #: 6
10  */
11 
12 /* Commentary:
13  *
14  */
15 
16 /* Change log:
17  *
18  */
19 
20 #include "axlAbstractDataWriter.h"
21 
22 #include <axlCore/axlMesh.h>
23 #include <dtkCoreSupport/dtkAbstractData.h>
24 
25 #include <QtGui>
26 
27 axlAbstractDataWriter::axlAbstractDataWriter(void) : dtkAbstractDataWriter()
28 {
29 
30 }
31 
33 {
34 
35 }
36 
37 void axlAbstractDataWriter::setName (QDomElement& e, axlAbstractData *data)
38 {
39  if (data->name().length()>0)
40  e.setAttribute("name", data->name());
41 }
42 
43 void axlAbstractDataWriter::setSize (QDomElement& e, axlAbstractData *data)
44 {
45  if (data->size()>0)
46  e.setAttribute("size", QString::number(data->size()));
47 }
48 
50 {
51  QColor qcolor = data->color();
52  QString color ;
53  QTextStream(&color) << QString::number(qcolor.red()) << " "
54  << QString::number(qcolor.green()) << " "
55  << QString::number(qcolor.blue()) << " "
56  << QString::number(data->opacity());
57  e.setAttribute("color", color);
58 }
59 
61 {
62  QString shader = data->shader();
63  if(shader.length()>0) {
64  QFileInfo shaderFileInfo(shader);
65  e.setAttribute("shader", shaderFileInfo.fileName());
66  }
67 }
void setName(QDomElement &e, axlAbstractData *data)
void setSize(QDomElement &e, axlAbstractData *data)
void setShader(QDomElement &e, axlAbstractData *data)
void setColor(QDomElement &e, axlAbstractData *data)
Class axlAbstractData defines an API for all type of axel data.