PanView.C

Go to the documentation of this file.
00001 /* Gnome gxsm - Gnome X Scanning Microscopy
00002  * universal STM/AFM/SARLS/SPALEED/... controlling and
00003  * data analysis software
00004  * 
00005  * Gxsm Plugin Name: PanView.C
00006  * ========================================
00007  * 
00008  * Copyright (C) 2003 The Free Software Foundation
00009  *
00010  * Authors: Kristan Temme <etptt@users.sf.net>
00011  * 
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00025  */
00026 
00027 /* Please do not change the Begin/End lines of this comment section!
00028  * this is a LaTeX style section used for auto generation of the PlugIn Manual 
00029  * Chapter. Add a complete PlugIn documentation inbetween the Begin/End marks!
00030  * --------------------------------------------------------------------------------
00031 % BeginPlugInDocuSection
00032 % PlugInDocuCaption: Pan View
00033 
00034 % PlugInName: PanView
00035 % PlugInAuthor: Kristan Temme, Thorsten Wagner
00036 % PlugInAuthorEmail: stm@users.sf.net
00037 % PlugInMenuPath: Tools/Pan View 
00038 % PlugInDescription
00039  This is a handy tool which shows you, where your current scan is in the
00040  range of the maximum scan. Especially it gives you an error message if you
00041  leave the scan area. It also shows the position of rotated scans.
00042 
00043  In addition the current realtime XY position of the tip plus it
00044  indicates the Z-position of the tip is visualized by the marker on
00045  the right edge of the window.
00046 
00047 \begin{figure}[hbt]
00048 \center { \fighalf{PanView}}
00049 \caption{The PanView window.}
00050 \label{fig:PanView}
00051 \end{figure}
00052 
00053 
00054 % PlugInUsage
00055  Open the PanView window via GXSM main menu \GxsmMenu{Windows/Pan View}.
00056 
00057 % OptPlugInNotes
00058  The tip-position is close to realtime, but it is refreshed only
00059  several times per second and only if GXSM is idle. Thus the
00060  display/update may get stuck at times GXSM is very busy. Never the
00061  less the tip position is read back from the DSP and thus indicates
00062  the true position, regardless what in happening to GXSM of the DSP --
00063  so if anything goes wrong, you will see it here!
00064 
00065 % OptPlugInHints
00066  For now the plug-in assumes a scan which is centered in the middle of the
00067  scan not in the middle of the topline (as default for the pci32).
00068 
00069 % OptPlugInKnownBugs
00070  The plugin has a not yet resolved "cleanup" problem at unloading and
00071  will force GXSM to early exit, but only effects it on GXSM-exit. This
00072  will only occurr if the PanView Window was opened before exiting
00073  GXSM.
00074 
00075 % EndPlugInDocuSection
00076  * -------------------------------------------------------------------------------- 
00077  */
00078 #include "config.h"
00079 #include "gxsm/plugin.h"
00080 #include "glbvars.h"
00081 #include "xsmtypes.h"
00082 
00083 #include "PanView.h"
00084 
00085 // Plugin Prototypes
00086 static void PanView_init (void);
00087 static void PanView_query (void);
00088 static void PanView_about (void);
00089 static void PanView_configure (void);
00090 static void PanView_cleanup (void);
00091 
00092 PanView *Pan_Window = NULL;
00093 static void PanView_run(GtkWidget *w, void *data);
00094 gboolean refresh_function(GtkWidget *w, GdkEvent *event, void *data);
00095 
00096 gboolean PanView_valid = FALSE;
00097 
00098 #define PRE_AREA 0
00099 
00100 // #define PI_DEBUG(NN, TXT) std::cout << TXT << std::endl
00101 
00102 
00103 //
00104 // Gxsm plugin discription
00105 //
00106 GxsmPlugin PanView_pi = {
00107         NULL,                   // filled in and used by Gxsm, don't touch !
00108         NULL,                   // filled in and used by Gxsm, don't touch !
00109         0,                      // filled in and used by Gxsm, don't touch !
00110         NULL,                   // filled in just after init() is called !!!
00111         "Pan View",
00112         NULL,                      
00113         "Visualisation of the scan position",
00114         "Kristan Temme, Thorsten Wagner",
00115         N_("_Windows/"),
00116         N_("Pan View"),
00117         NULL,
00118         "No further info",
00119         NULL,          
00120         NULL,          
00121         PanView_init,  
00122         NULL,  
00123         PanView_about,
00124         PanView_configure,
00125         PanView_run,
00126         PanView_cleanup
00127 };
00128 
00129 //
00130 //Text used in the About Box
00131 //
00132 static const char *about_text = N_("A little scanning reference");
00133                                    
00134         
00135 //
00136 // Symbol "get_gxsm_plugin_info" is resolved by dlsym from Gxsm, used to get Plugin's info!! 
00137 // Essential Plugin Function!!
00138 //
00139 GxsmPlugin *get_gxsm_plugin_info ( void ){ 
00140         PanView_pi.description = g_strdup_printf(N_("Gxsm pan view window %s"), VERSION);
00141         return &PanView_pi; 
00142 }
00143 
00144 //
00145 // init-Function
00146 //
00147 
00148 static void PanView_init(void)
00149 {
00150         PI_DEBUG(DBG_L2, "PanView Plugin Init" );
00151 }
00152 
00153 //
00154 // about-Function
00155 //
00156 static void PanView_about(void)
00157 {
00158         const gchar *authors[] = { PanView_pi.authors, NULL};
00159         gtk_widget_show(gnome_about_new ( PanView_pi.name,
00160                                           VERSION,
00161                                           N_("(C) 2003 the Free Software Foundation"),
00162                                           about_text,
00163                                           authors,
00164                                           NULL,NULL,NULL
00165                                 ));
00166 }
00167 //
00168 // configure-Function
00169 //
00170 static void PanView_configure(void)
00171 {
00172         if(PanView_pi.app)
00173                 PanView_pi.app->message("PanView Plugin Configuration");
00174 
00175         if (Pan_Window){
00176                 if (Pan_Window->finish ()){
00177                         PanView_pi.app->message("PanView: Starting tip monitor");
00178                         Pan_Window->start_tip_monitor ();
00179                 } else {
00180                         PanView_pi.app->message("PanView: Stopping tip monitor");
00181                         Pan_Window->stop_tip_monitor ();
00182                 }
00183         }
00184 }
00185 
00186 //
00187 // cleanup-Function, make sure the Menustrings are matching those above!!!
00188 //
00189 static void PanView_cleanup(void)
00190 {
00191         PanView_valid = FALSE;
00192 
00193         PI_DEBUG(DBG_L2, "PanView_cleanup(void). Entering.\n");
00194         if (Pan_Window) {
00195                 delete Pan_Window;
00196         }
00197         PI_DEBUG(DBG_L2, "PanView_cleanup(void). Exiting.\n");
00198 }
00199 
00200 static void PanView_refresh_callback (gpointer data){
00201         if (Pan_Window)
00202                 Pan_Window -> refresh ();
00203 }
00204 
00205 static gint PanView_tip_refresh_callback (PanView *pv){
00206 
00207         if (!PanView_valid) return FALSE;
00208 
00209         if (pv){
00210                 if (! pv -> finish ()){
00211                         pv -> tip_refresh ();
00212                         return TRUE;
00213                 }
00214                 pv -> finish (-999);
00215         }
00216         return FALSE;
00217 }
00218 
00219 //Gtk+ Signal Funktion
00220 static void PanView_run(GtkWidget *w, void *data)
00221 {
00222         if (!Pan_Window){
00223                 Pan_Window = new PanView(PanView_pi.app->getApp());
00224                 PanView_pi.app->ConnectPluginToSPMRangeEvent (PanView_refresh_callback);
00225         }
00226 
00227         Pan_Window->run();
00228         Pan_Window->start_tip_monitor ();
00229 
00230         PI_DEBUG(DBG_L2, "A new Pan Window was opened" );
00231 }
00232 
00233 PanView ::  PanView (GtkWidget *a) : GnomeAppService (a){
00234         int i,j;
00235 
00236         finish (FALSE);
00237         timer_id = 0;
00238 
00239         AppWidgetInit (N_("Pan View: scan area"));
00240 
00241         GtkWidget *box = gtk_vbox_new (FALSE, 0);
00242         gtk_widget_show (box);
00243         gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0);
00244 
00245         // ========================================
00246 
00247         /*Set up the visual and colormap*/
00248         gtk_widget_push_visual(gdk_rgb_get_visual());
00249         gtk_widget_push_colormap(gdk_rgb_get_cmap());
00250         
00251         canvas = gnome_canvas_new_aa();
00252         
00253         /* Now pop the visual and colormap*/
00254         gtk_widget_pop_colormap();
00255         gtk_widget_pop_visual();
00256                 
00257         gtk_widget_set_size_request (canvas, 2*WINDOW_SIZE+15, 2*WINDOW_SIZE+7);
00258 
00259         gtk_widget_show (canvas);
00260         gtk_container_add (GTK_CONTAINER (box), canvas);
00261 
00262 
00263         /* set up the system relevant Parameters */
00264         update_expanded_scan_limits ();
00265 
00266         /*gnome_canvas_set_pixels_per_unit( GNOME_CANVAS (canvas), PPU);*/      
00267         gnome_canvas_set_scroll_region( GNOME_CANVAS ( canvas ), TO_CANVAS_X(max_x), TO_CANVAS_Y(max_y),
00268                                         TO_CANVAS_X(min_x), TO_CANVAS_Y(min_y));
00269                          
00270 
00271         /*create a rectangle*/
00272         pan_area = gnome_canvas_item_new ( gnome_canvas_root (GNOME_CANVAS (canvas)), 
00273                                            gnome_canvas_rect_get_type(),
00274                                            "x1", TO_CANVAS_X(max_x),
00275                                            "x2", TO_CANVAS_X(min_x),
00276                                            "y1", TO_CANVAS_Y(max_y),
00277                                            "y2", TO_CANVAS_Y(min_y),
00278                                            "fill_color","white",
00279                                            "outline_color","red",
00280                                            "width_units", 1.5,
00281                                            NULL );
00282         
00283         pre_current_view = NULL;
00284         current_view = NULL;
00285         tip_marker = NULL;
00286         tip_marker_z = NULL;
00287 
00288         PanView_valid = TRUE;
00289 
00290         refresh ();
00291         tip_refresh ();
00292 }
00293 
00294 PanView::~PanView (){
00295 
00296         PanView_valid = FALSE;
00297 
00298         g_print ("PanView :: ~PanView ()\n");
00299         g_print ("PanView :: ~PanView () -- stop_tip_monitor \n");
00300         stop_tip_monitor ();
00301         g_print ("PanView :: ~PanView () -- OK.\n");
00302 }
00303 
00304 void PanView::run()
00305 {
00306         show ();
00307 }
00308 
00309 void PanView::start_tip_monitor (){
00310         if (!timer_id){
00311                 g_print ("PanView::start_tip_monitor \n");
00312                 finish (FALSE);
00313                 timer_id = gtk_timeout_add (150, (GtkFunction) PanView_tip_refresh_callback, this);
00314         }
00315 }
00316 
00317 void PanView::stop_tip_monitor (){
00318         if (timer_id){
00319                 g_print ("PanView::stop_tip_monitor \n");
00320                 finish (TRUE);
00321 //              while (finish () != -999){
00322 //                      g_print (".\n");
00323 //                      usleep (20000);
00324 //              }
00325                 gtk_timeout_remove (timer_id);
00326                 timer_id = 0;
00327         }
00328         tip_refresh ();
00329         g_print ("PanView::stop_tip_monitor OK.\n");
00330 }
00331 
00332 void PanView::update_expanded_scan_limits (){
00333         // This should give the maximum voltage after the HV-Amp
00334 
00335         max_x =    xsmres.AnalogVMaxOut*gapp->xsm->Inst->VX();
00336         min_x =   -xsmres.AnalogVMaxOut*gapp->xsm->Inst->VX();
00337         max_y =    xsmres.AnalogVMaxOut*gapp->xsm->Inst->VY();
00338         min_y =   -xsmres.AnalogVMaxOut*gapp->xsm->Inst->VY();
00339         max_z =    xsmres.AnalogVMaxOut*gapp->xsm->Inst->VZ();
00340         min_z =   -xsmres.AnalogVMaxOut*gapp->xsm->Inst->VZ();
00341 
00342         // expand if analog offset adding is used 
00343         // --> but that's not all, more to do:
00344         // ** check scan range if rotated
00345         if (gapp->xsm->Inst->OffsetMode() == OFM_ANALOG_OFFSET_ADDING){
00346                 max_x =    xsmres.AnalogVMaxOut*gapp->xsm->Inst->VX0();
00347                 min_x =   -xsmres.AnalogVMaxOut*gapp->xsm->Inst->VX0();
00348                 max_y =    xsmres.AnalogVMaxOut*gapp->xsm->Inst->VY0();
00349                 min_y =   -xsmres.AnalogVMaxOut*gapp->xsm->Inst->VY0();
00350         }
00351 }
00352 
00353 void PanView :: tip_refresh()
00354 {
00355         // tip marker item
00356         GnomeCanvasPoints* tipmark_points = gnome_canvas_points_new (4);
00357         double rsz = max_x/15.;
00358         double asp = 1.67;
00359         double x,y,z;
00360         x=y=z=0.;
00361 
00362         if (!PanView_valid) return;
00363 
00364         if (IS_NOCARD){
00365                 ;
00366         }
00367         else{
00368                 // ** I'll fix this sub-routine to return the correct x/y/z volated including added offsets if used!
00369                 gapp->xsm->hardware->RTQuery ("zxy", z, x, y); // get tip position in volts
00370         }
00371 
00372         // XY Scan&Offset position marker
00373         tipmark_points->coords[0] = TO_CANVAS_X (x-rsz/asp);
00374         tipmark_points->coords[1] = TO_CANVAS_Y (y+rsz);
00375         tipmark_points->coords[2] = TO_CANVAS_X (x+rsz/asp);
00376         tipmark_points->coords[3] = TO_CANVAS_Y (y-rsz);
00377         tipmark_points->coords[4] = TO_CANVAS_X (x-rsz/asp);
00378         tipmark_points->coords[5] = TO_CANVAS_Y (y-rsz);
00379         tipmark_points->coords[6] = TO_CANVAS_X (x+rsz/asp);
00380         tipmark_points->coords[7] = TO_CANVAS_Y (y+rsz);
00381 
00382         if (tip_marker)
00383                 gnome_canvas_item_set (tip_marker, 
00384                                        "points", tipmark_points,
00385                                        "fill_color", finish () ? "red":"yellow",
00386                                        NULL);
00387         else
00388                 tip_marker = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)),  
00389                                                     gnome_canvas_polygon_get_type (),
00390                                                     "points", tipmark_points,
00391                                                     "outline_color", "blue",
00392                                                     "fill_color", finish () ? "red":"yellow",
00393                                                     "width_units", 0.5,
00394                                                     NULL);
00395                 
00396         gnome_canvas_item_raise_to_top (tip_marker);
00397 
00398         // Z tip position marker
00399         rsz = 1./15.;
00400         asp = 1.67;
00401         tipmark_points->coords[0] = TO_CANVAS_NORMAL_X (1.+rsz);
00402         tipmark_points->coords[1] = TO_CANVAS_NORMAL_Y (z/max_z-rsz/asp);
00403         tipmark_points->coords[2] = TO_CANVAS_NORMAL_X (1.-rsz);
00404         tipmark_points->coords[3] = TO_CANVAS_NORMAL_Y (z/max_z+rsz/asp);
00405         tipmark_points->coords[4] = TO_CANVAS_NORMAL_X (1.-rsz);
00406         tipmark_points->coords[5] = TO_CANVAS_NORMAL_Y (z/max_z-rsz/asp);
00407         tipmark_points->coords[6] = TO_CANVAS_NORMAL_X (1.+rsz);
00408         tipmark_points->coords[7] = TO_CANVAS_NORMAL_Y (z/max_z+rsz/asp);
00409 
00410 
00411         if (tip_marker_z)
00412                 gnome_canvas_item_set (tip_marker_z, 
00413                                        "points", tipmark_points,
00414                                        "fill_color", fabs(z/max_z) < 0.8 ? "green":"red",
00415                                        NULL);
00416         else
00417                 tip_marker_z = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)),  
00418                                                       gnome_canvas_polygon_get_type (),
00419                                                       "points", tipmark_points,
00420                                                       "outline_color", "green",
00421                                                       "fill_color", fabs(z/max_z) < 0.8 ? "green":"red",
00422                                                       "width_units", 0.5,
00423                                                       NULL);
00424         
00425         gnome_canvas_points_free (tipmark_points);
00426         gnome_canvas_item_raise_to_top (tip_marker_z);
00427 }
00428 
00429 void PanView :: refresh()
00430 {
00431         static int prev_error = FALSE;
00432         int error = FALSE;
00433         double max_corn[4][2];
00434         double x_offset;
00435         double y_offset;
00436         double alpha;
00437                 
00438         int     i,j; 
00439 
00440         if (!PanView_valid) return;
00441 
00442         /* update system parameters */
00443         update_expanded_scan_limits ();
00444 
00445         PI_DEBUG (DBG_L2, min_x<<"<X<"<<max_x );
00446         PI_DEBUG (DBG_L2, min_y<<"<Y<"<<max_y );
00447 
00448         /*fill in the corners of the scanning area*/
00449         if (IS_SPALEED_CTRL||xsmres.ScanOrgCenter){ // Origin is middle of scan
00450                 point[0][0] = -0.5*gapp->xsm->data.s.nx*gapp->xsm->data.s.dx/xsmres.XPiezoAV;   
00451                 point[0][1] = +0.5*gapp->xsm->data.s.ny*gapp->xsm->data.s.dy/xsmres.YPiezoAV;
00452                  
00453                 point[1][0] = -1*point[0][0];        point[1][1] = +1*point[0][1];
00454                 point[2][0] = -1*point[0][0];        point[2][1] = -1*point[0][1];
00455                 point[3][0] = +1*point[0][0];        point[3][1] = -1*point[0][1];
00456         }
00457         else{                                       // Origin is center of top line
00458                 point[0][0] =-0.5*gapp->xsm->data.s.nx*gapp->xsm->data.s.dx/xsmres.XPiezoAV;    point[0][1] = 0;
00459                 point[1][0] = -1*point[0][0];        point[1][1] = 0;
00460                 point[2][0] = -1*point[0][0];        point[2][1] = -gapp->xsm->data.s.ny*gapp->xsm->data.s.dy/xsmres.YPiezoAV;
00461                 point[3][0] = +1*point[0][0];        point[3][1] = +1*point[2][1];
00462         }
00463         PI_DEBUG (DBG_L2, "Original coordinates: \t"<< 
00464                   point[0][0]<<","<<point[0][1]<<"\t"<<
00465                   point[1][0]<<","<<point[1][1]<<"\t"<<
00466                   point[2][0]<<","<<point[2][1]<<"\t"<<
00467                   point[3][0]<<","<<point[3][1] );
00468 
00469         /*read the parameters from the control*/
00470         y_offset = gapp->xsm->data.s.y0/xsmres.YPiezoAV;
00471         x_offset = gapp->xsm->data.s.x0/xsmres.XPiezoAV;
00472         alpha   = gapp->xsm->data.s.alpha;      
00473 
00474 #if PRE_AREA
00475         /* this are the edges of the scan area plus the prescan */
00476         double w = 2*gapp->xsm->data.s.dx*gapp->xsm->data.hardpars.LS_nx_pre/xsmres.XPiezoAV;
00477         pre_point[0][0] = point[0][0]-w; pre_point[0][1] = point [0][1];
00478         pre_point[1][0] = point[1][0]+w; pre_point[1][1] = point [1][1];
00479         pre_point[2][0] = point[2][0]+w; pre_point[2][1] = point [2][1];
00480         pre_point[3][0] = point[3][0]-w; pre_point[3][1] = point [3][1];
00481 #endif
00482 
00483         /*Apply the current offset and rotation to prescan area*/
00484         for(i=0;i<4;i++){
00485                 transform(max_corn[i], point[i], -alpha, y_offset, x_offset);
00486 #if PRE_AREA
00487                 transform(max_corn[i],pre_point[i],-alpha,y_offset,x_offset);
00488 #endif
00489         }
00490         
00491         /*check whether our scanning area (extended by the prescan) is within the limits*/      
00492         for(i=0; i < 4 && !error;i++){
00493                 if(max_corn[i][0] >= max_x || max_corn[i][0] <= min_x)
00494                         error = TRUE;
00495                 
00496                 if(max_corn[i][1] >= max_y || max_corn[i][1] <= min_y)
00497                         error = TRUE;
00498                                         
00499         }
00500         
00501         if(max_corn[0][0] == corn_oo && max_corn[3][1] == corn_ii)
00502                 error = FALSE;
00503         
00504         corn_oo = max_corn[0][0];
00505         corn_ii = max_corn[3][1];
00506 
00507 
00508 #if PRE_AREA
00509 
00510         /*redraw the PanView prescan area */
00511         pre_scanarea_points = gnome_canvas_points_new (4);
00512         for(i=0,j=0;i < 4;i++){
00513                 pre_scanarea_points->coords[j]   = TO_CANVAS_X(max_corn[i][0]);
00514                 pre_scanarea_points->coords[j+1] = TO_CANVAS_Y(max_corn[i][1]);
00515                 j+=2;
00516         }
00517         
00518         if (pre_current_view)
00519                 gnome_canvas_item_set (pre_current_view, 
00520                                        "points", pre_scanarea_points, 
00521                                        "outline_color", "black", 
00522                                        "fill_color","white",
00523                                        NULL );
00524         else
00525                 pre_current_view = gnome_canvas_item_new( gnome_canvas_root (GNOME_CANVAS (canvas)), 
00526                                                           gnome_canvas_polygon_get_type(),
00527                                                           "points", pre_scanarea_points,
00528                                                           "fill_color", "white",
00529                                                           "outline_color", "black",
00530                                                           "width_units", 1.5,
00531                                                           NULL );
00532         
00533         gnome_canvas_points_free (pre_scanarea_points);
00534 #endif
00535 
00536         /*Apply the current offset and rotation to scan area*/
00537         for(i=0;i<4;i++)
00538                 transform(max_corn[i],point[i],-alpha,y_offset,x_offset);       
00539 
00540         PI_DEBUG (DBG_L2, "Transformed coordinates: \t"<<
00541                   max_corn[0][0]<<","<<max_corn[0][1]<<"\t"<<
00542                   max_corn[1][0]<<","<<max_corn[1][1]<<"\t"<<
00543                   max_corn[2][0]<<","<<max_corn[2][1]<<"\t"<<
00544                   max_corn[3][0]<<","<<max_corn[3][1] );
00545 
00546         /*redraw the PanView scanning area*/ 
00547         GnomeCanvasPoints *scanarea_points = gnome_canvas_points_new (4);
00548         for(i=0,j=0;i < 4;i++){
00549                 scanarea_points->coords[j]   = TO_CANVAS_X(max_corn[i][0]);
00550                 scanarea_points->coords[j+1] = TO_CANVAS_Y(max_corn[i][1]);
00551                 j+=2;
00552         }
00553         
00554         if (current_view)
00555                 gnome_canvas_item_set(current_view, 
00556                                       "points", scanarea_points,
00557                                       "outline_color", (error)?"red":"black",
00558                                       "fill_color",(error)?"red":"black",
00559                                       NULL );
00560         else
00561                 current_view = gnome_canvas_item_new( gnome_canvas_root (GNOME_CANVAS (canvas)), 
00562                                                       gnome_canvas_polygon_get_type(),
00563                                                       "points", scanarea_points,
00564                                                       "fill_color", "black",
00565                                                       "outline_color", "black",
00566                                                       "width_units", 1.5,
00567                                                       NULL);
00568         
00569         gnome_canvas_points_free (scanarea_points);
00570 
00571         if(error && !prev_error){
00572                 prev_error = error;
00573                 warning ("Scanning area is out of limits!");
00574                 PI_DEBUG(DBG_L2, "Error: Scanning area is out of limits!" );
00575         }
00576         prev_error = error;
00577 }
00578 
00579 void PanView :: transform(double *dest, double *src, double rot, double y_off, double x_off)
00580 {
00581         double D[2][2];
00582         int i,j;        
00583         
00584         D[0][0] =   cos(TO_RAD(rot));
00585         D[1][1] =   cos(TO_RAD(rot));
00586         D[0][1] =  -sin(TO_RAD(rot));
00587         D[1][0] =   sin(TO_RAD(rot));
00588 
00589         dest[0] = 0;
00590         dest[1] = 0;
00591         
00592         for(i=0; i<2 ; i++)                     
00593                 for(j=0;j<2;j++)
00594                         dest[i] += D[i][j]*src[j];
00595 
00596         dest[0] += x_off;
00597         dest[1] += y_off;
00598         return;
00599 }
00600 
00602 // ENDE PAN VIEW CONTROL ///////////////

Generated on Sat Apr 1 09:04:10 2006 for GXSM by  doxygen 1.4.6