Skip to content

Commit

Permalink
Add read RPC xml start
Browse files Browse the repository at this point in the history
  • Loading branch information
erupnik committed Jan 18, 2024
1 parent 71bba64 commit ad21279
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 2 deletions.
1 change: 1 addition & 0 deletions MMVII/include/MMVII_DeclareAllCmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ extern cSpecMMVII_Appli TheSpec_SimulDispl;
extern cSpecMMVII_Appli TheSpec_CreateRTL;
extern cSpecMMVII_Appli TheSpec_ChSysCo;
extern cSpecMMVII_Appli TheSpec_CreateCalib;
extern cSpecMMVII_Appli TheSpecImportPushbroom;
};

#endif // _MMVII_DeclareAllCmd_H_
2 changes: 2 additions & 0 deletions MMVII/src/Appli/cSpecMMVII_Appli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ std::vector<cSpecMMVII_Appli *> & cSpecMMVII_Appli::InternVecAll()
TheVecAll.push_back(&TheSpec_CreateCalib);
TheVecAll.push_back(&TheSpec_ImportTiePMul);
TheVecAll.push_back(&TheSpec_ImportMesImGCP);
TheVecAll.push_back(&TheSpecImportPushbroom);


std::sort(TheVecAll.begin(),TheVecAll.end(),CmpCmd);
}
Expand Down
121 changes: 121 additions & 0 deletions MMVII/src/MMV1/cImportPushbroom.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#include "StdAfx.h"
#include "V1VII.h"
#include "cMMVII_Appli.h"
#include "MMVII_DeclareCste.h"
#include "MMVII_Geom3D.h"
#include "MMVII_Sensor.h"

namespace MMVII
{

extern void TestReadXML(const std::string&);

/* =============================================== */
/* */
/* cPushbroomSensor */
/* */
/* =============================================== */

/** Class for XXX */

class cPushbroomSensor : public cSensorImage
{
public :
cPushbroomSensor();

private:


};
/*
*
*
*
*
RatioPolyn 40 coeffs et les bornes
??inherit from mapping non inversible??
DataRPC contains 2 obj of RatioPolyn, as well as validity
constructor par def qui fait rien
function ReadXML qui lit
*/

/* =============================================== */
/* */
/* cAppliImportPushbroom */
/* */
/* =============================================== */

/** A basic application for */

class cAppliImportPushbroom : public cMMVII_Appli
{
public :

cAppliImportPushbroom(const std::vector<std::string> & aVArgs,const cSpecMMVII_Appli & aSpec);

private :
int Exe() override;
cCollecSpecArg2007 & ArgObl(cCollecSpecArg2007 & anArgObl) override ;
cCollecSpecArg2007 & ArgOpt(cCollecSpecArg2007 & anArgOpt) override ;

// --- Mandatory ----
std::string mNameSensorIn;

// --- Optionnal ----
std::string mNameSensorOut;

// --- Internal ----
};

cAppliImportPushbroom::cAppliImportPushbroom(const std::vector<std::string> & aVArgs,const cSpecMMVII_Appli & aSpec) :
cMMVII_Appli (aVArgs,aSpec)
{
}


cCollecSpecArg2007 & cAppliImportPushbroom::ArgObl(cCollecSpecArg2007 & anArgObl)
{
return anArgObl
<< Arg2007(mNameSensorIn,"Name of input sensor gile", {eTA2007::FileDirProj,eTA2007::Orient})
;
}

cCollecSpecArg2007 & cAppliImportPushbroom::ArgOpt(cCollecSpecArg2007 & anArgOpt)
{
return anArgOpt
<< AOpt2007(mNameSensorOut,CurOP_Out,"Name of output file if correction are done")
;
}

int cAppliImportPushbroom::Exe()
{

TestReadXML(mNameSensorIn);


return EXIT_SUCCESS;
}

/* =============================================== */
/* :: */
/* =============================================== */

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

cSpecMMVII_Appli TheSpecImportPushbroom
(
"ImportPushbroom",
Alloc_ImportPushbroom,
"Import a pushbroom sensor",
{eApF::Ori},
{eApDT::Ori},
{eApDT::Ori},
__FILE__
);

};
9 changes: 8 additions & 1 deletion MMVII/src/Serial/Serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ class cSerialTree : public cMemCheck
void Raw_PrettyPrint(cMMVII_Ofs& anOfs) const; /// Tagt-pretty print
void CSV_PrettyPrint(std::vector<std::string>& aRes,bool IsSpecif) const; /// print

/// Extract a descendant from its name
std::vector<const cSerialTree *> GetAllDescFromName(const std::string &) const;
/// Test if there is a one and only one descendant
const cSerialTree * GetUniqueDescFromName(const std::string &) const;


/// Assert that there is only 1 son and return it
const cSerialTree & UniqueSon() const;
Expand All @@ -226,7 +231,9 @@ class cSerialTree : public cMemCheck
const std::vector<cSerialTree>& Sons() const; /// acessor
const std::string & Value() const ; /// accessor
private :
void RecursSetFather(cSerialTree *);
void RecGetAllDescFromName(std::vector<const cSerialTree *>&,const std::string &) const;

void RecursSetFather(cSerialTree *);
// cSerialTree(const cSerialTree &) ;
/// Implement using exception
void Rec_AnalyseDiffTree(const cSerialTree &,const std::string & aSkeep) const;
Expand Down
53 changes: 52 additions & 1 deletion MMVII/src/Serial/SerialByTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,12 @@ cResLex cXmlSerialTokenParser::AnalysePonctuation(char aC)

void cXmlSerialTokenParser::CheckOnClose(const cSerialTree & aTree,const std::string & aStr) const
{
MMVII_INTERNAL_ASSERT_tiny(aTree.Value() == aStr,"Close tag unexpected");
if (aTree.Value() != aStr)
{
StdOut()<< "Expected : [" << aStr << "], Got : [" << aTree.Value()<< "] " << std::endl;
MMVII_INTERNAL_ASSERT_tiny(false,"Close tag unexpected");
}

}

/*============================================================*/
Expand Down Expand Up @@ -514,6 +519,31 @@ cSerialTree* cSerialTree::AllocSimplify(const std::string & aNameFile)
return aRes;
}

void cSerialTree::RecGetAllDescFromName(std::vector<const cSerialTree *>& aRes,const std::string & aTag) const
{
if (!IsTerminalNode() && (aTag==mValue))
aRes.push_back(this);

for (const auto & aSon : mSons)
aSon.RecGetAllDescFromName(aRes,aTag);
}

/// Extract a descendant from its name
std::vector<const cSerialTree *> cSerialTree::GetAllDescFromName(const std::string & aTag) const
{
std::vector<const cSerialTree *> aRes;
RecGetAllDescFromName(aRes,aTag);
return aRes;
}
/// Test if there is a one and only one descendant
const cSerialTree * cSerialTree::GetUniqueDescFromName(const std::string & aTag) const
{
std::vector<const cSerialTree *> aRes = GetAllDescFromName(aTag);
MMVII_INTERNAL_ASSERT_tiny(aRes.size()==1,"cSerialTree::GetUniqueDescFromName, size="+ToStr(aRes.size()));

return aRes.at(0);
}


bool cSerialTree::IsTerminalNode() const
{
Expand Down Expand Up @@ -1426,6 +1456,27 @@ void PutLineCSV(cMMVII_Ofs & anOfs,const std::vector<std::string> & aVS)
anOfs.Ofs() << "\n";
}

/* ==================================================================== */
/* */
/* :: */
/* */
/* ==================================================================== */

void TestReadXML(const std::string& aNameFile)
{
cSerialFileParser * aSFP = cSerialFileParser::Alloc(aNameFile,eTypeSerial::exml);
cSerialTree aTree(*aSFP);
const cSerialTree * aDirect = aTree.GetUniqueDescFromName("Direct_Model");
const cSerialTree * aSNC6 = aDirect->GetUniqueDescFromName("SAMP_NUM_COEFF_6");


StdOut() << "TEST COEFF" << aSNC6->UniqueSon().Value() << "\n";

delete aSFP;


StdOut() << "Bonjour World!" << std::endl;
}

};

0 comments on commit ad21279

Please sign in to comment.