CMS 3D CMS Logo

IgSo3DErrorBar.cc

Go to the documentation of this file.
00001 //<<<<<< INCLUDES                                                       >>>>>>
00002 
00003 #include "Iguana/Inventor/interface/IgSo3DErrorBar.h"
00004 #include <Inventor/nodes/SoDrawStyle.h>
00005 #include <Inventor/nodes/SoCoordinate3.h>
00006 #include <Inventor/nodes/SoIndexedLineSet.h>
00007 
00008 //<<<<<< PRIVATE DEFINES                                                >>>>>>
00009 //<<<<<< PRIVATE CONSTANTS                                              >>>>>>
00010 //<<<<<< PRIVATE TYPES                                                  >>>>>>
00011 //<<<<<< PRIVATE VARIABLE DEFINITIONS                                   >>>>>>
00012 //<<<<<< PUBLIC VARIABLE DEFINITIONS                                    >>>>>>
00013 //<<<<<< CLASS STRUCTURE INITIALIZATION                                 >>>>>>
00014 
00015 SO_KIT_SOURCE (IgSo3DErrorBar);
00016 
00017 //<<<<<< PRIVATE FUNCTION DEFINITIONS                                   >>>>>>
00018 //<<<<<< PUBLIC FUNCTION DEFINITIONS                                    >>>>>>
00019 //<<<<<< MEMBER FUNCTION DEFINITIONS                                    >>>>>>
00020 
00021 IgSo3DErrorBar::IgSo3DErrorBar (void)
00022 {
00023     SO_KIT_CONSTRUCTOR (IgSo3DErrorBar);
00024 
00025     SO_KIT_ADD_FIELD (lineWidth, (1.0));
00026     SO_KIT_ADD_FIELD (u1,        (0.5,  0.0,  0.0));
00027     SO_KIT_ADD_FIELD (u2,       (-0.5,  0.0,  0.0));
00028     SO_KIT_ADD_FIELD (v1,        (0.0,  0.5,  0.0));
00029     SO_KIT_ADD_FIELD (v2,        (0.0, -0.5,  0.0));
00030     SO_KIT_ADD_FIELD (w1,        (0.0,  0.0,  0.5));
00031     SO_KIT_ADD_FIELD (w2,        (0.0,  0.0, -0.5));
00032 
00033     SO_KIT_ADD_CATALOG_ENTRY (drawStyle, SoDrawStyle, FALSE, separator,\x0, TRUE);
00034     SO_KIT_ADD_CATALOG_ENTRY (lineCoords, SoCoordinate3, FALSE, separator,\x0, TRUE);
00035     SO_KIT_ADD_CATALOG_ENTRY (lineSet, SoIndexedLineSet, FALSE, separator,\x0, TRUE);
00036 
00037     SO_KIT_INIT_INSTANCE ();
00038 
00039     setUpConnections (true, true);
00040 }
00041 
00042 void
00043 IgSo3DErrorBar::initClass (void)
00044 { SO_KIT_INIT_CLASS (IgSo3DErrorBar, IgSoShapeKit, "IgSoShapeKit"); }
00045 
00046 void
00047 IgSo3DErrorBar::refresh (void)
00048 {
00049     SoDrawStyle         *drawStyle  = new SoDrawStyle;
00050     SoCoordinate3       *lineCoords = new SoCoordinate3;
00051     SoIndexedLineSet    *lineSet    = new SoIndexedLineSet;
00052 
00053     SbVec3f             lineVertices [6] = {
00054         u1.getValue (), u2.getValue (),
00055         v1.getValue (), v2.getValue (),
00056         w1.getValue (), w2.getValue ()
00057     };
00058 
00059     static const int    linesIndices [3*3] = {
00060         0, 1, SO_END_LINE_INDEX,
00061         2, 3, SO_END_LINE_INDEX,
00062         4, 5, SO_END_LINE_INDEX
00063     };
00064 
00065     lineCoords->point.setValues (0, 6, lineVertices); 
00066     lineSet->coordIndex.setValues (0, 9, linesIndices);
00067 
00068     drawStyle->lineWidth   = lineWidth.getValue ();
00069     drawStyle->linePattern = 0xffff;    // 0xffff = solid
00070 
00071     setPart ("drawStyle", drawStyle);
00072     setPart ("lineCoords", lineCoords);
00073     setPart ("lineSet", lineSet);
00074 }

Generated on Tue Jun 9 17:38:45 2009 for CMSSW by  doxygen 1.5.4