summaryrefslogtreecommitdiffstats
path: root/kpovmodeler/pmisosurface.h
blob: 298f7b26cbd0d92e73c80484fb5945cfb22aadea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
//-*-C++-*-
/*
**************************************************************************
                                 description
                             --------------------
    copyright            : (C) 2003 by Andreas Zehender
    email                : zehender@kde.org
**************************************************************************

**************************************************************************
*                                                                        *
*  This program is free software; you can redistribute it and/or modify  *
*  it under the terms of the GNU General Public License as published by  *
*  the Free Software Foundation; either version 2 of the License, or     *
*  (at your option) any later version.                                   *
*                                                                        *
**************************************************************************/


#ifndef PMISOSURFACE_H
#define PMISOSURFACE_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "pmsolidobject.h"
#include "pmvector.h"

class PMViewStructure;

/**
 * Class for povray boxes.
 */

class PMIsoSurface : public PMSolidObject
{
   typedef PMSolidObject Base;
public:
   /**
    * Enum for the "contained_by" statement
    */
   enum ContainedByType { Box, Sphere };
   /**
    * Creates an empty PMIsoSurface
    */
   PMIsoSurface( PMPart* part );
   /**
    * Copy constructor
    */
   PMIsoSurface( const PMIsoSurface& b );
   /**
    * deletes the PMIsoSurface
    */
   virtual ~PMIsoSurface( );

   /** */
   virtual PMObject* copy( ) const { return new PMIsoSurface( *this ); }
   /** */
   virtual TQString description( ) const;

   /** */
   virtual PMMetaObject* tqmetaObject( ) const;

   /** */
   virtual void serialize( TQDomElement& e, TQDomDocument& doc ) const;
   /** */
   virtual void readAttributes( const PMXMLHelper& h );
   /**
    * Returns a new @ref PMIsoSurfaceEdit
    */
   virtual PMDialogEditBase* editWidget( TQWidget* tqparent ) const;
   /**
    * Returns the name of the pixmap that is displayed in the tree view
    * and dialog view
    */
   virtual TQString pixmap( ) const { return TQString( "pmisosurface" ); }


   /**
    * Sets the isosurface function
    */
   void setFunction( const TQString& f );
   /**
    * Returns the isosurface function
    */
   TQString function( ) const { return m_function; }
   /**
    * Sets the type of the contained_by object
    */
   void setContainedBy( ContainedByType type );
   /**
    * Returns the type of the contained_by object
    */
   ContainedByType containedBy( ) const { return m_containedBy; }
   /**
    * Sets the first corner of a contained_by box
    */
   void setCorner1( const PMVector& v );
   /**
    * Returns the first corner of a contained_by box
    */
   PMVector corner1( ) const { return m_corner1; }
   /**
    * Sets the second corner of a contained_by box
    */
   void setCorner2( const PMVector& v );
   /**
    * Returns the second corner of a contained_by box
    */
   PMVector corner2( ) const { return m_corner2; }
   /**
    * Sets the center of a contained_by sphere
    */
   void setCenter( const PMVector& v );
   /**
    * Returns the center of a contained_by sphere
    */
   PMVector center( ) const { return m_center; }
   /**
    * Sets the radius of a contained_by sphere
    */
   void setRadius( double r );
   /**
    * Returns the radius of a contained_by sphere
    */
   double radius( ) const { return m_radius; }
   /**
    * Sets the threshold
    */
   void setThreshold( double d );
   /**
    * Returns the Threshold
    */
   double threshold( ) const { return m_threshold; }
   /**
    * Sets the accuracy
    */
   void setAccuracy( double d );
   /**
    * Returns the accuracy
    */
   double accuracy( ) const { return m_accuracy; }
   /**
    * Sets the maximal gradient
    */
   void setMaxGradient( double d );
   /**
    * Returns the maximal Gradient
    */
   double maxGradient( ) const { return m_maxGradient; }
   /**
    * Enables/disables the evaluate statement
    */
   void setEvaluate( bool yes );
   /**
    * Returns the evaluate flag
    */
   bool evaluate( ) const { return m_bEvaluate; }
   /**
    * Sets the i-th evaluate value, index is in [0..2]
    */
   void setEvaluateValue( int index, double v );
   /**
    * Returns the i-th evaluate value
    */
   double evaluateValue( int index ) const { return m_evaluate[index]; }
   /**
    * Sets the open flag
    */
   void setOpen( bool yes );
   /**
    * Returns the open flag
    */
   bool open( ) const { return m_bOpen; }
   /**
    * Sets the maximal number of intersections
    */
   void setMaxTrace( int i );
   /**
    * Returns the maximal number of intersections
    */
   int maxTrace( ) const { return m_maxTrace; }
   /**
    * Sets the all intersections flag
    */
   void setAllIntersections( bool yes );
   /**
    * Returns the all intersections flag
    */
   bool allIntersections( ) const { return m_bAllIntersections; }


   /** */
   virtual void restoreMemento( PMMemento* s );
   /** */
   virtual void cleanUp( ) const;

protected:
   /** */
   //virtual bool isDefault( );
   /** */
   //virtual void createViewStructure( );
   /** */
   //virtual PMViewStructure* defaultViewStructure( ) const;

private:
   /**
    * IDs for @ref PMMementoData
    */
   enum PMIsoSurfaceMementoID { FunctionID, ContainedByID, Corner1ID, Corner2ID,
                                CenterID, RadiusID, ThresholdID, AccuracyID,
                                MaxGradientID, EvaluateID,
                                Evaluate0ID, Evaluate1ID, Evaluate2ID,
                                OpenID, MaxTraceID, AllIntersectionsID };

   TQString m_function;
   ContainedByType m_containedBy;
   PMVector m_corner1, m_corner2, m_center;
   double m_radius, m_threshold, m_accuracy, m_maxGradient;
   bool m_bEvaluate;
   double m_evaluate[3];
   bool m_bOpen;
   int m_maxTrace;
   bool m_bAllIntersections;

   /**
    * The default view structure. It can be shared between boxes
    */
   static PMViewStructure* s_pDefaultViewStructure;
   static PMMetaObject* s_pMetaObject;
};

#endif