wxImagePanel.cpp
Go to the documentation of this file.
00001 
00021 #include "descriptor_surface_based_trainer/wxImagePanel.h"
00022 #include <ros/ros.h>
00023 
00024 
00025 
00026 BEGIN_EVENT_TABLE(wxImagePanel, wxPanel)
00027 /*
00028  EVT_MOTION(wxImagePanel::mouseMoved)
00029  EVT_LEFT_DOWN(wxImagePanel::mouseDown)
00030  EVT_LEFT_UP(wxImagePanel::mouseReleased)
00031  EVT_RIGHT_DOWN(wxImagePanel::rightClick)
00032  EVT_LEAVE_WINDOW(wxImagePanel::mouseLeftWindow)
00033  EVT_KEY_DOWN(wxImagePanel::keyPressed)
00034  EVT_KEY_UP(wxImagePanel::keyReleased)
00035  EVT_MOUSEWHEEL(wxImagePanel::mouseWheelMoved)
00036  */
00037 
00038 // catch paint events
00039 EVT_PAINT(wxImagePanel::paintEvent)
00040 
00041 END_EVENT_TABLE()
00042 
00043 wxImagePanel::wxImagePanel(
00044         wxWindow* parent, int height, int width) :
00045         wxPanel(parent)
00046 {
00047     SetSize(wxSize(width, height));
00048     image = new wxBitmap(width, height);
00049 }
00050 
00051 /*
00052  * Called by the system of by wxWidgets when the panel needs
00053  * to be redrawn. You can also trigger this call by
00054  * calling Refresh()/Update().
00055  */
00056 
00057 void wxImagePanel::paintEvent(wxPaintEvent & evt)
00058 {
00059     // depending on your system you may need to look at double-buffered dcs
00060     wxPaintDC dc(this);
00061     render(dc);
00062 }
00063 
00064 /*
00065  * Alternatively, you can use a clientDC to paint on the panel
00066  * at any time. Using this generally does not free you from
00067  * catching paint events, since it is possible that e.g. the window
00068  * manager throws away your drawing when the window comes to the
00069  * background, and expects you will redraw it when the window comes
00070  * back (by sending a paint event).
00071  */
00072 void wxImagePanel::paintNow()
00073 {
00074     // depending on your system you may need to look at double-buffered dcs
00075     wxClientDC dc(this);
00076     render(dc);
00077 }
00078 
00079 /*
00080  * Here we do the actual rendering. I put it in a separate
00081  * method so that it can work no matter what type of DC
00082  * (e.g. wxPaintDC or wxClientDC) is used.
00083  */
00084 void wxImagePanel::render(wxDC&  dc)
00085 {
00086     dc.DrawBitmap( *image, 0, 0, false );
00087 }
00088 
00089 void wxImagePanel::setImage(wxBitmap* image) {
00090         delete this->image;
00091         this->image = image;
00092 }
00093 
00094 


asr_descriptor_surface_based_recognition
Author(s): Allgeyer Tobias, Hutmacher Robin, Meißner Pascal
autogenerated on Thu Jun 6 2019 17:57:29