Changeset 2546 in Sophya for trunk/SophyaPI
- Timestamp:
- Jun 2, 2004, 3:22:07 PM (21 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/pi3ddrw.cc
r2544 r2546 262 262 } 263 263 264 /* --Methode-- */ 265 int PIDrawer3D::DecodeOptionString(vector<string> & opt, bool rmdecopt) 266 { 267 int optsz1 = opt.size(); 268 if(optsz1<1) return(0); 269 // On appelle d'abord le decodage de la classe PIDrawer de laquelle 270 // on herite. (Pas obligatoire) on decode donc ici les attributs de 271 // couleur, fontes ... 272 int ndec1 = PIDrawer::DecodeOptionString(opt, rmdecopt); 273 if(optsz1-ndec1<1) return(ndec1); // si tout a ete decode 274 275 vector<string> udopt; // On gardera ici les options non decodees 276 unsigned int k = 0; 277 int ndec = opt.size(); 278 for( k=0; k<opt.size(); k++ ) { 279 string opts = opt[k]; 280 if ( (opts == "rescale") || (opts == "autoscale") ) aScxy = aScz = true; 281 else if ( (opts == "norescale") || (opts == "noautoscale") ) aScxy = aScz = false; 282 else if ( (opts == "rescalexy") || (opts == "autoscalexy") ) aScxy = true; 283 else if ( (opts == "norescalexy") || (opts == "noautoscalexy") ) aScxy = false; 284 else if ( (opts == "rescalez") || (opts == "autoscalez") ) aScz = true; 285 else if ( (opts == "norescalez") || (opts == "noautoscalez") ) aScz = false; 286 else { 287 // Si option non decode 288 ndec--; 289 // S'il faut supprimer les options decodees 290 if (rmdecopt) udopt.push_back(opts); 291 } 292 } 293 // S'il faut supprimer les options decodees, on remplace l'argument opt 294 // par le vecteur des options non decodees. 295 if (rmdecopt) opt = udopt; 296 return(ndec+ndec1); 297 } 298 299 /* --Methode-- */ 300 int PIDrawer3D::OptionToString(vector<string> & opt) const 301 { 302 PIDrawer::OptionToString(opt); 303 if ( aScxy || aScz ) opt.push_back("autoscale"); 304 else if (!aScxy && !aScz ) opt.push_back("noautoscale"); 305 else { 306 if(aScxy) opt.push_back("autoscalexy"); else opt.push_back("noautoscalexy"); 307 if(aScz) opt.push_back("autoscalez"); else opt.push_back("noautoscalez"); 308 } 309 return 1; 310 } 311 312 /* --Methode-- */ 313 void PIDrawer3D::GetOptionsHelpInfo(string& info) 314 { 315 info += " ---- PIDrawer3D options help info : \n" ; 316 info += " X/Y,Z axis rescaling option (-> cubic 3D box) \n"; 317 info += " rescale=autoscale/ norescale=noautoscale : X/Y and Z axis \n"; 318 info += " rescalexy=autoscalexy / norescalexy=noautoscalexy : X/Y axis \n"; 319 info += " rescalexy=autoscalexy / norescalexy=noautoscalexy : Z axis \n"; 320 info += " --- + Usual color/line/marker/... attribute decoding \n"; 321 // On recupere ensuite la chaine info de la classe de base 322 PIDrawer::GetOptionsHelpInfo(info); 323 return; 324 } 325 264 326 /* -------------------------------------------------------------- */ 265 327 /* ------------------- Classe PIElDrawer3D ------------------------ */ … … 319 381 int nopt0 = opt.size(); 320 382 if (nopt0 < 1) return(0); 321 int ndec1 = PIDrawer ::DecodeOptionString(opt, rmdecopt);383 int ndec1 = PIDrawer3D::DecodeOptionString(opt, rmdecopt); 322 384 if ((nopt0 - ndec1) < 1) return(ndec1); // si tout a ete decode 323 385 vector<string> udopt; -
trunk/SophyaPI/PI/pi3ddrw.h
r2544 r2546 51 51 double zz1, double zz2, double xl1, double xl2, 52 52 double yl1, double yl2, double zl1, double zl2); 53 // Methode de decodage des options 54 virtual int DecodeOptionString(vector<string> & opt, bool rmdecopt=true); 55 virtual int OptionToString(vector<string> & opt) const; 56 // Texte d'aide des options disponibles 57 virtual void GetOptionsHelpInfo(string& info); 53 58 54 59 // Cordonnees du cube 3D -
trunk/SophyaPI/PI/pi3dwdg.cc
r2544 r2546 41 41 // * <Alt>E : Supprime le dernier élément graphique ajouté. 42 42 // * <Alt>A : Active/desactive l'affichage des axes 43 // * <Alt>R : Reinitialise la vue 3D (vue par défaut) et rafraichit le dessin. 43 // * <Alt>U : Reinitialise la vue 3D (vue par défaut) et rafraichit le dessin. 44 // * <Alt>R : Rafraichit le dessin du widget. 44 45 // * <Alt>S : Active/desactive le mode de rotation d'objet sans Shift 45 46 // … … 169 170 double D = xmax-xmin; 170 171 if (D < (ymax-ymin)) D = ymax-ymin; 172 if (D < (zmax-zmin)) D = zmax-zmin; 171 173 D *= 1.4; 172 174 Set3DView((xmin+xmax)/2., (ymin+ymax)/2, zmin+(zmax-zmin)*0.40, … … 181 183 #if defined(CC_HAS_RTTI_SUPPORT) 182 184 while ( (it != m3DrIl.end()) && 183 (dynamic_cast<PIDrawer3D*>(GetDrawerId(*it)) != mBDrw) ) it++;185 (dynamic_cast<PIDrawer3D*>(GetDrawerId(*it)) == mBDrw) ) it++; 184 186 if (it == m3DrIl.end()) return; 185 187 PIDrawer3D* dr3 = dynamic_cast<PIDrawer3D*>(GetDrawerId(*it)); 186 188 #else 187 189 while ( (it != m3DrIl.end()) && 188 ( (PIDrawer3D*)(GetDrawerId(*it)) != mBDrw) ) it++;190 ( (PIDrawer3D*)(GetDrawerId(*it)) == mBDrw) ) it++; 189 191 PIDrawer3D* dr3 = (PIDrawer3D*)(GetDrawerId(*it)); 190 192 #endif … … 210 212 int PIDraw3DWdg::DecodeOptionString(vector<string> & opt, bool rmdecopt) 211 213 { 212 // AFAIRE - Reza 01/03/2002 213 return(0); 214 if (opt.size() == 0) return(0); 215 216 vector<string> udopt; 217 unsigned int k = 0; 218 int ndec = opt.size(); 219 bool fg3db = false; 220 221 double xmin = mBDrw->ScaleX( mBDrw->XMin3() ); 222 double xmax = mBDrw->ScaleX( mBDrw->XMax3() ); 223 double ymin = mBDrw->ScaleY( mBDrw->YMin3() ); 224 double ymax = mBDrw->ScaleY( mBDrw->YMax3() ); 225 double zmin = mBDrw->ScaleY( mBDrw->ZMin3() ); 226 double zmax = mBDrw->ScaleY( mBDrw->ZMax3() ); 227 bool asxy = mBDrw->isAutoScaleXY(); 228 bool asz = mBDrw->isAutoScaleZ(); 229 230 for( k=0; k<opt.size(); k++ ) { 231 string opts = opt[k]; 232 // Limites en x,y 233 if (opts.substr(0,10) == "xyzlimits=") { 234 sscanf(opts.substr(10).c_str(),"%lg,%lg,%lg,%lg,%lg,%lg", 235 &xmin, &xmax, &ymin, &ymax, &zmin, &zmax); 236 fg3db = true; 237 continue; 238 } 239 if (opts.substr(0,9) == "lim3dbox=") { 240 sscanf(opts.substr(9).c_str(),"%lg,%lg,%lg,%lg,%lg,%lg", 241 &xmin, &xmax, &ymin, &ymax, &zmin, &zmax); 242 fg3db = true; 243 continue; 244 } 245 if (opts == "autoscale3dbox") { 246 asxy = asz = true; 247 fg3db = true; 248 continue; 249 } 250 if (opts == "noautoscale3dbox") { 251 asxy = asz = false; 252 fg3db = true; 253 continue; 254 } 255 if (opts == "autoscalexy3dbox") { 256 asxy = true; 257 fg3db = true; 258 continue; 259 } 260 if (opts == "noautoscalexy3dbox") { 261 asxy = false; 262 fg3db = true; 263 continue; 264 } 265 if (opts == "autoscalez3dbox") { 266 asz = true; 267 fg3db = true; 268 continue; 269 } 270 if (opts == "noautoscalez3dbox") { 271 asz = false; 272 fg3db = true; 273 continue; 274 } 275 // Option non decode 276 ndec--; 277 if (rmdecopt) udopt.push_back(opts); 278 } 279 280 if (fg3db) Set3DViewBox(xmin,xmax,ymin,ymax,zmin,zmax,asxy,asz); 281 282 if (rmdecopt) opt = udopt; 283 return(ndec); 214 284 } 215 285 … … 313 383 else if (key == 'S' || key == 's') skcfg = !skcfg; 314 384 else if (key == 'R' || key == 'r') Refresh(); 315 else if (key == ' B' || key == 'b') Update3DView();385 else if (key == 'U' || key == 'u') Update3DView(); 316 386 } 317 387 } -
trunk/SophyaPI/PI/pisurfdr.cc
r2544 r2546 160 160 161 161 double dx,dy; // taille du bin 162 dx = (mXmax-mXmin)*mScx/xsz;163 dy = (mYmax-mYmin)*mScy/ysz;162 dx = ScaleX(mXmax-mXmin)/xsz; 163 dy = ScaleY(mYmax-mYmin)/ysz; 164 164 165 165 int i1,j1; … … 172 172 ijzp[k].ij = j*xsz+i; 173 173 mArr->XYfromxy(i,j,x,y); 174 x *= mScx; x += dx/2.;175 y *= mScy; y += dy/2.;174 x = ScaleX(x); x += dx/2.; 175 y = ScaleY(y); y += dy/2.; 176 176 ijzp[k].zh = mArr->Value(i,j); 177 z = ijzp[k].zh * mScz;177 z = ScaleZ(ijzp[k].zh); 178 178 g3->C3DC2ObsCS(x,y,z,xp,yp,zp); 179 179 ijzp[k].dp = zp; … … 185 185 j1 = (j>0) ? j-1 : 0; 186 186 z = mArr->Value(i,j) + mArr->Value(i1,j) + mArr->Value(i1,j1) + mArr->Value(i,j1); 187 z = z/4.*mScz;187 z = ScaleZ(z/4.); 188 188 // g3->Proj3DC2GrC(x,y,z, xw[j*(xsz+1)+i], yw[j*(xsz+1)+i]); 189 189 xw[j*(xsz+1)+i] = x; yw[j*(xsz+1)+i] = y; zw[j*(xsz+1)+i] = z; … … 193 193 for(i=0; i<xsz; i++) { 194 194 mArr->XYfromxy(i,j-1,x,y); 195 x *= mScx;196 y *= mScy; y += dy;195 x = ScaleX(x); 196 y = ScaleY(y); y += dy; 197 197 i1 = (i>0) ? i-1 : 0; 198 198 j1 = j-1; 199 199 z = mArr->Value(i,j-1) + mArr->Value(i1,j-1) + mArr->Value(i1,j1) + mArr->Value(i,j1); 200 z = z/4.*mScz;200 z = ScaleZ(z/4.); 201 201 // g3->Proj3DC2GrC(x,y,z, xw[j*(xsz+1)+i], yw[j*(xsz+1)+i]); 202 202 xw[j*(xsz+1)+i] = x; yw[j*(xsz+1)+i] = y; zw[j*(xsz+1)+i] = z; … … 205 205 for(j=0; j<ysz; j++) { 206 206 mArr->XYfromxy(i-1,j,x,y); 207 x *= mScx; x += dx;208 y *= mScy;207 x = ScaleX(x); x += dx; 208 y = ScaleY(y); 209 209 i1 = i-1; 210 210 j1 = (j>0) ? j-1 : 0; 211 211 z = mArr->Value(i-1,j) + mArr->Value(i1,j) + mArr->Value(i1,j1) + mArr->Value(i-1,j1); 212 z = z/4.*mScz;212 z = ScaleZ(z/4.); 213 213 // g3->Proj3DC2GrC(x,y,z, xw[j*(xsz+1)+i], yw[j*(xsz+1)+i]); 214 214 xw[j*(xsz+1)+i] = x; yw[j*(xsz+1)+i] = y; zw[j*(xsz+1)+i] = z; … … 217 217 mArr->XYfromxy(i-1,j-1,x,y); 218 218 i1 = i-1; j1 = j-1; 219 x *= mScx; x += dx;220 y *= mScy; y += dy;219 x = ScaleX(x); x += dx; 220 y = ScaleY(y); y += dy; 221 221 z = mArr->Value(i-1,j-1) + mArr->Value(i1,j-1) + mArr->Value(i1,j1) + mArr->Value(i-1,j1); 222 z = z/4.*mScz;222 z = ScaleZ(z/4.); 223 223 // g3->Proj3DC2GrC(x,y,z, xw[j*(xsz+1)+i], yw[j*(xsz+1)+i]); 224 224 xw[j*(xsz+1)+i] = x; yw[j*(xsz+1)+i] = y; zw[j*(xsz+1)+i] = z; … … 291 291 } 292 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 laquelle299 // on herite. (Pas obligatoire) on decode donc ici les attributs de300 // couleur, fontes ...301 int ndec1 = PIDrawer::DecodeOptionString(opt, rmdecopt);302 if(optsz1-ndec1<1) return(ndec1); // si tout a ete decode303 304 vector<string> udopt; // On gardera ici les options non decodees305 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") aScxy = true;310 else if (opts == "norescalexy") aScxy = false;311 else if (opts == "rescalez") aScz = true;312 else if (opts == "norescalez") aScz = false;313 else {314 // Si option non decode315 ndec--;316 // S'il faut supprimer les options decodees317 if (rmdecopt) udopt.push_back(opts);318 }319 }320 // S'il faut supprimer les options decodees, on remplace l'argument opt321 // par le vecteur des options non decodees.322 if (rmdecopt) opt = udopt;323 return(ndec+ndec1);324 }325 326 /* --Methode-- */327 int PISurfaceDrawer::OptionToString(vector<string> & opt) const328 {329 PIDrawer::OptionToString(opt);330 331 if(aScxy) opt.push_back("rescalexy"); else opt.push_back("norescalexy");332 if(aScz) opt.push_back("rescalez"); else opt.push_back("norescalez");333 334 return 1;335 }336 337 /* --Methode-- */338 void PISurfaceDrawer::GetOptionsHelpInfo(string& info)339 {340 info += " ---- PISurfaceDrawer options help info : \n" ;341 info += " rescalexy / norescalexy rescalez / norescalez \n";342 info += " and usual color/line/marker/... attribute decoding \n";343 // On recupere ensuite la chaine info de la classe de base344 PIDrawer::GetOptionsHelpInfo(info);345 return;346 } -
trunk/SophyaPI/PI/pisurfdr.h
r2544 r2546 18 18 19 19 virtual void Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax); 20 21 /* --- Juin 2004 : decodage des options mis ds PIDrawer3D 20 22 // Methode de decodage des options 21 23 virtual int DecodeOptionString(vector<string> & opt, bool rmdecopt=true); … … 23 25 // Texte d'aide des options disponibles 24 26 virtual void GetOptionsHelpInfo(string& info); 27 --------- */ 25 28 26 29 protected :
Note:
See TracChangeset
for help on using the changeset viewer.