1 
2 /****************************************************************************
3 **
4 ** Copyright (C) 2011 Christian B. Huebschle & George M. Sheldrick
5 ** All rights reserved.
6 ** Contact: chuebsch@moliso.de
7 **
8 ** This file is part of the ShelXle
9 **
10 ** This file may be used under the terms of the GNU Lesser
11 ** General Public License version 2.1 as published by the Free Software
12 ** Foundation and appearing in the file COPYING included in the
13 ** packaging of this file.  Please review the following information to
14 ** ensure the GNU Lesser General Public License version 2.1 requirements
15 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 **
18 ****************************************************************************/
19 #ifndef FCVSFO_H
20 #define FCVSFO_H 1
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <math.h>
24 #include <cmath>
25 #include <ctype.h>
26 #include <string.h>
27 #include <QtGui>
28 #if (QT_VERSION >= 0x050000)
29 #include <QtWidgets>
30 #endif
31 
32 #ifdef _MSC_VER
33 #include <float.h>
34 #define std_isnormal(arg) (_finite(arg)||(arg==0))
35 #else
36 #define std_isnormal std::isnormal
37 #endif
38 
39 //! Omit is a struct to specify a refection to be omitted by the OMIT instruction
40 typedef struct {
41 int h,k,l;
42 } Omit;
43 
44 //! MCell: see Cell in molecule.h for details ....
45 struct MCell {
46   double a,b,c,al,be,ga;
47   double phi,V,as,bs,cs,tau,cosga,cosal,cosbe,singa,tanga;
48   double wave;
49 };
50 
51 //! Refls is a struct type for reflections in the fcf file
52 typedef struct {
53   int h,k,l;
54   double F;
55   double phase;
56   double sigma;
57   double stl;
58   double w;
59 } Refls;
60 
61 //! GraphSceene is a QGraphicsScene class to display reflections graphically in 2D. Used in FcVsFo. \inherit QGraphicsScene
62 class GraphSceene:public QGraphicsScene{
63 Q_OBJECT
64 public:
65 GraphSceene( qreal x, qreal y, qreal width, qreal height, QObject * parent = 0 );
66   QGraphicsRectItem *selEckt;
67   QList<int> selected;
68   QPointF selStart,selEnd;
69 //  GraphSceene();
70 signals:
71   void meinstatus(int da);
72   void listen();
73 protected:
74   void mouseMoveEvent ( QGraphicsSceneMouseEvent  * mouseEvent );
75   void mousePressEvent ( QGraphicsSceneMouseEvent * mouseEvent );
76 private:
77 };
78 
79 //! FcVsFo is a QDialog to analyse reflection data and to omit outliers by hand.
80 class FcVsFo: public QDialog {
81 Q_OBJECT
82 public:
83 FcVsFo(QString filename, double a,double b, double c, double al, double be, double ga, double lambda);
84 ~FcVsFo();
85 public slots:
86 	void delayMe();
87 	void readFCF();
88         void omitref();
89 	void st(int da);
90 	void zoomin();
91 	void zoomout();
92 	void zoomoff();
93 	void zoomfit();
94 	void selektiert();
95 	void graphChange(int type);
96 signals:
97 	void weg(const QString &);
98 private:
99 	QString fileName;
100 	int listType;
101 	QGraphicsView *view;
102 	GraphSceene *scene;
103 	QList<Refls> Fc,Fo;
104 	Omit omits;
105 	double foMax,foMin,fcMax,fcMin;
106 	QLabel *state,*state2;
107 	QTextBrowser *brw;
108 	QTimer *timer;
109 	MCell cell;
110 	QGraphicsItem *diagonale;
111 	QGraphicsTextItem *txt,*txt2;
112 };
113 #endif
114