MRPT  1.9.9
CDynamicGrid.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://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:4116
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: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019