Changeset 1882 in Sophya


Ignore:
Timestamp:
Jan 21, 2002, 11:05:32 PM (24 years ago)
Author:
ansari
Message:

Suite de modifs pour affichage de DeltaX,Y par rapport a un point de reference - Reza 21/01/2002

Location:
trunk/SophyaPI/PI
Files:
2 edited

Legend:

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

    r1879 r1882  
    8282  mFgDeltaPos = false;
    8383  mPosForDelta[0] = mPosForDelta[1] = 0.;
    84   mPosForDeltaX = mPosForDeltaY = 0;
     84  mPosFDX = mPosFDY = 0;
    8585
    8686  mBDrw = new PIElDrawer;
     
    186186  mFormatOpt[0] = SetFormatOpt(xmin,xmax);
    187187  mFormatOpt[1] = SetFormatOpt(ymin,ymax);
     188  UpdatePosForDeltaMarker(false, true);
    188189}
    189190 
     
    320321PIScDrawWdg::But1Press(int x, int y)
    321322{
    322   int pos = (x>XSize()/2) ? PI_HorizontalRight: PI_HorizontalLeft;
    323323  UpdateText(x, y);
    324324  if (mTrW)
     
    331331    mTrW->Show();
    332332    }
    333   if (mFgReticule) { // On trace une reticule
     333  if (mFgReticule || mFgDeltaPos) { // On trace une reticule
    334334    cForCol = mWGrC->GetForeground();
    335335    cGOmod  = mWGrC->GetGOMode();
     
    338338    mWGrC->SelGOMode(PI_GOXOR);
    339339    mWGrC->SelLine(PI_ThinLine);
    340     mWGrC->DrawLine(x, 0, x, YSize());
    341     mWGrC->DrawLine(0, y, XSize(), y);
    342     mCPosX = x;   mCPosY = y;
    343     char buff[128];
    344     string format1 = "X= "; format1 += mFormatOpt[0].c_str();
    345     string format2 = "Y= "; format2 += mFormatOpt[1].c_str();
    346     sprintf(buff,format1.c_str(), mPPos[0], pos);
    347     mWGrC->DrawString(x+10, y-10, buff);
    348     sprintf(buff,format2.c_str(), mPPos[1], pos);
    349     mWGrC->DrawString(x+10, y+20, buff);
    350     }
     340  }
     341  if (mFgReticule)  DrawReticule(x,y,0);
    351342  else SelPointerShape(PI_CrossPointer);
     343  if (mFgDeltaPos)  DrawDeltaPosMarker();
    352344
    353345  Send(Msg(), PIMsg_Active);
     
    359351PIScDrawWdg::Ptr1Move(int x, int y)
    360352{
    361   int pos = (x>XSize()/2) ? PI_HorizontalRight: PI_HorizontalLeft;
    362   char buff[128];
    363   string format1 = "X= "; format1 += mFormatOpt[0].c_str();
    364   string format2 = "Y= "; format2 += mFormatOpt[1].c_str();
    365   if (mFgReticule) { // On trace une reticule
    366     mWGrC->DrawLine(mCPosX, 0, mCPosX, YSize());
    367     mWGrC->DrawLine(0, mCPosY, XSize(), mCPosY);
    368     sprintf(buff,format1.c_str(), mPPos[0]);
    369     mWGrC->DrawString(mCPosX+10, mCPosY-10, buff, pos);
    370     sprintf(buff,format2.c_str(), mPPos[1]);
    371     mWGrC->DrawString(mCPosX+10, mCPosY+20, buff, pos);
    372     mWGrC->DrawLine(x, 0, x, YSize());
    373     mWGrC->DrawLine(0, y, XSize(), y);
    374     mCPosX = x;   mCPosY = y;
    375     } 
    376353  UpdateText(x, y);  // Met a jour mPPos
    377   if (mFgReticule) {
    378     sprintf(buff,format1.c_str(), mPPos[0]);
    379     mWGrC->DrawString(mCPosX+10, mCPosY-10, buff, pos);
    380     sprintf(buff,format2.c_str(), mPPos[1]);
    381     mWGrC->DrawString(mCPosX+10, mCPosY+20, buff, pos);
    382     }
     354  if (mFgReticule)  DrawReticule(x,y,1);
    383355}
    384356
     
    386358PIScDrawWdg::But1Release(int x, int y)
    387359{
    388   int pos = (x>XSize()/2) ? PI_HorizontalRight: PI_HorizontalLeft;
    389360  UpdateText(x, y);
    390   if (mFgReticule) { // On efface la reticule
    391     mWGrC->DrawLine(mCPosX, 0, mCPosX, YSize());
    392     mWGrC->DrawLine(0, mCPosY, XSize(), mCPosY);
    393     char buff[128];
    394     string format1 = "X= "; format1 += mFormatOpt[0].c_str();
    395     string format2 = "Y= "; format2 += mFormatOpt[1].c_str();
    396     sprintf(buff,format1.c_str(), mPPos[0]);
    397     mWGrC->DrawString(mCPosX+10, mCPosY-10, buff, pos);
    398     sprintf(buff,format2.c_str(), mPPos[1]);
    399     mWGrC->DrawString(mCPosX+10, mCPosY+20, buff, pos);
    400     mWGrC->SelForeground(cForCol);
    401     mWGrC->SelGOMode(cGOmod);
    402     mWGrC->SelLine(cLatt);
    403     mCPosX = mCPosY = 0;
    404     }
     361  if (mFgReticule)  DrawReticule(x,y,2);
    405362  else SelPointerShape(PI_ArrowPointer);
     363  if (mFgDeltaPos)  DrawDeltaPosMarker();
    406364  if (mTrW)  mTrW->Hide();
    407365}
     
    410368PIScDrawWdg::UpdateText(int xp, int yp)
    411369{
    412 
    413370  double dx, dy;
    414371  mBDrw->GetGraphicUC()->GrC2UC(xp, yp, dx, dy);
     
    427384
    428385void
    429 PIScDrawWdg::UpdatePosForDeltaMarker(bool fg)
    430 {
    431   if (!mFgDeltaPos && !fg ) return;
    432   cForCol = mWGrC->GetForeground();
    433   cGOmod  = mWGrC->GetGOMode();
    434   cLatt = mWGrC->GetLineAtt();
    435   mWGrC->SelForeground(PI_Magenta);
    436   mWGrC->SelGOMode(PI_GOXOR);
    437   mWGrC->SelLine(PI_NormalLine);
    438   if (mFgDeltaPos) {
    439     mWGrC->DrawLine(mPosForDeltaX-7, mPosForDeltaY, mPosForDeltaX+7, mPosForDeltaY);
    440     mWGrC->DrawLine(mPosForDeltaX, mPosForDeltaY-7, mPosForDeltaX, mPosForDeltaY+7);
    441   }
    442   mFgDeltaPos = fg;
     386PIScDrawWdg::UpdatePosForDeltaMarker(bool fg, bool fgupd)
     387{
     388  if (!fgupd)   mFgDeltaPos = fg;
    443389  if (mFgDeltaPos) {
    444390    mPosForDelta[0] = mPPos[0]; 
    445391    mPosForDelta[1] = mPPos[1]; 
    446     mPosForDeltaX = mCPosX;
    447     mPosForDeltaY = mCPosY;
    448     mWGrC->DrawLine(mPosForDeltaX-7, mPosForDeltaY, mPosForDeltaX+7, mPosForDeltaY);
    449     mWGrC->DrawLine(mPosForDeltaX, mPosForDeltaY-7, mPosForDeltaX, mPosForDeltaY+7);
    450   }
    451   mWGrC->SelForeground(cForCol);
    452   mWGrC->SelGOMode(cGOmod);
    453   mWGrC->SelLine(cLatt);
     392    double pfdx, pfdy;
     393    mBDrw->GetGraphicUC()->UC2GrC(mPosForDelta[0], mPosForDelta[1],
     394                                 pfdx, pfdy);
     395    mPosFDX = (int)pfdx;  mPosFDY = (int)pfdy;
     396  }
    454397  return;
    455398}
    456399
     400
     401void
     402PIScDrawWdg::DrawReticule(int x, int y, int op)
     403{
     404  if (!mFgReticule) return;
     405  //  int pos = (x>XSize()/2) ? PI_HorizontalRight: PI_HorizontalLeft;
     406  //  char buff[128];
     407  //  string format1 = "X= "; format1 += mFormatOpt[0].c_str();
     408  //  string format2 = "Y= "; format2 += mFormatOpt[1].c_str();
     409  if (op > 0) { // on efface le precedent
     410    mWGrC->DrawLine(mCPosX, 0, mCPosX, YSize());
     411    mWGrC->DrawLine(0, mCPosY, XSize(), mCPosY);
     412    //    sprintf(buff,format1.c_str(), mPPos[0]);
     413    //    mWGrC->DrawString(mCPosX+10, mCPosY-10, buff, pos);
     414    //    sprintf(buff,format2.c_str(), mPPos[1]);
     415    //    mWGrC->DrawString(mCPosX+10, mCPosY+20, buff, pos);
     416  }
     417  if (op < 2) {
     418    mWGrC->DrawLine(x, 0, x, YSize());
     419    mWGrC->DrawLine(0, y, XSize(), y);
     420    mCPosX = x;   mCPosY = y;
     421  } 
     422}
     423
     424void
     425PIScDrawWdg::DrawDeltaPosMarker()
     426{
     427  if (mFgDeltaPos) {
     428    mWGrC->DrawLine(mPosFDX-14., mPosFDY, mPosFDX+14, mPosFDY);
     429    mWGrC->DrawLine(mPosFDX, mPosFDY-14, mPosFDX, mPosFDY+14);
     430  } 
     431}
    457432
    458433// .............................
  • trunk/SophyaPI/PI/piscdrawwdg.h

    r1879 r1882  
    9090  double mPPos[2];        // Position courante (user coordinates)
    9191  double mPSz[2];         // Taille courant du pave info
    92   int mCPosX, mCPosY;     // Position click souris X,Y
     92  int mCPosX, mCPosY;     // Position click souris X,Y (pour trace de reticule)
    9393  bool mFgDeltaPos;       // affichage de l'ecart par rapport a la position memorisee
    9494  double mPosForDelta[2];     // Position memorisee - Pour affichage d'ecart
    95   int mPosForDeltaX, mPosForDeltaY; // Position click memorisee - Pour affichage d'ecart
     95  int mPosFDX, mPosFDY;       // Position (coord fenetre memorise)
    9696  bool mFgReticule;       // Controle l'affiche d'une réticule (Bouton-1)
    9797  string mFormatOpt[2];   // Format optimal d'impression des textes
     
    115115private:
    116116  void  UpdateText(int xp, int yp);
    117   void  UpdatePosForDeltaMarker(bool fg);
     117  void  UpdatePosForDeltaMarker(bool fg, bool fgupd=false);
     118  void  DrawReticule(int x, int y, int op);
     119  void  DrawDeltaPosMarker();
    118120};
    119121
Note: See TracChangeset for help on using the changeset viewer.