Skip to content

Commit

Permalink
ImportOBS command
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmuller committed Sep 11, 2024
1 parent ef82b6a commit 8da509d
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 1 deletion.
1 change: 1 addition & 0 deletions MMVII/include/MMVII_DeclareAllCmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ extern cSpecMMVII_Appli TheSpec_TopoAdj;
extern cSpecMMVII_Appli TheSpecDistCorrectCirgTarget;
extern cSpecMMVII_Appli TheSpecGenArgsSpec;
extern cSpecMMVII_Appli TheSpec_ImportGCP;
extern cSpecMMVII_Appli TheSpec_ImportOBS;
extern cSpecMMVII_Appli TheSpec_ImportORGI;
extern cSpecMMVII_Appli TheSpec_ImportTiePMul;
extern cSpecMMVII_Appli TheSpec_ImportMesImGCP;
Expand Down
3 changes: 2 additions & 1 deletion MMVII/include/MMVII_enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ enum class eApDT
SysCo, ///< Coordinate system
Radiom, ///< Orientations files
Ply, ///< Ply file
None, ///< Nothing
Topo, ///< Topo files
None, ///< Nothing
ToDef, ///< still unclassed
Console, ///< Console , (i.e printed message have values)
Xml, ///< Xml-files
Expand Down
1 change: 1 addition & 0 deletions MMVII/src/Appli/cSpecMMVII_Appli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ std::vector<cSpecMMVII_Appli *> & cSpecMMVII_Appli::InternVecAll()

TheVecAll.push_back(&TheSpecDistCorrectCirgTarget);
TheVecAll.push_back(&TheSpec_ImportGCP);
TheVecAll.push_back(&TheSpec_ImportOBS);
TheVecAll.push_back(&TheSpec_ImportORGI);
TheVecAll.push_back(&TheSpec_ImportM32);
//TheVecAll.push_back(&TheSpecTopoComp);
Expand Down
109 changes: 109 additions & 0 deletions MMVII/src/ConvertFormat/ImportOBS.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#include "MMVII_PCSens.h"
#include "MMVII_MMV1Compat.h"
#include "MMVII_DeclareCste.h"
#include "MMVII_Topo.h"

#include "../src/Topo/ctopodata.h"

namespace MMVII
{

/* ********************************************************** */
/* */
/* cAppli_ImportOBS */
/* */
/* ********************************************************** */

class cAppli_ImportOBS : public cMMVII_Appli
{
public :
cAppli_ImportOBS(const std::vector<std::string> & aVArgs,const cSpecMMVII_Appli & aSpec);
int Exe() override;
cCollecSpecArg2007 & ArgObl(cCollecSpecArg2007 & anArgObl) override ;
cCollecSpecArg2007 & ArgOpt(cCollecSpecArg2007 & anArgOpt) override ;

std::vector<std::string> Samples() const override;
private :

cPhotogrammetricProject mPhProj;

// Mandatory Arg
std::string mNameObsFile;
std::string mNameObsDir;
};

cAppli_ImportOBS::cAppli_ImportOBS(const std::vector<std::string> & aVArgs,const cSpecMMVII_Appli & aSpec) :
cMMVII_Appli (aVArgs,aSpec),
mPhProj (*this)
{
}

cCollecSpecArg2007 & cAppli_ImportOBS::ArgObl(cCollecSpecArg2007 & anArgObl)
{
return anArgObl
<< Arg2007(mNameObsFile ,"Name of Obs Input File",{eTA2007::FileAny})
<< mPhProj.DPTopoMes().ArgDirOutMand()
;
}

cCollecSpecArg2007 & cAppli_ImportOBS::ArgOpt(cCollecSpecArg2007 & anArgObl)
{
return anArgObl
;
}


int cAppli_ImportOBS::Exe()
{
mPhProj.FinishInit();

//cBA_Topo aBA_Topo(nullptr, nullptr);
cTopoData aAllTopoDataIn;
std::string aPost = Postfix(mNameObsFile,'.',true);
if (UCaseEqual(aPost,"obs"))
{
aAllTopoDataIn.InsertCompObsFile( mNameObsFile );
} else {
MMVII_INTERNAL_ASSERT_User(false, eTyUEr::eUnClassedError,
"Error: obs file has not the correct \".obs\" extension")
}
//mPhProj.SaveTopoMes(*mTopo);
std::string aInputFileDir;
std::string aInputFileFile;
SplitDirAndFile(aInputFileDir, aInputFileFile, mNameObsFile, true);
CopyFile(mNameObsFile, mPhProj.DPTopoMes().FullDirOut() + aInputFileFile);
StdOut() << mNameObsFile << " copied into " << mPhProj.DPTopoMes().FullDirOut() << "\n";

return EXIT_SUCCESS;
}


std::vector<std::string> cAppli_ImportOBS::Samples() const
{
return
{
"MMVII ImportOBS toto.obs Toto1"
};
}



tMMVII_UnikPApli Alloc_ImportOBS(const std::vector<std::string> & aVArgs,const cSpecMMVII_Appli & aSpec)
{
return tMMVII_UnikPApli(new cAppli_ImportOBS(aVArgs,aSpec));
}

cSpecMMVII_Appli TheSpec_ImportOBS
(
"ImportOBS",
Alloc_ImportOBS,
"Import Obs file in MMVII project",
{eApF::Topo},
{eApDT::Topo},
{eApDT::Topo},
__FILE__
);


}; // MMVII

1 change: 1 addition & 0 deletions MMVII/src/Serial/ElemStrToVal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ template<> cE2Str<eApDT>::tMapE2Str cE2Str<eApDT>::mE2S
{eApDT::SysCo,"SysCo"},
{eApDT::Radiom,"Radiom"},
{eApDT::Ply,"Ply"},
{eApDT::Topo,"Topo"},
{eApDT::None,"None"},
{eApDT::ToDef,"ToDef"},
{eApDT::Console,"Console"},
Expand Down

0 comments on commit 8da509d

Please sign in to comment.