Commit 498ea61b authored by Julien Wintz's avatar Julien Wintz
Browse files

Merge branch 'master' of dtk.inria.fr:dtk/dtk

parents 3cbd6fdb bcb3fd89
......@@ -3,9 +3,9 @@
## Author: Julien Wintz
## Copyright (C) 2008 - Julien Wintz, Inria.
## Created: Fri Se
## Last-Updated: Wed May 9 13:50:57 2012 (+0200)
## Last-Updated: Tue May 15 12:14:34 2012 (+0200)
## By: tkloczko
## Update #: 532
## Update #: 534
######################################################################
##
### Commentary:
......@@ -44,6 +44,7 @@ set(${PROJECT_NAME}_HEADERS
dtkComposerMachine.h
dtkComposerMachineState.h
dtkComposerNode.h
dtkComposerNodeArrayScalar.h
dtkComposerNodeBoolean.h
dtkComposerNodeBooleanOperator.h
dtkComposerNodeComposite.h
......@@ -145,6 +146,7 @@ set(${PROJECT_NAME}_SOURCES
dtkComposerMachine.cpp
dtkComposerMachineState.cpp
dtkComposerNode.cpp
dtkComposerNodeArrayScalar.cpp
dtkComposerNodeBoolean.cpp
dtkComposerNodeBooleanOperator.cpp
dtkComposerNodeComposite.cpp
......
......@@ -4,9 +4,9 @@
* Copyright (C) 2012 - Nicolas Niclausse, Inria.
* Created: 2012/01/30 10:37:32
* Version: $Id$
* Last-Updated: Wed May 9 14:10:58 2012 (+0200)
* Last-Updated: Tue May 15 12:23:16 2012 (+0200)
* By: tkloczko
* Update #: 565
* Update #: 568
*/
/* Commentary:
......@@ -21,6 +21,7 @@
#include "dtkComposerFactory.h"
#include "dtkComposerNode.h"
#include "dtkComposerNodeArrayScalar.h"
#include "dtkComposerNodeBoolean.h"
#include "dtkComposerNodeBooleanOperator.h"
#include "dtkComposerNodeConstants.h"
......@@ -133,6 +134,13 @@ dtkComposerFactory::dtkComposerFactory(void) : d(new dtkComposerFactoryPrivate)
d->descriptions["Data Container"] = "<p>Description not yet filled!</p>";
d->tags["Data Container"] = QStringList() << "container" << "data";
d->types["Data Container"] = "data_container";
// Array
d->nodes << "Scalar Array";
d->descriptions["Scalar Array"] = "<p>Description not yet filled!</p>";
d->tags["Scalar Array"] = QStringList() << "container" << "array" << "scalar" ;
d->types["Scalar Array"] = "array_scalar";
// Algebraic nodes
......@@ -649,6 +657,11 @@ dtkComposerNode *dtkComposerFactory::create(const QString& type)
if(type == "data_container")
return new dtkComposerNodeContainerData;
// Array nodes
if(type == "array_scalar")
return new dtkComposerNodeArrayScalar;
// algebraic nodes
if(type == "vector3D")
......
/* dtkComposerNodeArrayScalar.cpp ---
*
* Author: tkloczko
* Copyright (C) 2011 - Thibaud Kloczko, Inria.
* Created: Tue May 15 11:35:09 2012 (+0200)
* Version: $Id$
* Last-Updated: Tue May 15 13:58:18 2012 (+0200)
* By: tkloczko
* Update #: 33
*/
/* Commentary:
*
*/
/* Change log:
*
*/
#include "dtkComposerNodeArrayScalar.h"
#include "dtkComposerTransmitterEmitter.h"
#include "dtkComposerTransmitterReceiver.h"
#include <dtkCore/dtkContainerVector.h>
// /////////////////////////////////////////////////////////////////
//
// /////////////////////////////////////////////////////////////////
class dtkComposerNodeArrayScalarPrivate
{
public:
dtkComposerTransmitterReceiver<dtkContainerVectorReal> receiver_array;
dtkComposerTransmitterReceiver<qlonglong> receiver_size;
dtkComposerTransmitterReceiver<qreal> receiver_value;
public:
dtkComposerTransmitterEmitter<dtkContainerVectorReal> emitter_array;
dtkComposerTransmitterEmitter<qlonglong> emitter_size;
};
// /////////////////////////////////////////////////////////////////
//
// /////////////////////////////////////////////////////////////////
dtkComposerNodeArrayScalar::dtkComposerNodeArrayScalar(void) : dtkComposerNodeLeaf(), d(new dtkComposerNodeArrayScalarPrivate)
{
this->appendReceiver(&d->receiver_array);
this->appendReceiver(&d->receiver_size);
this->appendReceiver(&d->receiver_value);
this->appendEmitter(&d->emitter_array);
this->appendEmitter(&d->emitter_size);
}
dtkComposerNodeArrayScalar::~dtkComposerNodeArrayScalar(void)
{
delete d;
d = NULL;
}
QString dtkComposerNodeArrayScalar::inputLabelHint(int port)
{
switch(port) {
case 0:
return "array";
break;
case 1:
return "size";
break;
case 2:
return "value";
break;
default:
break;
}
return "port";
}
QString dtkComposerNodeArrayScalar::outputLabelHint(int port)
{
switch(port) {
case 0:
return "array";
break;
case 1:
return "size";
break;
default:
break;
}
return "port";
}
void dtkComposerNodeArrayScalar::run(void)
{
if (!d->receiver_array.isEmpty()) {
dtkContainerVectorReal array(d->receiver_array.data());
d->emitter_array.setData(array);
d->emitter_size.setData(array.count());
} else {
qlonglong size = 0;
qreal value = 0;
if (!d->receiver_size.isEmpty()) {
size = d->receiver_size.data();
if (!d->receiver_value.isEmpty())
value = d->receiver_value.data();
}
QVector<qreal> array(size, value);
d->emitter_array.setData(dtkContainerVectorReal(array));
d->emitter_size.setData(size);
}
}
/* dtkComposerNodeArrayScalar.h ---
*
* Author: tkloczko
* Copyright (C) 2011 - Thibaud Kloczko, Inria.
* Created: Tue May 15 11:33:29 2012 (+0200)
* Version: $Id$
* Last-Updated: Tue May 15 11:37:39 2012 (+0200)
* By: tkloczko
* Update #: 2
*/
/* Commentary:
*
*/
/* Change log:
*
*/
#ifndef DTKCOMPOSERNODEARRAYSCALAR_H
#define DTKCOMPOSERNODEARRAYSCALAR_H
#include "dtkComposerExport.h"
#include "dtkComposerNodeLeaf.h"
class dtkComposerNodeArrayScalarPrivate;
class DTKCOMPOSER_EXPORT dtkComposerNodeArrayScalar : public dtkComposerNodeLeaf
{
public:
dtkComposerNodeArrayScalar(void);
~dtkComposerNodeArrayScalar(void);
public:
void run(void);
public:
inline QString type(void) {
return "array_scalar";
}
inline QString titleHint(void) {
return "Scalar Array";
}
public:
QString inputLabelHint(int port);
QString outputLabelHint(int port);
private:
dtkComposerNodeArrayScalarPrivate *d;
};
#endif
......@@ -4,9 +4,9 @@
* Copyright (C) 2011 - Thibaud Kloczko, Inria.
* Created: Fri Apr 27 16:38:14 2012 (+0200)
* Version: $Id$
* Last-Updated: Mon May 7 16:14:08 2012 (+0200)
* Last-Updated: Tue May 15 12:18:15 2012 (+0200)
* By: tkloczko
* Update #: 59
* Update #: 64
*/
/* Commentary:
......@@ -96,4 +96,15 @@ private:
#include "dtkContainerVector.tpp"
// /////////////////////////////////////////////////////////////////
//
// /////////////////////////////////////////////////////////////////
#include <QtCore>
typedef dtkContainerVector<qreal> dtkContainerVectorReal;
Q_DECLARE_METATYPE(dtkContainerVectorReal );
Q_DECLARE_METATYPE(dtkContainerVectorReal *);
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment