MRPT  1.9.9
CDynamicGrid.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "containers-precomp.h" // Precompiled headers
11 
13 #include <mrpt/core/format.h>
14 #include <fstream>
15 
17  const std::string& fileName) const
18 {
19  std::ofstream f;
20  f.open(fileName.c_str(), std::ofstream::out);
21  if (!f.is_open()) return false;
22  const unsigned int sy = getSizeY(), sx = getSizeX();
23  for (unsigned int cy = 0; cy < sy; cy++)
24  {
25  for (unsigned int cx = 0; cx < sx; cx++)
26  f << mrpt::format("%f ", getCellAsFloat(cx, cy));
27  f << "\n";
28  }
29  return true;
30 }
bool saveToTextFile(const std::string &fileName) const
GLsizei const GLchar ** string
Definition: glext.h:4101
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Definition: format.cpp:16
virtual float getCellAsFloat(unsigned int cx, unsigned int cy) const =0
virtual unsigned int getSizeX() const =0
virtual unsigned int getSizeY() const =0



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020