Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
xyzMayBeN.hpp
00001 /* $Id: $ */
00002 
00003 #ifndef MODELER_XYZ_MAY_BE_N_HPP
00004 #define MODELER_XYZ_MAY_BE_N_HPP
00005 
00006 #include "kernel/csvFile.hpp"
00007 #include "modeler/modelerException.hpp"
00008 
00009 namespace jafar {
00010   namespace modeler {
00011     
00012     class XYZMayBeN : public jafar::kernel::CSVFileLoad {
00013     public:
00014       cv::Mat matrix;
00015       XYZMayBeN() : CSVFileLoad() {};
00016     protected:
00017       void loadCSVFile(jafar::kernel::CSVFile& csvFile) {
00018         using namespace std;
00019         switch ((int) csvFile.nbOfColumns()) {
00020         case 3 : 
00021           {
00022             matrix = cv::Mat(csvFile.nbOfLines(), 3, CV_64F);
00023             for(size_t lineCounter = 0; lineCounter<csvFile.nbOfLines(); ++lineCounter){
00024               csvFile.getItem(lineCounter, 0, matrix.at<double>(lineCounter,0));
00025               csvFile.getItem(lineCounter, 1, matrix.at<double>(lineCounter,1));
00026               csvFile.getItem(lineCounter, 2, matrix.at<double>(lineCounter,2));
00027             }
00028           }; 
00029           break;
00030         case 6 :
00031           {
00032             matrix = cv::Mat(csvFile.nbOfLines(), 6, CV_64F);
00033             for(size_t lineCounter = 0; lineCounter<csvFile.nbOfLines(); ++lineCounter){
00034               csvFile.getItem(lineCounter, 0, matrix.at<double>(lineCounter,0));
00035               csvFile.getItem(lineCounter, 1, matrix.at<double>(lineCounter,1));
00036               csvFile.getItem(lineCounter, 2, matrix.at<double>(lineCounter,2));
00037               csvFile.getItem(lineCounter, 3, matrix.at<double>(lineCounter,03));
00038               csvFile.getItem(lineCounter, 4, matrix.at<double>(lineCounter,4));
00039               csvFile.getItem(lineCounter, 5, matrix.at<double>(lineCounter,5));
00040             }
00041           };
00042           break;
00043         default: 
00044           JFR_ERROR(ModelerException, 
00045                     ModelerException::WRONG_SIZE, 
00046                     "file should have 3 or 6 columns got " << csvFile.nbOfColumns())
00047           break;
00048         }
00049       }
00050     }; //XYZMayBeN
00051   } //namespace modeler
00052 } //namespace jafar
00053 
00054 #endif
00055 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:25 for Jafar by doxygen 1.7.6.1
LAAS-CNRS