コード例 #1
0
ファイル: AnnotationInterface.cpp プロジェクト: aleixpuig/PCL
void AnnotationInterface::__ColorSample_Paint( Control& sender, const Rect& /*updateRect*/ )
{
   Graphics g( sender );
   g.SetBrush( instance.annotationColor );
   g.SetPen( RGBAColor( 0, 0, 0 ) );
   g.DrawRect( sender.BoundsRect() );
}
コード例 #2
0
void BinarizeInterface::__ColorSample_Paint( Control& sender, const Rect& /*updateRect*/ )
{
   Graphics g( sender );
   g.SetBrush( RGBAColor( float( instance.level[0] ), float( instance.level[1] ), float( instance.level[2] ) ) );
   g.SetPen( 0xff000000, sender.DisplayPixelRatio() );
   g.DrawRect( sender.BoundsRect() );
}
コード例 #3
0
ファイル: NewImageInterface.cpp プロジェクト: morserover/PCL
void NewImageInterface::__ColorSample_Paint( Control& sender, const Rect& /*updateRect*/ )
{
   Graphics g( sender );

   RGBA rgba = RGBAColor( float( instance.v0 ), float( instance.v1 ), float( instance.v2 ) );

   if ( HASALPHA )
   {
      g.SetBrush( Bitmap( ":/image-window/transparent-small.png" ) );
      g.SetPen( Pen::Null() );
      g.DrawRect( sender.BoundsRect() );

      SetAlpha( rgba, RoundI( 255*instance.va ) );
   }

   g.SetBrush( rgba );
   g.SetPen( RGBAColor( 0, 0, 0 ) );
   g.DrawRect( sender.BoundsRect() );
}
コード例 #4
0
ファイル: INDIMountInterface.cpp プロジェクト: eprimucci/PCL
void INDIMountInterface::SkyChart_Paint( Control& sender, const Rect& updateRect )
{
   Graphics g( sender );

   RGBA darkRed = RGBAColor( 153, 0, 0 );
   RGBA darkYellow = RGBAColor( 153, 153, 0 );
   RGBA darkGreen = RGBAColor( 0, 153, 0 );

   Rect r( sender.BoundsRect() );

   int w = r.Width();
   int h = r.Height();
   int x0 = w >> 1;
   int y0 = h >> 1;

   g.FillRect( r, 0u );
   g.SetBrush( Brush::Null() );

   g.SetPen( darkRed );
   const int margin = 10;
   g.DrawLine( x0, 0+margin, x0, h-margin );
   g.DrawLine( 0+margin, y0, w-margin, y0 );

   g.EnableAntialiasing();

   if ( m_isAllSkyView )
   {
      double chartRadius = x0 - margin;
      g.DrawCircle( x0, y0, chartRadius );

      // draw telescope position
      StereoProjection::Spherical s;
      double hourAngle = (m_TargetRA.ToDouble() - m_lst)*360/24;
      double currentAlt = SkyMap::getObjectAltitude( m_TargetDEC.ToDouble(), hourAngle, m_geoLat );
      double currentAz = SkyMap::getObjectAzimut( m_TargetDEC.ToDouble(), hourAngle, m_geoLat );
      s.phi = Rad( currentAz );
      s.theta = Rad( 90 + currentAlt );
      StereoProjection::Polar p = s.Projected( chartRadius );
      StereoProjection::Rectangular r = p.ToRectangular();
#if 0
      Console().WriteLn( String().Format( "x=%f, y=%f, r=%f", r.x, r.y, chartRadius ) );
      Console().WriteLn( String().Format( "x0=%d, y0=%d", x0, y0 ) );
      Console().WriteLn( String().Format( "w=%d, h=%d", w, h ) );
      Console().WriteLn( String().Format( "phi=%f, theta=%f", s.phi, s.theta ) );
      Console().WriteLn( String().Format( "r=%f, pphi=%f", p.r, p.phi ) );
#endif
      g.DrawCircle( x0+r.x, y0+r.y, 5 );

      g.SetPen( darkGreen );
      hourAngle = (m_scopeRA - m_lst)*360/24;
      currentAlt = SkyMap::getObjectAltitude( m_scopeDEC, hourAngle, m_geoLat );
      currentAz = SkyMap::getObjectAzimut( m_scopeDEC, hourAngle, m_geoLat );
      s.phi = Rad( currentAz );
      s.theta = Rad( 90 + currentAlt );
      r = s.Projected( chartRadius ).ToRectangular();
      g.DrawCircle( x0+r.x, y0+r.y, 5 );

      g.SetPen( darkYellow );
      if ( m_skymap != nullptr )
         m_skymap->plotStars( m_lst, m_geoLat, x0, y0, chartRadius, g, m_limitStarMag );
   }
   else
   {
      if ( m_skymap != nullptr )
      {
         double CCD_chipHeight = 2200;
         double CCD_chipWidth = 2750;
         double CCD_pixelSize = 4.54/1000;
         double TEL_focalLength = 700;
         double FoV_width = CCD_chipWidth*CCD_pixelSize  / TEL_focalLength*3438/60;
         double FoV_height = CCD_chipHeight*CCD_pixelSize / TEL_focalLength*3438/60;
         double scale = 180.0/FoV_width;

         // draw scope position
         double currentAlt = SkyMap::getObjectAltitude( m_scopeDEC, m_scopeRA*360/24, m_geoLat );
         double currentAz = SkyMap::getObjectAzimut( m_scopeDEC, m_scopeRA*360/24, m_geoLat );

         StereoProjection::Spherical spherical( Rad( currentAz ), Rad( 90 + currentAlt ) );
         StereoProjection::Polar p = spherical.Projected( scale*x0 );
         StereoProjection::Rectangular r = p.ToRectangular();

         //Console().WriteLn( String().Format( "xx=%f, yy=%f, r=%f", r.x, r.y, scale * x0 ) );
         g.DrawCircle( x0, y0, 5 );

         // draw alignment deviation
         double alignAlt = SkyMap::getObjectAltitude( m_alignedDEC, m_alignedRA*360/24, m_geoLat );
         double alignAz = SkyMap::getObjectAzimut( m_alignedDEC, m_alignedRA*360/24, m_geoLat );
         StereoProjection::Rectangular rAlign =
            StereoProjection::Spherical( Rad( alignAz ), Rad( 90 + alignAlt ) ).Projected( scale*x0 ).ToRectangular();
         g.SetPen( darkGreen );
         g.DrawLine( x0 - r.x + r.x,
                     y0 - r.y + r.y,
                     x0 - r.x + rAlign.x,
                     y0 - r.y + rAlign.y );

         m_skymap->plotFoVStars( m_lst, m_geoLat, x0-r.x, y0-r.y, scale*x0, g, 13 );
      }
   }
}