Simple selection of a surfel (with shift + left click) with the QGLViewer proposed by DGtal (Viewer3D). You may associates names (i.e. integers) to surfels or to group of surfels. You may associate reactions or callback functions to named graphical objects (surfels in DGtal 0.9).
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/io/viewers/Viewer3D.h"
using namespace Z3i;
typedef MyViewer::SelectCallbackFct SelectCallbackFct;
typedef KSpace::SCell
SCell;
struct BigDataCells
{
std::map< DGtal::int32_t, Z3i::SCell > cells;
};
struct BigDataVoxels
{
std::map< DGtal::int32_t, Z3i::Point > voxels;
};
{
BigDataCells* bg = (BigDataCells*) data;
stringstream ssMessage;
ssMessage << "Reaction1 with name " << name << " cell " << bg->K.sKCoords( bg->cells[ name ] ) ;
((MyViewer *) viewer)->displayMessage(QString(ssMessage.str().c_str()), 100000);
trace.
info() << ssMessage.str() << std::endl;
return 0;
}
{
BigDataCells* bg = (BigDataCells*) data;
stringstream ssMessage;
ssMessage << "Reaction23 with name " << name << " cell " << bg->K.sKCoords( bg->cells[ name ] );
((MyViewer *) viewer)->displayMessage(QString(ssMessage.str().c_str()), 100000);
trace.
info() << ssMessage.str() << std::endl;
return 0;
}
{
BigDataVoxels* bg = (BigDataVoxels*) data;
stringstream ssMessage;
ssMessage << "Reaction4 with name " << name << " Voxel " << bg->voxels[name] ;
((MyViewer *) viewer)->displayMessage(QString(ssMessage.str().c_str()), 100000);
trace.
info() << ssMessage.str() << std::endl;
return 0;
}
int main(
int argc,
char** argv )
{
QApplication application(argc,argv);
BigDataCells data;
BigDataVoxels dataV;
dataV.voxels[4001] = v1;
dataV.voxels[4002] = v2;
dataV.voxels[4003] = v3;
viewer.show();
viewer.displayMessage(QString("You can use [shift + click right] on surfels or voxel to interact ..."), 100000);
data.cells[ 10001 ] = surfel1;
data.cells[ 10002 ] = surfel2;
data.cells[ 10003 ] = surfel3;
viewer<< MyViewer::updateDisplay;
return application.exec();
}
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::int32_t int32_t
signed 32-bit integer.
Modifier class in a Display3D stream. Useful to choose your own mode for a given class....
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
std::string className() const
Return the style name used for drawing this object.