cDbleGrid::cDbleGrid ( cXMLMode aXM, const std::string & aDir, const std::string & aXML ) { cElXMLTree aTree(aDir+aXML); cElXMLTree * aTrNew = aTree.Get("GridDirecteEtInverse"); if (aTrNew) { cGridDirecteEtInverse aGDEI; xml_init(aGDEI,aTrNew); pGrDir = FromXMLExp(aGDEI.Directe()); pGrInv = FromXMLExp(aGDEI.Inverse()); } else { pGrInv = new PtImGrid (aTree.GetUnique("grid_inverse")->GetPtImGrid(aDir)); pGrDir = new PtImGrid (aTree.GetUnique("grid_directe")->GetPtImGrid(aDir)); if (aXM.toSwapDirInv) { ElSwap(pGrInv,pGrDir); } } }
int SaisiePts_main2(int argc,char ** argv) { MMD_InitArgcArgv(argc,argv); // cAppliApero * anAppli = cAppliMICMAC::Alloc(argc,argv,eAllocAM_STD); //if (0) delete anAppli; ELISE_ASSERT(argc>=2,"Not enough arg"); cElXMLTree aTree(argv[1]); cResultSubstAndStdGetFile<cParamSaisiePts> aP2 ( argc-2,argv+2, //0,0, argv[1], StdGetFileXMLSpec("ParamSaisiePts.xml"), "ParamSaisiePts", "ParamSaisiePts", "DirectoryChantier", "FileChantierNameDescripteur" ); //cAppli_SaisiePts anAppli (aP2); //((cX11_Interface*)anAppli.Interface())->BoucleInput(); //SaisiePts_Banniere(); return 0; }
cDbleGrid * cDbleGrid::StdGridPhotogram(const std::string & aNameFile,int aSzDisc) { cElXMLTree aTree(aNameFile); if (aTree.Get("doublegrid")) { std::string aDir,aFile; SplitDirAndFile(aDir,aFile,aNameFile); cDbleGrid::cXMLMode aXmlMode; return new cDbleGrid(aXmlMode,aDir,aFile); } if (aTree.Get("CalibrationInternConique")) { ElCamera * aCam = Cam_Gen_From_File(aNameFile,"CalibrationInternConique",(cInterfChantierNameManipulateur*)0); cDistStdFromCam aD(*aCam); cDbleGrid * aRes = new cDbleGrid ( true, Pt2dr(0,0),Pt2dr(aCam->Sz()), Pt2dr(aSzDisc,aSzDisc), aD ); delete aCam; return aRes; } ELISE_ASSERT(false,"cDbleGrid::StdGridPhotogram"); return 0; }
int CASALL_main(int argc,char ** argv) { // cAppliApero * anAppli = cAppliMICMAC::Alloc(argc,argv,eAllocAM_STD); //if (0) delete anAppli; ELISE_ASSERT(argc>=2,"Not enough arg"); cElXMLTree aTree(argv[1]); cResultSubstAndStdGetFile<cParamCasa> aP2 ( argc-2,argv+2, argv[1], StdGetFileXMLSpec("ParamCasa.xml"), "ParamCasa", "ParamCasa", "DirectoryChantier", "FileChantierNameDescripteur" ); cAppli_Casa anAppli (aP2); return 0; }
void cModeleAnalytiqueComp::LoadMA() { cElXMLTree aTree(mNameXML); mHomogr = aTree.GetUnique("Homographie")->GetElHomographie(); if (mDegrPolAdd>0) { mPolX = aTree.GetUnique("XPoly")->GetPolynome2D(); mPolY = aTree.GetUnique("YPoly")->GetPolynome2D(); mBoxPoly._p0 = aTree.GetUnique("PMinBox")->GetPt2dr(); mBoxPoly._p1 = aTree.GetUnique("PMaxBox")->GetPt2dr(); } MakeInverseModele(); }
void cAppliApero::CompileInitPoseGen(bool isPrecComp) { // Initialisation des inconnues d'orientation const tLP & aLP = mParam.PoseCameraInc(); for ( tLP::const_iterator itP = aLP.begin(); itP!=aLP.end() ; itP++) { bool isMST = itP->MEP_SPEC_MST().IsInit(); std::list<std::string> aLName; for ( std::list<std::string>::const_iterator itPat=itP->PatternName().begin(); itPat!=itP->PatternName().end(); itPat++ ) { if (itP->ByFile().Val()) { std::list<std::string> aSet = GetListFromSetSauvInFile(mDC+*itPat); std::copy(aSet.begin(),aSet.end(),std::back_inserter(aLName)); } else if (itP->ByKey().Val()) { const std::vector<string> * aSet = mICNM->Get(*itPat); std::copy(aSet->begin(),aSet->end(),std::back_inserter(aLName)); } else if (itP->ByPattern().Val()) { // std::list<std::string > aLName2Add = RegexListFileMatch(DC()+itP->Directory().Val(),*itPat,1,false); std::list<std::string > aLName2Add = mICNM->StdGetListOfFile(*itPat,1); if (aLName2Add.empty()) { std::cout << "For Pattern=["<< *itPat << "]\n"; ELISE_ASSERT(false,"Aucun match pour ce pattern de nom de pose"); } std::copy(aLName2Add.begin(),aLName2Add.end(),std::back_inserter(aLName)); } else { aLName.push_back(*itPat); } } if (itP->AutomGetImC().IsInit()) { const std::string & anId = itP->AutomGetImC().Val(); const cBDD_PtsLiaisons & aBDL = GetBDPtsLiaisonOfId(anId); ELISE_ASSERT(aBDL.KeySet().size()==1,"AddAllNameConnectedBy multiple_set"); // const std::vector<std::string> * aVNL = ICNM()->Get(aBDL.KeySet()[0]); const std::string & aKA = aBDL.KeyAssoc()[0]; std::map<std::string,double> mCpt; for (std::list<std::string>::const_iterator it1 = aLName.begin() ;it1!=aLName.end() ; it1++) mCpt[*it1] = 0; for (std::list<std::string>::const_iterator it1 = aLName.begin() ;it1!=aLName.end() ; it1++) { std::list<std::string>::const_iterator it2 = it1; it2++; for (; it2!=aLName.end() ; it2++) { std::string aNamePack = mDC+ICNM()->Assoc1To2(aKA,*it1,*it2,true); double aNb = sizeofile(aNamePack.c_str()); mCpt[*it1] += aNb; mCpt[*it2] +=aNb; } } double aBestSc = -1e9; std::string aBestN; for (std::map<std::string,double>::iterator it=mCpt.begin();it!=mCpt.end(); it++) { if (it->second > aBestSc) { aBestSc = it->second; aBestN = it->first; } } aLName.clear(); aLName.push_back(aBestN); } if (itP->AddAllNameConnectedBy().IsInit()) { cElRegex * aFilter=0; if (itP->FilterConnecBy().IsInit()) aFilter = new cElRegex(itP->FilterConnecBy().Val(),10); const std::string & anId = itP->AddAllNameConnectedBy().Val(); const cBDD_PtsLiaisons & aBDL = GetBDPtsLiaisonOfId(anId); ELISE_ASSERT(aBDL.KeySet().size()==1,"AddAllNameConnectedBy multiple_set"); const std::vector<std::string> * aVNL = ICNM()->Get(aBDL.KeySet()[0]); const std::string & aKA = aBDL.KeyAssoc()[0]; std::list<std::string> aNewL; for (int aKL=0;aKL<int(aVNL->size()) ; aKL++) { std::pair<std::string,std::string> aPair = ICNM()->Assoc2To1(aKA,(*aVNL)[aKL],false); const std::string * aNewN=0; if (BoolFind(aLName,aPair.first)) aNewN = & aPair.second; if (BoolFind(aLName,aPair.second)) aNewN = & aPair.first; if ( aNewN && (!BoolFind(aNewL,*aNewN)) && (!BoolFind(aLName,*aNewN)) ) { if((aFilter==0) || (aFilter->Match(*aNewN))) { bool isNew = isPrecComp ? (! NamePoseIsKnown(*aNewN)) : ( (NamePoseIsKnown(*aNewN)) && (! PoseFromName(*aNewN)->PreInit()) ); if (isNew) { aNewL.push_back(*aNewN); } } } } aLName = aNewL; delete aFilter; } if (itP->PatternRefuteur().IsInit()) { std::list<std::string> aNewL; for ( std::list<std::string>::const_iterator itS=aLName.begin(); itS != aLName.end(); itS++ ) { if (!itP->PatternRefuteur().Val()->Match(*itS)) { aNewL.push_back(*itS); } } aLName = aNewL; } if (itP->AutoRefutDupl().Val()) { std::list<std::string> aNewL; for ( std::list<std::string>::const_iterator itS=aLName.begin(); itS != aLName.end(); itS++ ) { if (!BoolFind(aNewL,*itS)) { aNewL.push_back(*itS); } } aLName = aNewL; } if (itP->Filter().IsInit()) { std::list<std::string> aNewL; const cNameFilter & aNF = itP->Filter().Val(); for ( std::list<std::string>::const_iterator itS=aLName.begin(); itS != aLName.end(); itS++ ) { if (NameFilter(mICNM,aNF,*itS)) { aNewL.push_back(*itS); } } aLName = aNewL; } if (itP->ReverseOrderName().Val()) { aLName.reverse(); } if (itP->KeyTranscriptionName().IsInit()) { std::string aKeyTr = itP->KeyTranscriptionName().Val(); std::list<std::string> aNewL; for ( std::list<std::string>::const_iterator itS=aLName.begin(); itS != aLName.end(); itS++ ) { aNewL.push_back(ICNM()->Assoc1To1(aKeyTr,*itS,true)); } aLName = aNewL; } if (isPrecComp) { cCompileAOI * aCAOI = itP->OptimizeAfterInit().IsInit() ? new cCompileAOI(itP->OptimizeAfterInit().Val()): 0 ; for ( std::list<std::string>::const_iterator itS=aLName.begin(); itS != aLName.end(); itS++ ) { std::string aNameCal = ""; if (itP->CalcNameCalib().IsInit()) { aNameCal = itP->CalcNameCalib().Val(); if (ICNM()->AssocHasKey(aNameCal)) { aNameCal = ICNM()->Assoc1To1(aNameCal,*itS,true); } } // Si les calibrations sont geres par le nouveua systeme if (!itP->CalcNameCalibAux().empty()) { ELISE_ASSERT(!itP->CalcNameCalib().IsInit(),"Choose CalcNameCalib OR CalcNameCalibAux"); aNameCal = ""; for ( std::list<cCalcNameCalibAux>::const_iterator itCAux = itP->CalcNameCalibAux().begin(); (itCAux != itP->CalcNameCalibAux().end()) && (aNameCal==""); itCAux++ ) { // std::cout << "HHHHHHHHH " << itCAux->CalcNameOnExistingTag().IsInit() << "\n"; if (itCAux->CalcNameOnExistingTag().IsInit()) { const cCalcNameOnExistingTag & aCal = itCAux->CalcNameOnExistingTag().Val(); std::string aXmlFile = DC() + ICNM()->Assoc1To1(aCal.KeyCalcFileOriExt(),*itS,true); cElXMLTree aTree (aXmlFile); bool GotTagE = (aTree.GetOneOrZero(aCal.TagExist()) !=0); bool GotTagNonE = (aTree.GetOneOrZero(aCal.TagNotExist()) !=0); // std::cout << "Auux " << aXmlFile << " " << GotTagE << " " << GotTagNonE << "\n"; if (aCal.ExigCohTags().Val()) { ELISE_ASSERT(GotTagE!=GotTagNonE,"Incoherence in CalcNameOnExistingTag"); } if (GotTagE && (!GotTagNonE)) { aNameCal = ICNM()->Assoc1To1(aCal.KeyCalcName(),*itS,true); } } if (itCAux->KeyCalcNameDef().IsInit()) { aNameCal = ICNM()->Assoc1To1(itCAux->KeyCalcNameDef().Val(),*itS,true); } } ELISE_ASSERT(aNameCal!="","Could not find satisfying CalcNameCalibAux"); } // std::string aNameCal = MatchAndReplace(anAutom,*itS,itP->CalcNameCalib()); if (DicBoolFind(mDicoPose,*itS)) { if ( itP->AutoRefutDupl().Val()) { } else { AssertEntreeDicoVide(mDicoPose,*itS,"Poses"); } } else { cPoseCam * aPC = cPoseCam::Alloc(*this,*itP,*itS,aNameCal,aCAOI); mDicoPose[*itS] = aPC; mVecPose.push_back(aPC); tGrApero::TSom & aSom = mGr.new_som(aPC); aPC->SetSom(aSom); if (! isMST) aPC->InitCpt(); for ( std::map<std::string,cLayerImage *>::iterator itLI = mMapLayers.begin(); itLI != mMapLayers.end(); itLI++ ) { itLI->second->AddLayer(*aPC); } } } } else { if ( itP->AutoRefutDupl().Val()) { std::list<std::string> aNewL; for ( std::list<std::string>::const_iterator itS=aLName.begin(); itS != aLName.end(); itS++ ) { cPoseCam * aPC = PoseFromNameSVP(*itS); if (aPC && ! (aPC->PreInit())) { aNewL.push_back(*itS); } } aLName = aNewL; } if (isMST) // L'init est faite "a la volee" dans MST { ConstructMST(aLName,*itP); } else { for ( std::list<std::string>::const_iterator itS=aLName.begin(); itS != aLName.end(); itS++ ) { cPoseCam * aPC = PoseFromName(*itS); if (itP->PoseFromLiaisons().IsInit()) { const std::vector<cLiaisonsInit> & aLI = itP->PoseFromLiaisons().Val().LiaisonsInit(); for ( std::vector<cLiaisonsInit>::const_iterator itL=aLI.begin(); itL!=aLI.end(); itL++ ) { cPoseCam * aPC2 = PoseFromName(aPC->CalNameFromL(*itL)); aPC->UpdateHeriteProf2Init(*aPC2); } } else { aPC->Set0Prof2Init(); // La valeur par defaut 0 de Prof2Init va tres bien } aPC->DoInitIfNow(); } } } } }
void debug(int argc, char* argv[]) { #ifdef RODOLPHE #endif #ifdef SAMUEL NodeTree nTree; // ARRAYTREE #if 0 nTree.insertNLeaves(15); #if 1 ArrayTree aTree(nTree); aTree.dumpToStdout(); std::cout << aTree.to_str() << std::endl; assert(aTree.check(aTree.getRoot())); std::cout << "Check 1 Ok" << std::endl; #endif #if 0 int subTree = aTree.degraph(1); std::cout << "aTree._root=" << aTree.getRoot() << std::endl; aTree.dumpToStdout(); std::cout << aTree.to_str() << std::endl; assert(aTree.check(0)); std::cout << "Check 2 Ok" << std::endl; #endif #if 0 std::cout << aTree.regraph(1, aTree.getRoot()) << std::endl; std::cout << "aTree._root=" << aTree.getRoot() << std::endl; aTree.dumpToStdout(); std::cout << aTree.to_str() << std::endl; assert(aTree.check(0)); std::cout << "Check 3 Ok" << std::endl; #endif #if 1 std::vector<int> nodes = aTree.SPR_list_init(3); aTree.SPR_list(3, nodes); std::cout << aTree.to_str() << std::endl; assert(aTree.check(aTree.getRoot())); std::cout << "Check 4 Ok" << std::endl; #endif // NODETREE #else nTree.insertNLeaves(10); NodeTree copy(nTree); std::cout << nTree.to_str() << std::endl; std::cout << nTree.check() << std::endl; std::cout << copy.to_str() << std::endl; std::cout << copy.check() << std::endl; NodeTree* A = &nTree; NodeTree* B = © Node* nodeA = (*A).nodeAt(1); Node* nodeB = (*B).nodeAt(1); std::cout << nodeA->to_str() << std::endl; std::cout << nodeB->to_str() << std::endl; #if 0 std::vector<Node*> nodesA = (*A).SPR_list_init(nodeA); (*A).SPR_list(nodeA, nodesA); std::vector<Node*> nodesB = (*B).SPR_list_init(nodeB); (*B).SPR_list(nodeB, nodesB); #else (*A).SPR_ite(nodeA); (*B).SPR_rec(nodeB); #endif std::cout << (*A).to_str() << std::endl; std::cout << (*A).getRoot()->to_str() << std::endl; std::cout << (*A).check() << std::endl; std::cout << (*B).to_str() << std::endl; std::cout << (*B).getRoot()->to_str() << std::endl; std::cout << (*B).check() << std::endl; #endif #endif }