void plotMain(int argc, char ** argv, unsigned char * dataSet, int imageWidth, int imageHeight, int imageDepth)
{
    glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutInitWindowSize(1000, 1000);
	glutInitWindowPosition (0, 0);
	glutCreateWindow("Data Visualiser");
    
    Init();

    StoreDataSet(dataSet, imageWidth, imageHeight, imageDepth);
    
    glutMouseFunc(&MouseClick);
    glutKeyboardFunc(Input);
	glutDisplayFunc(Display);
	glutIdleFunc(Update);
	glutMainLoop();
}
void plotMain(int argc, char ** argv, unsigned char * dataSet, int imageWidth, int imageHeight, int imageDepth)
{
    glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutInitWindowSize(1000, 1000);
	glutInitWindowPosition (0, 0);
	glutCreateWindow("Data Visualiser");
    
    Init();
    
    StoreDataSet(dataSet, imageWidth, imageHeight, imageDepth);
    
    vertices = runMarchingCubes(voxels, __imageWidth, __imageWidth, __imageDepth, 1, 1, 1, 0.5); //was 32.0f
    // here our scalar field holds the quaternion lengths after all iteration is complete
    //for(each element value in the scalar field){	
    // truncate all final quaternion lengths so that there is a maximum	
        //if(element value > 2*threshold)		
            //element value = 2*threshold;	
            // normalize all lengths to be within the interval 0.0 through 1.0	
            //element value /= 2*p.threshold;	
            // reverse the values so that lengths which were initially greater than 0.5 are now outside of the mesh	// not doing so would result in the same mesh, but the surface normals would point inward (a bad thing)	
            //element value = 1.0 - element value;}
//    vector<vertex>::iterator it;
//    for(it = vertices.begin(); it < vertices.end(); it++) {
//        for (int j  = 0; j < 3; j++) {
//            
//        }
//        glNormal3d(it->normal_x, it->normal_y, it->normal_z);
//        //scaling factor for z
//        glVertex3d(it->x, it->y, it->z);
//    }
//    initialize each vertex normal to the zero vector
//    for each triangle
//        add triangle normal to the vertex normal for each of the triangle's vertices
//            normalize each vertex normal
//            

    glutMouseFunc(&MouseClick);
    glutKeyboardFunc(Input);
	glutDisplayFunc(Display);
	glutIdleFunc(Update);
    DisplayUsability();
	glutMainLoop();
}
			void Execute(MysqlActionType action, const char* sql, const ExecuteResultHandlerType result_handler)
			{
				BOOST_ASSERT(sql != NULL);

				MysqlData result_data;
				if (!connection_.is_connected())
				{
					if (result_handler != 0)
						result_handler(MYSQL_RESULT_NOT_CONNECTED, result_data);

					return;
				}

				MYSQL* real_mysql = connection_.get_real_mysql();
				BOOST_ASSERT(real_mysql != NULL);
				evl::def::int32 ret = mysql_query(real_mysql, sql);
				if (ret != 0)
				{
					result_data.error_code = mysql_errno(real_mysql);
					result_data.error_desc = mysql_error(real_mysql);
					
					if (result_handler != 0)
					{
						result_handler(MYSQL_RESULT_ERROR, result_data);
					}
					else
					{
						if (result_data.error_code != 0)
						{
							std::cerr << "mysql error code: " << result_data.error_code << std::endl;
							std::cerr << "mysql error desc: " << result_data.error_desc << std::endl;
						}
					}

					return;
				}

				if (action == MYSQL_ACTION_TYPE_EXECUTE)
				{
					result_data.affected_rows = (evl::def::uint32)mysql_affected_rows(real_mysql);

					if (result_handler != 0)
						result_handler(MYSQL_RESULT_SUCCEED, result_data);

					return;
				}
				else if (action == MYSQL_ACTION_TYPE_QUERY)
				{
					// 处理结果集
					MYSQL_RES* res = mysql_store_result(real_mysql);
					BOOST_ASSERT(res != NULL);

					// 查询出来的行
					result_data.dataset_rows = (evl::def::uint32)mysql_num_rows(res);

					// 获取列信息
					MYSQL_FIELD* field = NULL;
					std::vector<FieldInfoSharedPtr> field_infos;
					while ((field = mysql_fetch_field(res)) != NULL)
					{
						FieldInfoSharedPtr field_info = ParseField(field);
						if (field_info.get() == NULL)
						{
							mysql_free_result(res);

							if (result_handler != 0)
								result_handler(MYSQL_RESULT_FAILED_TO_PARSE_FIELD, result_data);

							return;
						}

						field_infos.push_back(field_info);
					}

					MysqlResultEnum result_enum = StoreDataSet(res, field_infos, result_data) ?
					MYSQL_RESULT_SUCCEED : MYSQL_RESULT_FAILED_TO_STORE_DATASET;

					mysql_free_result(res);

					if (result_handler != 0)
						result_handler(result_enum, result_data);

					return;
				}

				if (result_handler != 0)
					result_handler(MYSQL_RESULT_UNKNOWN_ERROR, result_data);
			}