Ignore:
Timestamp:
07/23/02 11:16:13 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mgui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mgui/MCamDisplay.cc

    r1423 r1426  
    126126    // delete fGeomCam;
    127127
    128     //    if (fIsAllocated)
    129     //        delete fDrawingPad;
     128    if (fDrawingPad->GetListOfPrimitives()->FindObject(this)==this &&
     129        fIsAllocated)
     130    {
     131        fDrawingPad->RecursiveRemove(this);
     132        delete fDrawingPad;
     133    }
    130134}
    131135
  • trunk/MagicSoft/Mars/mgui/MCamDisplay.h

    r1406 r1426  
    5757    ~MCamDisplay();
    5858
    59     virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
    60     //virtual void  ExecuteEvent(Int_t event, Int_t px, Int_t py);
    61 
    6259    void SetAutoScale(Bool_t input=kTRUE) { fAutoScale = input; }
    6360    void DrawPhotNum(const MCerPhotEvt *event);
     
    6562    void DrawPixelNumbers();
    6663
    67     virtual void Reset();
    68     virtual void Draw(Option_t *option="");
    69     virtual void SavePrimitive(ofstream &out, Option_t *);
     64    virtual void  Reset();
     65    virtual void  Draw(Option_t *option="");
     66    virtual void  SavePrimitive(ofstream &out, Option_t *);
     67    virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
     68    //virtual void  ExecuteEvent(Int_t event, Int_t px, Int_t py);
    7069
    7170    void SetPalette(Int_t ncolors, Int_t *colors);
  • trunk/MagicSoft/Mars/mgui/MHexagon.cc

    r1405 r1426  
    121121    const Int_t pyhex = gPad->YtoAbsPixel(fY);
    122122
    123     const Double_t disthex = TMath::Sqrt((Double_t)((pxhex-px)*(pxhex-px) + (pyhex-py)*(pyhex-py)));
     123    const Double_t x = TMath::Abs(px-pxhex);
     124    const Double_t y = TMath::Abs(py-pyhex);
     125
     126    const Double_t disthex = TMath::Sqrt(x*x + y*y);
    124127
    125128    if (disthex==0)
    126129        return 0;
    127130
    128     const Double_t cosa = TMath::Abs(px-pxhex) / disthex;
    129     const Double_t sina = TMath::Abs(py-pyhex) / disthex;
    130 
    131     //
    132     // comput the distance to pixel border
     131    const Double_t cosa = x / disthex;
     132    const Double_t sina = y / disthex;
     133
     134    //
     135    // comput the distance of hexagon center to pixel border
    133136    //
    134137    const Double_t dx = fD * cosa / 2;
    135138    const Double_t dy = fD * sina / 2;
    136139
    137     const Double_t xborder = fX + dx;
    138     const Double_t yborder = fY + dy;
    139 
    140     const Int_t pxborder = gPad->XtoAbsPixel(xborder);
    141     const Int_t pyborder = gPad->YtoAbsPixel(yborder);
    142 
    143     const Double_t distborder = TMath::Sqrt((Double_t)((pxborder-pxhex)*(pxborder-pxhex)+(pyborder-pyhex)*(pyborder-pyhex)));
     140    const Int_t pxborder = gPad->XtoAbsPixel(fX + dx);
     141    const Int_t pyborder = gPad->YtoAbsPixel(fY + dy);
     142
     143    const Double_t bx = pxhex-pxborder;
     144    const Double_t by = pyhex-pyborder;
     145
     146    const Double_t distborder = TMath::Sqrt(bx*bx + by*by);
    144147
    145148    //
     
    147150    //  here in the first implementation is just circle inside
    148151    //
    149     return distborder < disthex ? 999999 : 0;
     152    return distborder < disthex ? (int)(disthex-distborder+1) : 0;
    150153}
    151154
  • trunk/MagicSoft/Mars/mgui/MineSweeper.cc

    r1423 r1426  
    206206        delete fDone;
    207207
    208     //    if (fIsAllocated)
    209     //        delete fDrawingPad;
     208    if (fDrawingPad->GetListOfPrimitives()->FindObject(this)==this)
     209    {
     210        fDrawingPad->RecursiveRemove(this);
     211        delete fDrawingPad;
     212    }
    210213}
    211214
Note: See TracChangeset for help on using the changeset viewer.