Changeset 2399 in Sophya
- Timestamp:
- Jun 6, 2003, 4:57:47 PM (22 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/pi3ddrw.cc
r2260 r2399 46 46 // double& teta, double& phi, double& psi, double& dax, double& day, double& co, double& dco) 47 47 // Renvoie la définition de la Vue-3D. Retourne "true " si définie par "Set3DView_Obs()" 48 // void Set3DBox(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) 48 // void Set3DBox(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, - 49 // double scx=1., double scy=1., double scz=1.) 49 50 // Définition de la boite 3D. 51 // void ComputeScaleFactor(double xmin, double xmax, double ymin, double ymax, 52 // double zmin, double zmax, bool asxy, bool asz, 53 // double& scy, double& scz) 54 // Calcul des facteurs d'echelles scy, scz 55 // Si asxy == true : Application d'un facteur d'échelle pour égaliser 56 // le rapport d'aspect des deux axes X et Y 57 // Si asz == true : Application d'un facteur d'échelle pour égaliser 58 // le rapport d'aspect de l'axe Z par rapport a XY. 50 59 // 51 60 // void Draw3DBoxe(PIGraphic3D* g3, double xx1, double xx2, double yy1, double yy2, - … … 108 117 /* --Methode-- */ 109 118 void PIDrawer3D::Set3DBox(double xmin, double xmax, double ymin, double ymax, 110 double zmin, double zmax )119 double zmin, double zmax, double scx, double scy, double scz) 111 120 { 112 121 x3Min = xmin; x3Max = xmax; 113 122 y3Min = ymin; y3Max = ymax; 114 123 z3Min = zmin; z3Max = zmax; 124 mScx = scx; mScy = scy; mScz = scz; 125 } 126 127 /* --Methode-- */ 128 void PIDrawer3D::ComputeScaleFactor(double xmin, double xmax, double ymin, double ymax, 129 double zmin, double zmax, bool asxy, bool asz, 130 double& scy, double& scz) 131 { 132 scy = scz = 1.; 133 if (!asxy && !asz) return; 134 double scm=1.; 135 if ((ymax-ymin) <= 1.e-19) ymax = ymin + 1.e-19; 136 if (asxy) { 137 scy = (xmax-xmin)/(ymax-ymin); 138 scm = xmax-xmin; 139 } 140 else scm = ((xmax-xmin) > (ymax-ymin)) ? (xmax-xmin) : (ymax-ymin); 141 if ((zmax-zmin) <= 1.e-19) zmax = zmin + 1.e-19; 142 if (asz) scz = scm/(zmax-zmin); 143 115 144 } 116 145 … … 141 170 #endif 142 171 Draw3DBoxe(g3, XMin3(), XMax3(), YMin3(), YMax3(), ZMin3(), ZMax3(), 143 XMin3(), XMax3(), YMin3(), YMax3(), ZMin3(), ZMax3()); 172 XMin3()/mScx, XMax3()/mScx, YMin3()/mScy, YMax3()/mScy, 173 ZMin3()/mScz, ZMax3()/mScz); 144 174 } 145 175 -
trunk/SophyaPI/PI/pi3ddrw.h
r2262 r2399 30 30 31 31 virtual void Set3DBox(double xmin, double xmax, double ymin, double ymax, 32 double zmin, double zmax); 32 double zmin, double zmax, 33 double scx=1., double scy=1., double scz=1.); 34 inline void Copy3DBox(PIDrawer3D& dr3) { 35 Set3DBox(dr3.XMin3(), dr3.XMax3(), dr3.YMin3(), dr3.YMax3(), 36 dr3.ZMin3(), dr3.ZMax3(), dr3.ScaleX(), dr3.ScaleY(), dr3.ScaleZ()); } 37 38 virtual void ComputeScaleFactor(double xmin, double xmax, double ymin, double ymax, 39 double zmin, double zmax, bool asxy, bool asz, 40 double& scy, double& scz); 33 41 34 42 virtual PIGraphicUC* SetDrwWdg(PIBaseWdgGen* drw, int x0, int y0, int dx, int dy, PIGraphicGen* g); … … 39 47 double yl1, double yl2, double zl1, double zl2); 40 48 49 // Cordonnees du cube 3D 41 50 double XMin3() const {return x3Min;} 42 51 double XMax3() const {return x3Max;} … … 45 54 double ZMin3() const {return z3Min;} 46 55 double ZMax3() const {return z3Max;} 56 // Facteur d'echelle: Cube3D = Coord.User(3D)*Scale 57 double ScaleX() const {return mScx;} 58 double ScaleY() const {return mScy;} 59 double ScaleZ() const {return mScz;} 47 60 48 61 protected : … … 56 69 double y3Min, y3Max; // Pour delimiter le cube 3D 57 70 double z3Min, z3Max; // Pour delimiter le cube 3D 71 double mScx, mScy, mScz; // Facteur d'echelle entre coord. utilise et cube 3D 72 // x/y/z-Cube3D = x/y/z-User * mScx/y/z 58 73 }; 59 74 -
trunk/SophyaPI/PI/pi3dwdg.cc
r2262 r2399 70 70 { 71 71 vfixed = false; 72 // On cree l'objet PIGraphic3D pour la gestion des vues 3D 73 mGr3d = new PIGraphic3D(mWGrC, 0, 0, sx, sy); 74 72 75 // SetDefaultDrawRectangle(0.12, 0.12, 0.88, 0.88, true); 73 76 SetDefaultDrawRectangle(0., 0., 1., 1., true); 74 77 mBDrw = new PIElDrawer3D; 75 mBDrw->SetLimits(0.12,0.88, 0.12,0.88, kAxeDirLtoR,kAxeDirDownUp); 76 AddDrawer(mBDrw, 0.12, 0.12, 0.88, 0.88, true, false, false); 78 // mBDrw->SetLimits(0.12,0.88, 0.12,0.88, kAxeDirLtoR,kAxeDirDownUp); 79 // AddDrawer(mBDrw, 0.12, 0.12, 0.88, 0.88, true, false, false); 80 mBDrw->SetLimits(0.,1.,0.,1.,kAxeDirLtoR,kAxeDirDownUp); 81 AddDrawer3D(mBDrw, false); 82 mBDrw->SetAxesFlags(kStdAxes); 83 vfixed = false; // Il faut laisser le premier Drawer3D fixer les limites et la vue 3D 84 77 85 mPx = mPy = 0; 78 86 … … 88 96 ActivateButton(1); 89 97 90 mGr3d = new PIGraphic3D(mWGrC, 0, 0, sx, sy);91 98 rOfg = false; 92 99 axfg = true; … … 143 150 { 144 151 list<int>::iterator it = m3DrIl.begin(); 152 #if defined(CC_HAS_RTTI_SUPPORT) 153 while ( (it != m3DrIl.end()) && 154 (dynamic_cast<PIDrawer3D*>(GetDrawerId(*it)) != mBDrw) ) it++; 145 155 if (it == m3DrIl.end()) return; 146 #if defined(CC_HAS_RTTI_SUPPORT)147 156 PIDrawer3D* dr3 = dynamic_cast<PIDrawer3D*>(GetDrawerId(*it)); 148 157 #else 158 while ( (it != m3DrIl.end()) && 159 ( (PIDrawer3D*)(GetDrawerId(*it)) != mBDrw) ) it++; 149 160 PIDrawer3D* dr3 = (PIDrawer3D*)(GetDrawerId(*it)); 150 161 #endif … … 156 167 if (vobs) Set3DView_Obs(xo, yo, zo, teta, phi, psi, dax, day, co, dco); 157 168 else Set3DView(xc, yc, zc, xo, yo, zo, dax, day, dco, psi); 169 mBDrw->Copy3DBox(*dr3); 158 170 Refresh(); 159 171 } … … 194 206 int PIDraw3DWdg::AddDrawer3D(PIDrawer3D* dr3, bool ad) 195 207 { 196 if ( !vfixed) {208 if ((!vfixed) && (dr3 != mBDrw)) { 197 209 dr3->UpdateLimits(); 198 210 double xo, yo, zo, xc, yc, zc, teta, phi, psi, dax, day, co, dco; … … 201 213 if (vobs) Set3DView_Obs(xo, yo, zo, teta, phi, psi, dax, day, co, dco); 202 214 else Set3DView(xc, yc, zc, xo, yo, zo, dax, day, dco, psi); 215 mBDrw->Copy3DBox(*dr3); 203 216 } 204 217 else { … … 209 222 } 210 223 int id = AddDrawer(dr3, false, false, ad); 211 if (m3DrIl.size() == 0) dr3->SetAxesFlags(kStdAxes); 212 else dr3->SetAxesFlags(kAxesNone); 224 if (dr3 != mBDrw) dr3->SetAxesFlags(kAxesNone); 213 225 m3DrIl.push_back(id); 214 226 return(id); … … 248 260 axfg = !axfg; 249 261 list<int>::iterator it; 250 if (axfg) 251 for(it = m3DrIl.begin(); it != m3DrIl.end(); it++) 252 GetDrawerId(*it)->SetAxesFlags(kAxesNone); 253 else { 254 it = m3DrIl.begin(); 255 if (it != m3DrIl.end()) GetDrawerId(*it)->SetAxesFlags(kStdAxes); 256 } 262 if (!axfg) mBDrw->SetAxesFlags(kAxesNone); 263 else mBDrw->SetAxesFlags(kStdAxes); 257 264 Refresh(); 258 265 } -
trunk/SophyaPI/PI/pisurfdr.cc
r2164 r2399 45 45 arr->XYfromxy(0,0,mXmin, mYmin); 46 46 arr->XYfromxy(arr->XSize(),arr->YSize(),mXmax, mYmax); 47 double scm=1.; 48 if (asxy) { 49 mScy = (mXmax-mXmin)/(mYmax-mYmin); 50 scm = mXmax-mXmin; 51 } 52 else scm = ((mXmax-mXmin) > (mYmax-mYmin)) ? (mXmax-mXmin) : (mYmax-mYmin); 47 48 mAutoScaleXY = asxy; 49 mAutoScaleZ = asz; 50 53 51 int i,j; double cv; 54 52 mZmin = mZmax = arr->Value(0,0); … … 60 58 } 61 59 if ((mZmax-mZmin) <= 1.e-19) mZmax = mZmin + 1.e-19; 62 if (asz) mScz = scm/(mZmax-mZmin);63 60 // printf("PISurfaceDrawer::PISurfaceDrawer Min/Max: %g,%g %g,%g %g,%g Sc: %g %g %g \n", 64 61 // mXmin, mXmax, mYmin, mYmax, mZmin, mZmax, mScx, mScy, mScz); … … 82 79 { 83 80 if (mArr == NULL) return; 81 ComputeScaleFactor(mXmin, mXmax, mYmin, mYmax, mZmin, mZmax, 82 mAutoScaleXY, mAutoScaleZ, mScy, mScz); 84 83 double xmin, xmax, ymin, ymax, zmin, zmax; 85 84 xmin = mXmin*mScx; xmax = mXmax*mScx; … … 96 95 (xmin+xmax)/2.+D , (ymin+ymax)/2.-2.5*D , zmin+(zmax-zmin)*0.85, 0.25, 0.25); 97 96 98 Set3DBox(xmin, xmax, ymin, ymax, zmin-PERC_GARDE*(zmax-zmin), zmax+PERC_GARDE*(zmax-zmin)); 97 Set3DBox(xmin, xmax, ymin, ymax, zmin-PERC_GARDE*(zmax-zmin), 98 zmax+PERC_GARDE*(zmax-zmin), mScx, mScy, mScz); 99 99 100 100 // printf("PISurfaceDrawer::UpdateLimits() : %g-%g %g-%g %g-%g (%g) \n", xmin,xmax,ymin,ymax,zmin,zmax,D); … … 119 119 } 120 120 121 /* --Methode-- */121 /* --Methode-- 122 122 void PISurfaceDrawer::DrawAxes(PIGraphicUC* g) 123 123 { … … 132 132 mZmin-PERC_GARDE*(mZmax-mZmin),mZmax+PERC_GARDE*(mZmax-mZmin)); 133 133 } 134 */ 134 135 135 136 /* --Methode-- */ … … 289 290 delete[] zw; 290 291 } 292 293 /* --Methode-- */ 294 int PISurfaceDrawer::DecodeOptionString(vector<string> & opt, bool rmdecopt) 295 { 296 int optsz1 = opt.size(); 297 if(optsz1<1) return(0); 298 // On appelle d'abord le decodage de la classe PIDrawer de laquelle 299 // on herite. (Pas obligatoire) on decode donc ici les attributs de 300 // couleur, fontes ... 301 int ndec1 = PIDrawer::DecodeOptionString(opt, rmdecopt); 302 if(optsz1-ndec1<1) return(ndec1); // si tout a ete decode 303 304 vector<string> udopt; // On gardera ici les options non decodees 305 unsigned int k = 0; 306 int ndec = opt.size(); 307 for( k=0; k<opt.size(); k++ ) { 308 string opts = opt[k]; 309 if (opts == "rescalexy") mAutoScaleXY = true; 310 else if (opts == "norescalexy") mAutoScaleXY = false; 311 else if (opts == "rescalez") mAutoScaleZ = true; 312 else if (opts == "norescalez") mAutoScaleZ = false; 313 else { 314 // Si option non decode 315 ndec--; 316 // S'il faut supprimer les options decodees 317 if (rmdecopt) udopt.push_back(opts); 318 } 319 } 320 // S'il faut supprimer les options decodees, on remplace l'argument opt 321 // par le vecteur des options non decodees. 322 if (rmdecopt) opt = udopt; 323 return(ndec+ndec1); 324 } 325 326 /* --Methode-- */ 327 void PISurfaceDrawer::GetOptionsHelpInfo(string& info) 328 { 329 info += " ---- PISurfaceDrawer options help info : \n" ; 330 info += " rescalexy / norescalexy rescalez / norescalez \n"; 331 info += " and usual color/line/marker/... attribute decoding \n"; 332 // On recupere ensuite la chaine info de la classe de base 333 PIDrawer::GetOptionsHelpInfo(info); 334 return; 335 } -
trunk/SophyaPI/PI/pisurfdr.h
r204 r2399 18 18 19 19 virtual void Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax); 20 virtual void DrawAxes(PIGraphicUC* g); 20 // Methode de decodage des options 21 virtual int DecodeOptionString(vector<string> & opt, bool rmdecopt=true); 22 // Texte d'aide des options disponibles 23 virtual void GetOptionsHelpInfo(string& info); 21 24 22 25 protected : 23 26 P2DArrayAdapter* mArr; 24 27 bool mAda; 25 double mScz, mScx, mScy;28 bool mAutoScaleXY, mAutoScaleZ; 26 29 double mXmin, mXmax; 27 30 double mYmin, mYmax;
Note:
See TracChangeset
for help on using the changeset viewer.