Loading isis/src/base/objs/LidarData/LidarData.cpp +18 −11 Original line number Diff line number Diff line Loading @@ -114,17 +114,18 @@ namespace Isis { /** * @brief Reads in a Lidar CSV file. * @brief Unserialize LidarData. * * @param FileName lidarFile Name of the Lidar CSV file to read. * @throws If the header for the file does not contain the correct info, * an IException will be thrown. * This method unserializes LidarData from a JSON or binary (QByteArray) file. It will * automatically determine if it is JSON or binary formatted date. * * @param FileName lidarFile Name of the serialized LidarData file to read. * @throws IException::User Throws User exception if it cannot open the file passed. */ void LidarData::read(FileName lidarFile) { void LidarData::read(FileName lidarDataFile) { // Set up the input file QFile loadFile(lidarFile.expanded()); QFile loadFile(lidarDataFile.expanded()); // Make sure we can open the file successfully if (!loadFile.open(QIODevice::ReadOnly)) { QString msg("Could not open " + loadFile.fileName()); throw IException(IException::User, msg, _FILEINFO_); Loading @@ -132,7 +133,7 @@ namespace Isis { // Load file QByteArray saveData = loadFile.readAll(); // Try to load from JSON (ASCII); if it can not, load as binary. QJsonDocument loadDoc(QJsonDocument::fromJson(saveData)); if (loadDoc.isNull()) { loadDoc = QJsonDocument::fromBinaryData(saveData); Loading Loading @@ -225,9 +226,15 @@ namespace Isis { /** * Writes out the Lidar data to a CSV file. * @brief Serializes LidarData. * * This method serializes the LidarData to either a JSON or binary (QByteArray) file. If JSON, * the file extension will be .json; otherwise (if binary), the file extension will be .dat. * * @param FileName outputFile Name of the file to serialize to. * @param LidarData::Format format Format of the serialized file (Json or Binary). * * @param FileName outputFile Name of the file to write to. * @throws IException::User Throws User exception if it cannot open the file for writing. */ void LidarData::write(FileName outputFile, LidarData::Format format) { // Set up the output file Loading isis/src/base/objs/LidarData/LidarData.h +9 −4 Original line number Diff line number Diff line Loading @@ -21,15 +21,20 @@ namespace Isis { * @internal * @history 2018-01-29 Ian Humphrey - original version. * @history 2018-01-31 Tyler Wilson - Implemented Lidar::read(Filename &). * @history 2018-01-31 Ian Humphrey - Added insert method to insert a LidarControlPoint into * the LidarData. Added documentation for m_points. * @history 2018-01-31 Ian Humphrey - Added insert method to insert a * LidarControlPoint into the LidarData. Added * documentation for m_points. * @history 2018-02-03 Ian Humphrey - Renamed read to readCsv. read() and write() * methods support JSON or binary serialization. Added * documentation to new Format enumeration. */ class LidarData { public: /** Enumerates the file formats for serializing the LidarData class. */ enum Format { Binary, Json Binary, /**< Serializes to a binary (QByteArray) .dat file. */ Json /**< Serializes to a JSON .json file. */ }; LidarData(); Loading Loading
isis/src/base/objs/LidarData/LidarData.cpp +18 −11 Original line number Diff line number Diff line Loading @@ -114,17 +114,18 @@ namespace Isis { /** * @brief Reads in a Lidar CSV file. * @brief Unserialize LidarData. * * @param FileName lidarFile Name of the Lidar CSV file to read. * @throws If the header for the file does not contain the correct info, * an IException will be thrown. * This method unserializes LidarData from a JSON or binary (QByteArray) file. It will * automatically determine if it is JSON or binary formatted date. * * @param FileName lidarFile Name of the serialized LidarData file to read. * @throws IException::User Throws User exception if it cannot open the file passed. */ void LidarData::read(FileName lidarFile) { void LidarData::read(FileName lidarDataFile) { // Set up the input file QFile loadFile(lidarFile.expanded()); QFile loadFile(lidarDataFile.expanded()); // Make sure we can open the file successfully if (!loadFile.open(QIODevice::ReadOnly)) { QString msg("Could not open " + loadFile.fileName()); throw IException(IException::User, msg, _FILEINFO_); Loading @@ -132,7 +133,7 @@ namespace Isis { // Load file QByteArray saveData = loadFile.readAll(); // Try to load from JSON (ASCII); if it can not, load as binary. QJsonDocument loadDoc(QJsonDocument::fromJson(saveData)); if (loadDoc.isNull()) { loadDoc = QJsonDocument::fromBinaryData(saveData); Loading Loading @@ -225,9 +226,15 @@ namespace Isis { /** * Writes out the Lidar data to a CSV file. * @brief Serializes LidarData. * * This method serializes the LidarData to either a JSON or binary (QByteArray) file. If JSON, * the file extension will be .json; otherwise (if binary), the file extension will be .dat. * * @param FileName outputFile Name of the file to serialize to. * @param LidarData::Format format Format of the serialized file (Json or Binary). * * @param FileName outputFile Name of the file to write to. * @throws IException::User Throws User exception if it cannot open the file for writing. */ void LidarData::write(FileName outputFile, LidarData::Format format) { // Set up the output file Loading
isis/src/base/objs/LidarData/LidarData.h +9 −4 Original line number Diff line number Diff line Loading @@ -21,15 +21,20 @@ namespace Isis { * @internal * @history 2018-01-29 Ian Humphrey - original version. * @history 2018-01-31 Tyler Wilson - Implemented Lidar::read(Filename &). * @history 2018-01-31 Ian Humphrey - Added insert method to insert a LidarControlPoint into * the LidarData. Added documentation for m_points. * @history 2018-01-31 Ian Humphrey - Added insert method to insert a * LidarControlPoint into the LidarData. Added * documentation for m_points. * @history 2018-02-03 Ian Humphrey - Renamed read to readCsv. read() and write() * methods support JSON or binary serialization. Added * documentation to new Format enumeration. */ class LidarData { public: /** Enumerates the file formats for serializing the LidarData class. */ enum Format { Binary, Json Binary, /**< Serializes to a binary (QByteArray) .dat file. */ Json /**< Serializes to a JSON .json file. */ }; LidarData(); Loading