Developer documentation | Axl-2.5.1

axlPointSet.cpp
Go to the documentation of this file.
1 /* axlPointSet.h ---
2  *
3  * Author: Meriadeg Perrinel
4  * Copyright (C) 2008 - Meriadeg Perrinel, Inria.
5  * Created: Tue Nov 9 16:58:59 2010 (+0100)
6  * Version: $Id$
7  * Last-Updated: Tue Nov 9 17:09:38 2010 (+0100)
8  * By: Meriadeg Perrinel
9  * Update #: 19
10  */
11 
12 /* Commentary:
13  *
14  */
15 
16 /* Change log:
17  *
18  */
19 
20 #include "axlPointSet.h"
21 
22 #include <dtkCoreSupport/dtkGlobal.h>
23 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
24 
25 
26 
27 class axlPointSetPrivate
28 {
29 public:
30  QList<axlPoint *> points;
31  bool planar;
32  bool uniqueColor;
33 
34 };
35 
36 // /////////////////////////////////////////////////////////////////
37 // axlPointSet
38 // /////////////////////////////////////////////////////////////////
39 
40 axlPointSet::axlPointSet(void) : axlAbstractData(), d(new axlPointSetPrivate)
41 {
42  this->setObjectName(this->identifier());
43  d->planar = false;
44  d->uniqueColor = true;
45 }
46 
48 {
49  delete d;
50 
51  d = NULL;
52 }
53 
54 
55 void *axlPointSet::points(void) const
56 {
57  return &(d->points); // (d->Points est QList<axlPointSet *> )
58 }
59 
61 {
62  return &(d->points); // (d->Points est QList<axlPointSet *> )
63 }
64 
65 bool axlPointSet::isPlanar(void) const
66 {
67  return d->planar;
68 }
69 
70 void axlPointSet::setPlanar(const bool isPlanar)
71 {
72  d->planar=isPlanar;
73 }
74 
76 {
77  return d->uniqueColor;
78 }
79 
80 void axlPointSet::setUniqueColor(const bool uniqueColor)
81 {
82  d->uniqueColor = uniqueColor;
83 }
84 
86 {
87  return d->points.size();
88  //return static_cast<QList<axlPoint *> *>(this->points())->size();
89 }
90 
92 {
93  d->points.push_front(p);
94 
95 // static_cast<QList<axlPoint *> *>(this->points())->push_front(p);
96 }
97 
99 {
100  d->points.append( p);
101  // static_cast<QList<axlPoint *> *>(this->points())->push_back(p);
102 }
103 
105 {
106  return d->points.at(n);
107  //return static_cast<QList<axlPoint *> *>(this->points())->value(n);
108 }
109 
111 {
112  return d->points.at(n);
113 
114  //return static_cast<QList<axlPoint *> *>(this->points())->value(n);
115 }
116 
118 {
119  QList<axlPoint *> *listPoint = static_cast<QList<axlPoint *> *>(this->points());
120  QList<axlPoint *>::iterator itPoints;
121  for(itPoints=listPoint->begin();itPoints!=listPoint->end();itPoints++)
122  {
123  //dbg.nospace() <<itPoints;
124  }
125 
126  return dbg.space();
127 }
128 
130 {
131  qDebug()<<d->points;
132 }
133 
135 {
136 
137  return dtkAbstractDataFactory::instance()->registerDataType("axlPointSet", createaxlPointSet);
138 }
139 
140 QString axlPointSet::description(void) const
141 {
142  QString result = "axlPointSet";
143  result.append("\nNumber of points : "+QString::number(d->points.size()));
144  return result;
145 }
146 
147 QString axlPointSet::identifier(void) const
148 {
149  return "axlPointSet";
150 }
151 
152 QString axlPointSet::objectType(void) const
153 {
154  return "Point set";
155 }
156 
157 
158 
159 // /////////////////////////////////////////////////////////////////
160 // Type instanciation
161 // /////////////////////////////////////////////////////////////////
162 
163 dtkAbstractData *createaxlPointSet(void)
164 {
165  return new axlPointSet;
166 }
Class axlPoint defines 3D points.
Definition: axlPoint.h:34
void setPlanar(const bool isPlanar)
Definition: axlPointSet.cpp:70
static bool registered(void)
QString objectType(void) const
void setUniqueColor(const bool uniqueColor)
Definition: axlPointSet.cpp:80
virtual QString identifier(void) const
axlPoint * value(int n) const
void push_back(axlPoint *p)
Definition: axlPointSet.cpp:98
bool isUniqueColor(void) const
Definition: axlPointSet.cpp:75
void push_front(axlPoint *p)
Definition: axlPointSet.cpp:91
dtkAbstractData * createaxlPointSet(void)
axlPointSet(void)
Definition: axlPointSet.cpp:40
virtual QString description(void) const
virtual ~axlPointSet(void)
Virtual destructor, enables safe inheritance.
Definition: axlPointSet.cpp:47
bool isPlanar(void) const
Definition: axlPointSet.cpp:65
Class axlAbstractData defines an API for all type of axel data.
void * points(void) const
Definition: axlPointSet.cpp:55
QDebug printAxlAbstractPoints(QDebug dbg)
void printAxlPointSet(void)
int numberOfPoints(void) const
Definition: axlPointSet.cpp:85