コード例 #1
0
ファイル: GTestEventBin.hpp プロジェクト: TarekHC/gammalib
    virtual double         size(void) const{
        // Compute bin size
        double size = ewidth().MeV() * ontime();

        // Return bin size
        return size;
    }
コード例 #2
0
ファイル: pigalePaint.cpp プロジェクト: beauby/pigale
void DrawGeneralVisibility(QPainter *p,pigalePaint *paint)
  {TopologicalGraph G(paint->GCP);
  Prop<Tpoint> P1(G.Set(tedge()),PROP_DRAW_POINT_1);
  Prop<Tpoint> P2(G.Set(tedge()),PROP_DRAW_POINT_2);
  Prop<int> x1(G.Set(tvertex()),PROP_DRAW_INT_1);
  Prop<int> x2(G.Set(tvertex()),PROP_DRAW_INT_2);
  Prop<int> x1m(G.Set(tvertex()),PROP_DRAW_INT_3);
  Prop<int> x2m(G.Set(tvertex()),PROP_DRAW_INT_4);
  Prop<int> y(G.Set(tvertex()),PROP_DRAW_INT_5);
  Prop<short> ecolor(G.Set(tedge()),PROP_COLOR);
  Prop<short> vcolor(G.Set(tvertex()),PROP_COLOR);
  Prop<int> ewidth(G.Set(tedge()),PROP_WIDTH,1);
  double alpha=0.35;
  Tpoint a,b;


  p->setFont(QFont("sans",Min((int)(1.8*alpha * Min(paint->xscale,paint->yscale) + .5),13)));
  for(tvertex v=1;v<=G.nv();v++)
      {if(x1m[v] != x2m[v]) // always 
          {a.x() = x1m[v]; a.y() = y[v];
          b.x() = x2m[v];  b.y() = y[v];
          paint->DrawSeg(p,a,b,Black);
          }
      paint->DrawText(p,x1[v]-alpha,y[v]+alpha, x2[v]-x1[v]+2*alpha,2*alpha,v,vcolor[v]);
      }
  for (tedge e = 1;e <= G.ne();e++)
    {a.x() = P1[e].x(); a.y() = P1[e].y();
    if (a.x()>=x1[G.vin[e]] && a.x()<=x2[G.vin[e]]) a.y()+=alpha;
    b.x() = P1[e].x();  b.y() = P2[e].y();
    if (b.x()>=x1[G.vin[-e]] && b.x()<=x2[G.vin[-e]]) b.y()-=alpha;
    paint->DrawSeg(p,a,b,ecolor[e],ewidth[e]);
    }
  }
コード例 #3
0
ファイル: GCOMEventBin.cpp プロジェクト: adonath/gammalib
/***********************************************************************//**
 * @brief Return size of event bin
 *
 * @return Size of event bin (sr MeV s)
 *
 * The size of the event bin (units: sr MeV s) is given by
 * \f[size = \Omega \times \Delta E \times \Delta T\f]
 * where
 * \f$\Omega\f$ is the size of the spatial bin in sr,
 * \f$\Delta E\f$ is the size of the energy bin in MeV, and
 * \f$\Delta T\f$ is the ontime of the observation in seconds. 
 ***************************************************************************/
double GCOMEventBin::size(void) const
{
    // Compute bin size
    double size = omega() * ewidth().MeV() * ontime();

    // Return bin size
    return size;
}
コード例 #4
0
ファイル: pigalePaint.cpp プロジェクト: beauby/pigale
/*! \file 
\brief To display non Fary drawings
 */
void DrawPolrec(QPainter *p,pigalePaint *paint)
  {TopologicalGraph G(paint->GCP);
  Prop1<tstring> title(G.Set(),PROP_TITRE);
  Prop1<Tpoint> pmin(G.Set(),PROP_POINT_MIN);
  Prop<Tpoint> p1(G.Set(tvertex()),PROP_DRAW_POINT_1);
  Prop<Tpoint> p2(G.Set(tvertex()),PROP_DRAW_POINT_2);
  Prop<double> x1(G.Set(tedge()),PROP_DRAW_DBLE_1 );
  Prop<double> x2(G.Set(tedge()),PROP_DRAW_DBLE_2 );
  Prop<double> y1(G.Set(tedge()),PROP_DRAW_DBLE_3 );
  Prop<double> y2(G.Set(tedge()),PROP_DRAW_DBLE_4);
  Prop<double> y(G.Set(tedge()),PROP_DRAW_DBLE_5);
  Prop<short> ecolor(G.Set(tedge()),PROP_COLOR);
  Prop<short> vcolor(G.Set(tvertex()),PROP_COLOR);
  Prop<bool> isTree(G.Set(tedge()),PROP_ISTREE); 
  Prop<int> elabel(G.Set(tedge()),PROP_LABEL); 
  Prop<int> ewidth(G.Set(tedge()),PROP_WIDTH);

  bool drawTextEdges = (G.ne() < 100);
  QString stitle(~title());
  if(drawTextEdges)paint->DrawText(p,pmin().x(),pmin().y(),stitle);
  
  // draw vertices
  for(tvertex v = 1;v <= G.nv();v++)
      {double dx = (p2[v].x() - p1[v].x()) ;   
      double x = p1[v].x() ;     
      double y = p1[v].y(); 
      paint->DrawText(p,x,y, dx,1.,v,vcolor[v]);
      }
  // draw edges
  Tpoint e1,e2,e3,e4;
   for(tedge e = 1;e <= G.ne();e++)
       {if(isTree[e])
           {e1 = Tpoint(x1[e],y1[e]);
           e2 = Tpoint(x1[e],y2[e]);
           paint->DrawSeg(p,e1,e2,ecolor[e],ewidth[e]);
           }
       else // cotree edges   (x1,y1) -> (x1,y) -> (x2,y) -> (x2,y2)
           {e1 = Tpoint(x1[e],y1[e]);
           e2 = Tpoint(x1[e],y[e]);
           e3 = Tpoint(x2[e],y[e]);
           e4 = Tpoint(x2[e],y2[e]);
           paint->DrawSeg(p,e1,e2,ecolor[e],ewidth[e]);
           paint->DrawSeg(p,e2,e3,ecolor[e],ewidth[e]);
           paint->DrawSeg(p,e3,e4,ecolor[e],ewidth[e]);
           if(drawTextEdges)
               {QString label=QString("%1").arg(elabel[e]);
               // text is drawn at  position of lower edge occu
               paint->DrawText(p,x1[e],y[e],label);
               }
           }
       }
  }
コード例 #5
0
ファイル: 3-ConShelling1.cpp プロジェクト: beauby/pigale
void KantShelling::SetAdjFaces()  
/* set Brin2Face, Face2Brin, IsOuterV, IsOuterE.
       b = Face2Brin[num]
       b and acir[b] defines an angle
       Moving along a face: cir[-b] or -acir[b]
    */
  {tbrin b, b0;
  // Mark the vertices incident to the last face
  Prop<short> ecolor(G.Set(tedge()),PROP_COLOR);
  Prop<int> ewidth(G.Set(tedge()),PROP_WIDTH);
  b = b0 = FirstBrin();
  do
      {BelongToLastFace[G.vin[b]()] = 1;
      if(debug()) {ecolor[b.GetEdge()] = Green2;ewidth[b.GetEdge()] = 3;}
      }while((b = -G.cir[b]) != b0);

  IntList Brins;  // Brins: list of all brins 
  for(int i = -G.ne();i <= G.ne();i++)
      if(i)Brins.push(i);
  // the edge {v_1,v_2}. IsOuterE is set to 0.
  Brin2Face[FirstBrin()]=1;			  
  IsOuterV[v_1] = 1;
  Brins.del(FirstBrin());

  // the outer face is indexed 1
  b = G.cir[-FirstBrin];
  do 
      {Brins.del(b());
      Brin2Face[b()] = 1;
      IsOuterE[b.GetEdge()] = 1;
      IsOuterV[G.vin[b]()] = 1;
      }while ((b = G.cir[-b])  != FirstBrin);
  Face2Brin[1]=FirstBrin();

  // indexing other faces.
  int FaceIndex=2;
  while (!Brins.empty()) 
      {b0 = b =Brins.first();
       if(debug())cout << "face:" << FaceIndex << endl;
      do 
          {Brins.del(b());
          Brin2Face[b]=FaceIndex;
           if(debug())cout << G.vin[b]() << " " <<endl;
          } 
      while((b = G.cir[-b]) != b0);

      Face2Brin[FaceIndex]=b();
      FaceIndex++;
      }
  }