Changeset 2544 in Sophya for trunk/SophyaPI/PI/pi3dwdg.cc


Ignore:
Timestamp:
Jun 1, 2004, 5:49:36 PM (21 years ago)
Author:
ansari
Message:

1/ Decodage options pour PIBarGraph et MAJ Makefile suite ajout PITextDrawer
2/ Suite (interruption de plusieurs mois) amelioration gestion des axes
et autoscale X/Y , Z ds les Drawers 3D et PIDraw3DWdg

Reza , 1 Juin 2004

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/pi3dwdg.cc

    r2539 r2544  
    8282  AddDrawer3D(mBDrw, false, true);
    8383  mBDrw->SetAxesFlags(kStdAxes);
     84  Set3DViewBox(0., 1., 0., 1., 0., 1., false, false);
    8485  vfixed = false; // Il faut laisser le premier Drawer3D fixer les limites et la vue 3D
     86  fixed3DBox = false; 
    8587
    8688  mPx = mPy = 0;
     
    150152}
    151153
     154/* --Methode-- */
     155void PIDraw3DWdg::Set3DViewBox(double xmin, double xmax, double ymin, double ymax,
     156                               double zmin, double zmax, bool asxy, bool asz)
     157{
     158  double mscx, mscy, mscz;
     159  PIDrawer3D::ComputeScaleFactor(xmin, xmax, ymin, ymax, zmin, zmax,
     160                                 asxy, asz, mscy, mscz);
     161  mscx = 1.;
     162  xmin *= mscx;  xmax *= mscx;
     163  ymin *= mscy;  ymax *= mscy;
     164  zmin *= mscz;  zmax *= mscz;
     165  mBDrw->Set3DBox(xmin, xmax, ymin, ymax, zmin, zmax, mscx, mscy, mscz);
     166  mBDrw->SetAutoScale(asxy, asz);
     167  fixed3DBox = true;
     168
     169  double D = xmax-xmin;
     170  if (D < (ymax-ymin))  D = ymax-ymin;
     171  D *= 1.4;
     172  Set3DView((xmin+xmax)/2., (ymin+ymax)/2, zmin+(zmax-zmin)*0.40,
     173            (xmin+xmax)/2.+D , (ymin+ymax)/2.-2.5*D , zmin+(zmax-zmin)*0.85, 0.25, 0.25); 
     174   
     175}
    152176
    153177/* --Methode-- */
     
    177201
    178202/* --Methode-- */
     203void PIDraw3DWdg::Refresh()
     204{
     205  SetDrawers3DView();
     206  PIBaseWdg::Refresh();
     207}
     208
     209/* --Methode-- */
    179210int PIDraw3DWdg::DecodeOptionString(vector<string> & opt, bool rmdecopt)
    180211{
     
    194225  list<int>::iterator it;
    195226
     227  for(it = m3DrIl.begin(); it != m3DrIl.end(); it++) {
    196228#if defined(CC_HAS_RTTI_SUPPORT)
    197   if (vo)   for(it = m3DrIl.begin(); it != m3DrIl.end(); it++) 
     229    if (vo)
    198230    (dynamic_cast<PIDrawer3D*>(GetDrawerId(*it)))->Set3DView_Obs(xo, yo, zo, teta, phi, psi, dax, day, co, dco);
    199   else   for(it = m3DrIl.begin(); it != m3DrIl.end(); it++)   
    200     (dynamic_cast<PIDrawer3D*>(GetDrawerId(*it)))->Set3DView(xc, yc, zc, xo, yo, zo, dax, day, dco, psi);   
     231    else   
     232    (dynamic_cast<PIDrawer3D*>(GetDrawerId(*it)))->Set3DView(xc, yc, zc, xo, yo, zo, dax, day, dco, psi); 
     233  (dynamic_cast<PIDrawer3D*>(GetDrawerId(*it)))->Copy3DBox(*mBDrw);
    201234#else
    202   if (vo)   for(it = m3DrIl.begin(); it != m3DrIl.end(); it++)   
     235  if (vo)   
    203236    ((PIDrawer3D*)(GetDrawerId(*it)))->Set3DView_Obs(xo, yo, zo, teta, phi, psi, dax, day, co, dco);
    204   else   for(it = m3DrIl.begin(); it != m3DrIl.end(); it++)   
    205     ((PIDrawer3D*)(GetDrawerId(*it)))->Set3DView(xc, yc, zc, xo, yo, zo, dax, day, dco, psi);   
     237  else 
     238    ((PIDrawer3D*)(GetDrawerId(*it)))->Set3DView(xc, yc, zc, xo, yo, zo, dax, day, dco, psi); 
     239  ((PIDrawer3D*)(GetDrawerId(*it)))->Copy3DBox(*mBDrw);
    206240#endif
     241  }
    207242
    208243}
     
    225260      dr3->Set3DView_Obs(xo, yo, zo, teta, phi, psi, dax, day, co, dco);
    226261  else  dr3->Set3DView(xc, yc, zc, xo, yo, zo, dax, day, co, psi);
     262  dr3->Copy3DBox(*mBDrw);
    227263  }
    228264int id = AddDrawer(dr3, false, false, ad, lock);
     
    276312//  <Alt>S active la sensibilite de la zone centrale pour tourner l'objet
    277313  else if (key == 'S' || key == 's')  skcfg = !skcfg; 
    278   else if (key == 'R' || key == 'r')  Update3DView();
     314  else if (key == 'R' || key == 'r')  Refresh();
     315  else if (key == 'B' || key == 'b')  Update3DView();
    279316  }
    280317}
     
    381418  SelPointerShape(PI_ArrowPointer);
    382419  mWGrC->SelForeground(lCol);
    383   SetDrawers3DView();
    384420  Refresh();
    385421}
Note: See TracChangeset for help on using the changeset viewer.