summaryrefslogtreecommitdiffstats
path: root/kpovmodeler/pmheightfield.h
blob: 443226bac8d0a17a063307e7d916bad46d861cd9 (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
//-*-C++-*-
/*
**************************************************************************
                                 description
                             --------------------
    copyright            : (C) 2002 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 PMHEIGHTFIELD_H
#define PMHEIGHTFIELD_H

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

#include "pmsolidobject.h"

class PMViewStructure;
class PMHeightFieldROAM;

/**
 * Class for povray height fields.
 */

class PMHeightField : public PMSolidObject
{
   typedef PMSolidObject Base;
public:
   /**
    * Height field type
    */
   enum HeightFieldType { HFgif, HFtga, HFpot, HFpng, HFpgm, HFppm, HFsys };
   /**
    * Creates an empty PMHeightField
    */
   PMHeightField( PMPart* part );
   /**
    * Copy constructor
    */
   PMHeightField( const PMHeightField& f );
   /**
    * deletes the PMHeightField
    */
   virtual ~PMHeightField( );

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

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

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

   /**
    * Returns the height field type
    */
   HeightFieldType heightFieldType( ) const { return m_hfType; }
   /**
    * Sets the height field type
    */
   void setHeightFieldType( HeightFieldType t );
   /**
    * Returns the file name
    */
   TQString fileName( ) const { return m_fileName; }
   /**
    * Sets the file name
    */
   void setFileName( const TQString& name );
   /**
    * Returns the hierarchy flag
    */
   bool hierarchy( ) const { return m_hierarchy; }
   /**
    * Sets the hierarchy flag
    */
   void setHierarchy( bool h );
   /**
    * Returns the smooth flag
    */
   bool smooth( ) const { return m_smooth; }
   /**
    * Sets the smooth flag
    */
   void setSmooth( bool s );
   /**
    * Returns the water level
    */
   double waterLevel( ) const { return m_waterLevel; }
   /**
    * Sets the water level
    */
   void setWaterLevel( double wl );

   /**
    * Sets the heightfield variance
    */
   static void setVariance( int v );
   /**
    * Returns the heightfield variance
    */
   static int variance( ) { return s_variance; }

   /** */
   virtual void restoreMemento( PMMemento* s );
   /** */
   virtual bool hasDisplayDetail( ) const { return true; }
   /** */
   virtual void cleanUp( ) const;

   static TQString typeToString( HeightFieldType t );
   static HeightFieldType stringToType( const TQString &str );

protected:
   /** */
   virtual bool isDefault( );
   /** */
   virtual void createViewStructure( );
   /** */
   virtual PMViewStructure* defaultViewStructure( ) const;
   /** */
   virtual int viewStructureParameterKey( ) const { return s_parameterKey + globalDetailKey(); }

private:
   /**
    * Creates the ROAM view structure
    */
   void roamViewStructure( );

   /**
    * IDs for @ref PMMementoData
    */
   enum PMHeightFieldMementoID { PMHeightFieldTypeID, PMFileNameID,
                                 PMHierarchyID, PMSmoothID, PMWaterLevelID };

   HeightFieldType m_hfType;
   TQString m_fileName;
   bool m_hierarchy;
   bool m_smooth;
   double m_waterLevel;

   bool m_modMap;
   PMHeightFieldROAM* m_pROAM;

   /**
    * The default view structure. It can be shared between height fields
    */
   static PMViewStructure* s_pDefaultViewStructure;
   static int s_variance;
   static int s_parameterKey;

   static PMMetaObject* s_pMetaObject;
};

#endif