#include "sopnamsp.h" #include "contmodex.h" #include "pigncont.h" #include #include #include #include "nobjmgr.h" #include "pidrawer.h" #include "nomgadapter.h" #include "servnobjm.h" /* --Methode-- */ ContModExecutor::ContModExecutor(PIACmd* mpiac, PIStdImgApp* app) { //PIACmd * mpiac; //NamedObjMgr omg; //mpiac = omg.GetImgApp()->CmdInterpreter(); //cout << " ContModExecutor::ContModExecutor() mpiac = " << (unsigned long)mpiac << endl; cout << " registration of contour commands "<RegisterCommand(kw, usage, this, hgrp); hgrp = "Obj. Display"; kw = "ntcont"; usage = "Creates and displays a ContourDrawer (from a NTuple)"; usage += "\n Usage: ntcont NTupleName varx vary varz [graphic_att/specific_opt] "; usage += "\n specific options "; usage += "\n ncont=[number of contours (automatic levels) ] "; usage += "\n niv/lev=[values for contours, separated by ','] "; usage += "\n lstep=[nomber,first_value,increment for contours ] "; usage += "\n bspline : use bspline algo for contour " ; usage += "\n 3spl : use cubic spline algo for contour " ; usage += "\n labon : put labels for contours " ; mpiac->RegisterCommand(kw, usage, this, hgrp); //cout << " Out of ContModExecutor::ContModExecutor() " << endl; } /* --Methode-- */ ContModExecutor::~ContModExecutor() { } /* --Methode-- */ int ContModExecutor::Execute(string& kw, vector& tokens, string& toks) { int nz=-1; double z0,dz; if ( kw == "contour") { NamedObjMgr omg; PIContourDrawer * contdrw = NULL; string dopt=""; if (tokens.size() < 1) { cout << "Usage: contour ObjName [graphic_att/specficic_opt: SEE HELP] " << endl; return(0); } // dopt = "same,thinline"; Si tu veux des valeurs par defaut //if (tokens.size() > 1) dopt = tokens[1]; //omg.PrintObj(tokens[0]); NObjMgrAdapter* obja = omg.GetObjAdapter(tokens[0]); if (obja == NULL) { cout << "contour Error , No object with name " << tokens[0] << endl; return(0); } string ctyp = typeid(*obja).name(); cout << " objet de type "<GetDataObj(); if (ob == NULL) { cerr << "Error - NULL object ! in " << tokens[0] << endl; return(0); } ctyp = typeid(*ob).name(); cout << " objet de type "< 1) dopt = tokens[1]; P2DArrayAdapter* arr = obja->Get2DArray(dopt); if (arr != NULL) { contdrw = new PIContourDrawer(arr,true ); }else{ cout <<"contour ERREUR : OBJET "<CalcContour(); //NTuple *out = contdrw->MyIso(); //NTuple *truc = new NTuple(*out); //string nom = "isoc"; //if(out!=NULL) omg.AddObj(truc,nom ); cout << " ===>>> success ! "<< contdrw <DispScDrawer(contdrw, name, dopt); cout << " fin de ContModExecutor::Execute() "<< endl; // Ne pas oublier d'associer le wrsid a l'objet si on utilise le P2DArrayAdapter* arr omg.AddWRsId(tokens[0], wrsid); } if ( kw == "ntcont"){ NamedObjMgr omg; PIContourDrawer * contdrw = NULL; string dopt=""; bool adel; //cout << " essai avec ntuple "<GetNTupleInterface(adel); //cout << " tokens.size() "<< tokens.size()< 4) dopt = tokens[4]; if (tokens.size() > 6){ dz = atof(tokens[6].c_str()); z0 = atof(tokens[7].c_str()); cout << " ContModExecutor::Execute [NT] nz,z,dz : "< 5){ nz = atoi(tokens[5].c_str()); cout << " ContModExecutor::Execute [NT] nz : "<CalcContour(); NTuple *out = contdrw->MyIso(); if(out!=NULL){ NTuple *truc = new NTuple(*out); string nom = "isoc"; //truc->Write("isocur.ppf"); //out->Write("outcur.ppf"); omg.AddObj(truc,nom ); } /****************/ cout << " ===>>> success ! "<DispScDrawer(contdrw, name, dopt); // Ne pas oublier d'associer le wrsid a l'objet si on utilise le P2DArrayAdapter* arr omg.AddWRsId(tokens[0], wrsid); } return(0); }