source: Sophya/trunk/Poubelle/PIext/pistlist.cc@ 622

Last change on this file since 622 was 223, checked in by ansari, 26 years ago

Creation module DPC/PIext Reza 09/04/99

File size: 2.3 KB
Line 
1#include <stdio.h>
2#include "pistlist.h"
3
4
5/* --Methode-- */
6PIStarList::PIStarList(StarList* stl, bool ad)
7: PIDrawer(), mStL(stl)
8{
9 mAdDO = ad;
10 if (stl == NULL) return;
11 SetFluxLimits(1., -1.);
12}
13
14PIStarList::~PIStarList()
15{
16 if (mAdDO && mStL) delete mStL;
17}
18
19/* --Methode-- */
20void PIStarList::SetFluxLimits(float fmin, float fmax, int nl, bool dispflx, bool refr)
21{
22 if (!mStL) return;
23 if (fmin < fmax) { mFmin = fmin; mFmax = fmax; }
24 else mStL->CalcFluxLimits(mFmin, mFmax);
25 if (mFmin < 1.e-10) mFmin = 1.e-10;
26 if (mFmax <= mFmin) mFmax = 1.5*mFmin;
27 mDLgF = log10((double)mFmax/(double)mFmin);
28 if (mDLgF < 1.e-10) mDLgF = 1.e-10;
29 mF0 = mFmin;
30 if (nl < 1) nl = 1;
31 if (nl > 20) nl = 20;
32 mNLev = nl;
33 mDspFV = dispflx;
34 if (refr) Refresh();
35 return;
36}
37
38
39/* --Methode-- */
40void PIStarList::UpdateLimits()
41{
42 if (!mStL) return;
43
44 // Commencer par trouver nos limites
45 double dx, dy;
46 double x1, x2, y1, y2;
47 mStL->CalcXYLimits(x1, x2, y1, y2);
48
49 dx = 0.02*(x2-x1);
50 dy = 0.02*(y2-y1);
51
52 SetLimits(x1-dx, x2+dx, y1-dy, y2+dy);
53 SetAxesFlags(kBoxAxes | kExtTicks | kLabels);
54}
55
56
57/* --Methode-- */
58void PIStarList::Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax)
59{
60BStar *sti;
61double xp,yp;
62float flx;
63int sz;
64char buff[128];
65int nok, nl2;
66
67if (!mStL) return;
68
69int msz = mMSz;
70if (msz < 1) msz = 1;
71PIMarker mrk = (mMrk != PI_NotDefMarker) ? mMrk : PI_FCircleMarker;
72// g->SelFont();
73nok = 0; nl2 = mNLev*2-1;
74for (int i=0; i<mStL->NbStars(); i++) {
75 sti = mStL->Star(i);
76 if ( !(sti->Nice(BStar::flagOK)) ) continue;
77 flx = sti->Flux();
78 if ( (flx < mFmin) || (flx > mFmax) ) continue;
79 xp = sti->PosX(); yp = sti->PosY();
80 if ( (xp < xmin) || (xp > xmax) || (yp < ymin) || (yp > ymax) ) continue;
81 nok++;
82 sz = (int)((log10((double)flx/mF0))/mDLgF*(double)nl2-0.01) + msz;
83 if (sz < 2) g->SelMarker(sz, PI_DotMarker);
84 else g->SelMarker(sz, mrk);
85 g->DrawMarker((double)xp,(double)yp );
86 if (mDspFV) {
87 sprintf(buff," F=%g", flx);
88 double dx,dy;
89 g->DGrC2UC(sz, 4, dx, dy);
90 g->DrawString(xp+dx, yp-dy, buff);
91 }
92 }
93
94/*
95sprintf(buff, "StarList: NbStars= %d NDisp= %d", (int)mStL->NbStars(), nok);
96g->BaseGraphic()->DrawString(15,15,buff);
97sprintf(buff, "FMin= %g FMax= %g Nl= %d Sz0= %d", mFmin, mFmax, mNLev, mMSz0);
98g->BaseGraphic()->DrawString(15,30,buff);
99*/
100
101}
102
Note: See TracBrowser for help on using the repository browser.