Developer documentation | Axl-2.5.1

axlFieldParametricSurfaceTangentVectorWriter.cpp
Go to the documentation of this file.
1 /* axlFieldParametricSurfaceTangentVectorWriter.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 // axlFieldParametricSurfaceTangentVectorWriter
24 // /////////////////////////////////////////////////////////////////
25 
27 {
28  this->setObjectName(this->description());
29 }
30 
32 {
33 
34 }
35 
37 {
38  return "axlFieldParametricSurfaceTangentVectorWriter";
39 }
40 
42 {
43  return "axlFieldParametricSurfaceTangentVectorWriter";
44 }
45 
47 {
48  return QStringList() << "axlFieldParametricSurfaceTangentVector";
49 }
50 
52 {
53  return dtkAbstractDataFactory::instance()->registerDataWriterType("axlFieldParametricSurfaceTangentVectorWriter", QStringList(), createaxlFieldParametricSurfaceTangentVectorWriter);
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 axlFieldParametricSurfaceTangentVectorWriter::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 < 2;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 axlFieldParametricSurfaceTangentVectorWriter::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 
115 
double parameter(int channel)
Returns the direction parameter for the tangentVector, for the channel-th.
virtual bool accept(dtkAbstractData *data)=0
QString identifier(void) const
Returns the identifier of the field "axlFieldParametricSurfaceTangentVector".
dtkAbstractDataWriter * createaxlFieldParametricSurfaceTangentVectorWriter(void)
Class axlFieldParametricSurfaceTangentVector defines an API for field which owns a BSpline Surface as...
virtual QDomElement write(QDomDocument *doc, dtkAbstractData *data)=0
QDomElement write(QDomDocument *doc, dtkAbstractData *data)