Developer documentation | Axl-2.5.1

axlFieldParametricVolumeTangentVectorWriter.cpp
Go to the documentation of this file.
1 /* axlFieldParametricVolumeTangentVectorWriter.cpp ---
2  *
3  * Author: Anais Ducoffe
4  * Copyright (C) 2013 - Anais Ducoffe, Inria.
5  */
6 
7 /* Commentary:
8  *
9  */
10 
11 /* Change log:
12  *
13  */
14 
16 
18 
19 #include <dtkCoreSupport/dtkAbstractData.h>
20 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
21 
22 // /////////////////////////////////////////////////////////////////
23 // axlFieldParametricVolumeTangentVectorWriter
24 // /////////////////////////////////////////////////////////////////
25 
27 {
28  this->setObjectName(this->description());
29 }
30 
32 {
33 
34 }
35 
37 {
38  return "axlFieldParametricVolumeTangentVectorWriter";
39 }
40 
42 {
43  return "axlFieldParametricVolumeTangentVectorWriter";
44 }
45 
47 {
48  return QStringList() << "axlFieldParametricVolumeTangentVector";
49 }
50 
52 {
53  return dtkAbstractDataFactory::instance()->registerDataWriterType("axlFieldParametricVolumeTangentVectorWriter", QStringList(), createaxlFieldParametricVolumeTangentVectorWriter);
54 }
55 
57 {
59  if(spatialField)
60  return true;
61 
62  return false;
63 }
64 
66 {
67  return !this->accept(data);
68 }
69 
70 QDomElement axlFieldParametricVolumeTangentVectorWriter::write(QDomDocument *doc, dtkAbstractData *data)
71 {
73 
74  QDomElement fieldElement = doc->createElement("field");
75 
77  fieldElement.setAttribute("type", field->identifier());
78 
80  for(int i = 0; i < 3;i++){
81 
82  QDomElement parameter = doc->createElement("parameter");
83  parameter.setAttribute("value", QString::number(field->parameter(i)));
84  parameter.setAttribute("channel", QString::number(i));
85  parameter.setAttribute("type", "double");
86  fieldElement.appendChild(parameter);
87 
88  }
89 
90  return fieldElement;
91 }
92 
93 
94 
95 QDomElement axlFieldParametricVolumeTangentVectorWriter::elementByWriter(axlAbstractDataWriter *axl_writer, QDomDocument *doc, dtkAbstractData *data)
96 {
97  QDomElement element;
98 
99  if(!axl_writer)
100  return element;
101 
102  if(!axl_writer->accept(data))
103  return element;
104 
105  element = axl_writer->write(doc, data);
106 
107  return element;
108 }
109 
111 {
113 }
114 
QString identifier(void) const
Returns the identifier of the field "axlFieldParametricVolumeTangentVector".
virtual bool accept(dtkAbstractData *data)=0
QDomElement write(QDomDocument *doc, dtkAbstractData *data)
dtkAbstractDataWriter * createaxlFieldParametricVolumeTangentVectorWriter(void)
virtual QDomElement write(QDomDocument *doc, dtkAbstractData *data)=0
double parameter(int channel)
Returns the direction parameter for the tangentVector, the channel-th one.
Class axlFieldParametricVolumeTangentVector defines an API for field which owns a BSpline Surface as ...