scan.h

Go to the documentation of this file.
00001 /* Gxsm - Gnome X Scanning Microscopy
00002  * universal STM/AFM/SARLS/SPALEED/... controlling and
00003  * data analysis software
00004  * 
00005  * Copyright (C) 1999,2000,2001,2002,2003 Percy Zahl
00006  *
00007  * Authors: Percy Zahl <zahl@users.sf.net>
00008  * additional features: Andreas Klust <klust@users.sf.net>
00009  * WWW Home: http://gxsm.sf.net
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00024  */
00025 
00026 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 8 c-style: "K&R" -*- */
00027 
00028 #ifndef __SCAN_H
00029 #define __SCAN_H
00030 
00031 #ifndef __MELDUNGEN_H
00032 #include "meldungen.h"
00033 #endif
00034 
00035 #ifndef __XSMTYPES_H
00036 #include "xsmtypes.h"
00037 #endif
00038 
00039 #ifndef __XSMHARD_H
00040 #include "xsmhard.h"
00041 #endif
00042 
00043 #ifndef __VIEW_H
00044 #include "view.h"
00045 #endif
00046 
00047 #ifndef __MEM2D_H
00048 #include "mem2d.h"
00049 #endif
00050 
00051 #ifndef __SCAN_OBJECT_DATA_H
00052 #include "scan_object_data.h"
00053 #endif
00054 
00055 /*
00056  * XSM Surface Scan Basis-Objekt:
00057  * vereint alle Scan-Methoden
00058  * ============================================================
00059  */
00060 
00061 #define NOT_SAVED 0
00062 #define IS_SAVED  1
00063 #define IS_NEW    2
00064 #define IS_FRESH  3
00065 
00066 // this is the type of the current active object...
00067 // we need to get rid of this...
00068 typedef enum OBJECT_TYPE { 
00069         MNONE,
00070         MPOINT,
00071         MLINE,
00072         MRECT,
00073         MPOLY,
00074         MPARABEL,
00075         MCIRC
00076 };
00077 
00078 // Scan Coordinate System Modes
00079 typedef enum SCAN_COORD_MODE {
00080         SCAN_COORD_ABSOLUTE, // absolute world coordinates, including offset and rotation
00081         SCAN_COORD_RELATIVE  // relative world coordinates, no offset, no rotation (in local scan coords)
00082 };
00083  
00084 class Scan{
00085 public:
00086         Scan(Scan *scanmaster);
00087         Scan(int vtype=0, int vflg=0, int ChNo=-1, SCAN_DATA *vd=NULL, ZD_TYPE mtyp=ZD_SHORT);
00088         virtual ~Scan();
00089         
00090         virtual void hide();
00091         virtual int draw(int y1=-1, int y2=-1);
00092         virtual int create(gboolean RoundFlg=FALSE, gboolean subgrid=FALSE);
00093         void Saved(){ State = IS_SAVED; };
00094         
00095         virtual void start();
00096         virtual void stop(int StopFlg=FALSE, int line=0);
00097         
00098         void inc_refcount() { ++refcount; };
00099         void dec_refcount() { --refcount; };
00100         int get_refcount() { return refcount; };
00101         
00102         void CpyUserEntries(SCAN_DATA &src);
00103         void CpyDataSet(SCAN_DATA &src);
00104         void GetDataSet(SCAN_DATA &dst);
00105         
00106         int SetView(int vtype);
00107         void AutoDisplay(double hi=0., double lo=0., int Delta=4);
00108         int SetVM(int vflg=0, SCAN_DATA *src=NULL, int Delta=4);
00109         int GetVM(){ return VFlg; };
00110         void Activate();
00111         
00112         void realloc_pkt2d(int n);
00113         
00114         /* Data */
00115         
00116         Mem2d *mem2d;    /* 2d Daten */
00117         View  *view;     /* View Objekt */
00118         
00119 
00120         /* Scan Coodinate System Handling */
00121         int Pixel2World (int ix, int iy, double &wx, double &wy, SCAN_COORD_MODE scm = SCAN_COORD_ABSOLUTE);
00122         int World2Pixel (double wx, double wy, int &ix, int &iy, SCAN_COORD_MODE scm = SCAN_COORD_ABSOLUTE);
00123         /* Conveniance wrappers */
00124         double GetWorldX (int ix){
00125                 double x,y;
00126                 Pixel2World (ix,0, x, y, SCAN_COORD_RELATIVE);
00127                 return x;
00128         };
00129         double GetWorldY (int ix){
00130                 double x,y;
00131                 Pixel2World (ix,0, x, y, SCAN_COORD_RELATIVE);
00132                 return y;
00133         };
00134 
00135         SCAN_DATA *vdata; /* ever valid Pointer to XSM-(User)-Data (may be manipulated) */
00136         SCAN_DATA data;  /* Daten des letzten Scans - Scanbezogen*/
00137         
00138         Point2D Pkt2dScanLine[2];
00139         int     RedLineActive;
00140         
00141         Point2D *Pkt2d;
00142         int     PktVal;
00143         
00144         int add_object (const gchar *name, const gchar *text,
00145                        int np, void (*f_ixy)(int, double &, double &));
00146         void update_object (int id, const gchar *name, const gchar *text,
00147                             void (*f_ixy)(int, double &, double &));
00148         int del_object (int id);
00149         int find_object (int id);
00150         void destroy_all_objects () { for (int i=0; i<=objects_id; ++i) del_object (i); };
00151 
00152         unsigned int number_of_object () { return g_slist_length(objects_list); };
00153         scan_object_data* get_object_data (int i) { return (scan_object_data*) g_slist_nth_data(objects_list, i); };
00154         // do not modify data!!!!!!
00155         void dump_object_data (int i) { ((scan_object_data*) g_slist_nth_data(objects_list, i)) -> dump (); };
00156 
00157         // store tmp data
00158         void set_data (int d) { tmp_data=d; };
00159         int get_data () { return tmp_data; };
00160 
00161  private: 
00162         int VFlg;
00163         int ChanNo;
00164         int State;
00165         int Running;
00166         int numpkt2d;
00167         int refcount;
00168         int tmp_data;
00169 
00170         int     objects_id;
00171         GSList  *objects_list;
00172 };
00173 
00174 /*
00175  * TopoGraphic Ableitung
00176  * ============================================================
00177  */
00178 
00179 class TopoGraphicScan : public Scan{
00180 public:
00181         TopoGraphicScan(int vtype=0, int vflg=0, int ChNo=-1, SCAN_DATA *vd=0);
00182         virtual ~TopoGraphicScan();
00183   
00184 private:  
00185 
00186 };
00187 
00188 
00189 /*
00190  * SpaScan Ableitung
00191  * ============================================================
00192  */
00193 
00194 class SpaScan : public Scan{
00195 public:
00196         SpaScan(int vtype=0, int vflg=0, int ChNo=-1, SCAN_DATA *vd=0);
00197         virtual ~SpaScan();
00198   
00199 private:  
00200 
00201 };
00202 
00203 
00204 #endif

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