Loading src/UsgsAstroLsSensorModel.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -252,6 +252,7 @@ std::string UsgsAstroLsSensorModel::getModelNameFromModelState( std::string UsgsAstroLsSensorModel::getModelState() const { json state; state["m_modelName"] = _SENSOR_MODEL_NAME; state["m_imageIdentifier"] = m_imageIdentifier; state["m_sensorType"] = m_sensorType; state["m_totalLines"] = m_totalLines; Loading Loading @@ -306,9 +307,9 @@ std::string UsgsAstroLsSensorModel::getModelState() const { state["m_imageFlipFlag"] = m_imageFlipFlag; state["m_referencePointXyz"] = json(); state["m_referencePointXyz"]["x"] = m_referencePointXyz.x; state["m_referencePointXyz"]["y"] = m_referencePointXyz.y; state["m_referencePointXyz"]["z"] = m_referencePointXyz.z; state["m_referencePointXyz"][0] = m_referencePointXyz.x; state["m_referencePointXyz"][1] = m_referencePointXyz.y; state["m_referencePointXyz"][2] = m_referencePointXyz.z; return state.dump(); } Loading src/UsgsAstroPlugin.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -201,7 +201,7 @@ bool UsgsAstroPlugin::canISDBeConvertedToModelState(const csm::Isd &imageSupport std::string UsgsAstroPlugin::getStateFromISD(csm::Isd imageSupportData) const { std::string stringIsd = loadImageSupportData(imageSupportData); json jsonIsd = json::parse(stringIsd); return convertISDToModelState(imageSupportData, jsonIsd.at("modelName")); return convertISDToModelState(imageSupportData, jsonIsd.at("name_model")); } Loading Loading @@ -259,7 +259,7 @@ csm::Model *UsgsAstroPlugin::constructModelFromState(const std::string& modelSta csm::WarningList *warnings) const { json state = json::parse(modelState); std::string modelName = state["modelName"]; std::string modelName = state["m_modelName"]; if (modelName == UsgsAstroFrameSensorModel::_SENSOR_MODEL_NAME) { UsgsAstroFrameSensorModel* model = new UsgsAstroFrameSensorModel(); Loading tests/LineScanCameraTests.cpp +2 −4 Original line number Diff line number Diff line Loading @@ -15,14 +15,12 @@ using json = nlohmann::json; TEST_F(ConstVelocityLineScanSensorModel, State) { std::string modelState = sensorModel->getModelState(); // EXPECT_NO_THROW( // sensorModel->replaceModelState(modelState) // ); sensorModel->replaceModelState(modelState); // When this is different, the output is very hard to parse // TODO implement JSON diff for gtest // EXPECT_EQ(sensorModel->getModelState(), modelState); EXPECT_EQ(sensorModel->getModelState(), modelState); } // Fly by tests Loading tests/PluginTests.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,14 @@ TEST_F(FrameIsdTest, Constructible) { "USGS_ASTRO_FRAME_SENSOR_MODEL")); } TEST_F(FrameIsdTest, ConstructibleFromState) { UsgsAstroPlugin testPlugin; std::string modelState = testPlugin.getStateFromISD(isd); EXPECT_TRUE(testPlugin.canModelBeConstructedFromState( "USGS_ASTRO_FRAME_SENSOR_MODEL", modelState)); } TEST_F(FrameIsdTest, NotConstructible) { UsgsAstroPlugin testPlugin; isd.setFilename("data/constVelocityLineScan.img"); Loading Loading @@ -142,6 +150,14 @@ TEST_F(ConstVelLineScanIsdTest, Constructible) { "USGS_ASTRO_LINE_SCANNER_SENSOR_MODEL")); } TEST_F(ConstVelLineScanIsdTest, ConstructibleFromState) { UsgsAstroPlugin testPlugin; std::string modelState = testPlugin.getStateFromISD(isd); EXPECT_TRUE(testPlugin.canModelBeConstructedFromState( "USGS_ASTRO_LINE_SCANNER_SENSOR_MODEL", modelState)); } TEST_F(ConstVelLineScanIsdTest, NotConstructible) { UsgsAstroPlugin testPlugin; isd.setFilename("data/simpleFramerISD.img"); Loading Loading
src/UsgsAstroLsSensorModel.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -252,6 +252,7 @@ std::string UsgsAstroLsSensorModel::getModelNameFromModelState( std::string UsgsAstroLsSensorModel::getModelState() const { json state; state["m_modelName"] = _SENSOR_MODEL_NAME; state["m_imageIdentifier"] = m_imageIdentifier; state["m_sensorType"] = m_sensorType; state["m_totalLines"] = m_totalLines; Loading Loading @@ -306,9 +307,9 @@ std::string UsgsAstroLsSensorModel::getModelState() const { state["m_imageFlipFlag"] = m_imageFlipFlag; state["m_referencePointXyz"] = json(); state["m_referencePointXyz"]["x"] = m_referencePointXyz.x; state["m_referencePointXyz"]["y"] = m_referencePointXyz.y; state["m_referencePointXyz"]["z"] = m_referencePointXyz.z; state["m_referencePointXyz"][0] = m_referencePointXyz.x; state["m_referencePointXyz"][1] = m_referencePointXyz.y; state["m_referencePointXyz"][2] = m_referencePointXyz.z; return state.dump(); } Loading
src/UsgsAstroPlugin.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -201,7 +201,7 @@ bool UsgsAstroPlugin::canISDBeConvertedToModelState(const csm::Isd &imageSupport std::string UsgsAstroPlugin::getStateFromISD(csm::Isd imageSupportData) const { std::string stringIsd = loadImageSupportData(imageSupportData); json jsonIsd = json::parse(stringIsd); return convertISDToModelState(imageSupportData, jsonIsd.at("modelName")); return convertISDToModelState(imageSupportData, jsonIsd.at("name_model")); } Loading Loading @@ -259,7 +259,7 @@ csm::Model *UsgsAstroPlugin::constructModelFromState(const std::string& modelSta csm::WarningList *warnings) const { json state = json::parse(modelState); std::string modelName = state["modelName"]; std::string modelName = state["m_modelName"]; if (modelName == UsgsAstroFrameSensorModel::_SENSOR_MODEL_NAME) { UsgsAstroFrameSensorModel* model = new UsgsAstroFrameSensorModel(); Loading
tests/LineScanCameraTests.cpp +2 −4 Original line number Diff line number Diff line Loading @@ -15,14 +15,12 @@ using json = nlohmann::json; TEST_F(ConstVelocityLineScanSensorModel, State) { std::string modelState = sensorModel->getModelState(); // EXPECT_NO_THROW( // sensorModel->replaceModelState(modelState) // ); sensorModel->replaceModelState(modelState); // When this is different, the output is very hard to parse // TODO implement JSON diff for gtest // EXPECT_EQ(sensorModel->getModelState(), modelState); EXPECT_EQ(sensorModel->getModelState(), modelState); } // Fly by tests Loading
tests/PluginTests.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,14 @@ TEST_F(FrameIsdTest, Constructible) { "USGS_ASTRO_FRAME_SENSOR_MODEL")); } TEST_F(FrameIsdTest, ConstructibleFromState) { UsgsAstroPlugin testPlugin; std::string modelState = testPlugin.getStateFromISD(isd); EXPECT_TRUE(testPlugin.canModelBeConstructedFromState( "USGS_ASTRO_FRAME_SENSOR_MODEL", modelState)); } TEST_F(FrameIsdTest, NotConstructible) { UsgsAstroPlugin testPlugin; isd.setFilename("data/constVelocityLineScan.img"); Loading Loading @@ -142,6 +150,14 @@ TEST_F(ConstVelLineScanIsdTest, Constructible) { "USGS_ASTRO_LINE_SCANNER_SENSOR_MODEL")); } TEST_F(ConstVelLineScanIsdTest, ConstructibleFromState) { UsgsAstroPlugin testPlugin; std::string modelState = testPlugin.getStateFromISD(isd); EXPECT_TRUE(testPlugin.canModelBeConstructedFromState( "USGS_ASTRO_LINE_SCANNER_SENSOR_MODEL", modelState)); } TEST_F(ConstVelLineScanIsdTest, NotConstructible) { UsgsAstroPlugin testPlugin; isd.setFilename("data/simpleFramerISD.img"); Loading