From 47d455dd55be855e4cc691c32f687f723d9247ee Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kpovmodeler/pmtexturemap.h | 368 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 368 insertions(+) create mode 100644 kpovmodeler/pmtexturemap.h (limited to 'kpovmodeler/pmtexturemap.h') diff --git a/kpovmodeler/pmtexturemap.h b/kpovmodeler/pmtexturemap.h new file mode 100644 index 00000000..227c7e1f --- /dev/null +++ b/kpovmodeler/pmtexturemap.h @@ -0,0 +1,368 @@ +//-*-C++-*- +/* +************************************************************************** + description + -------------------- + copyright : (C) 2001-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 PMTEXTUREMAP_H +#define PMTEXTUREMAP_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "pmtexturebase.h" +#include "pmvector.h" + +#include + +/** + * Base class for color, pigment, texture and normal maps + */ + +class PMTextureMapBase : public PMTextureBase +{ + typedef PMTextureBase Base; +public: + /** + * Creates a PMTextureMapBase + */ + PMTextureMapBase( PMPart* part ); + /** + * Copy constructor + */ + PMTextureMapBase( const PMTextureMapBase& b ); + /** + * deletes the PMTextureMapBase + */ + virtual ~PMTextureMapBase( ); + + /** */ + virtual bool dataChangeOnInsertRemove( ) const { return true; } + + /** */ + virtual PMMetaObject* metaObject( ) const; + /** */ + virtual void cleanUp( ) const; + + /** */ + virtual void childAdded( PMObject* o ); + /** */ + virtual bool takeChild( PMObject* o ); + + /** */ + virtual void serialize( QDomElement& e, QDomDocument& doc ) const; + /** */ + virtual void readAttributes( const PMXMLHelper& h ); + + /** + * Returns the map object type + */ + virtual QString mapType( ) const = 0; + + /** + * Returns a new @ref PMTextureMapEdit + */ + virtual PMDialogEditBase* editWidget( QWidget* parent ) const; + + /** */ + virtual void createMemento( ); + /** */ + virtual void restoreMemento( PMMemento* s ); + + /** + * Returns the map values + */ + QValueList mapValues( ) const { return m_mapValues; } + /** + * Sets the map values + */ + void setMapValues( const QValueList& v ); + /** + * Returns the map value for the object o + */ + double mapValue( const PMObject* o ) const; + /** + * Returns the number of map entries + */ + int mapEntries( ) const { return m_mapValues.size( ); } + +private: + PMObject* nextMapEntry( PMObject* o ); + void stringToValues( const QString& str ); + QString valuesToString( ) const; + QValueList::Iterator valueForChild( PMObject* o ); + + /** + * IDs for @ref PMMementoData + */ + // enum PMTextureMapBaseMementoID { }; + + /** + * list of map values + */ + QValueList m_mapValues; + /** + * removed map values + */ + QValueList m_removedValues; + + static PMMetaObject* s_pMetaObject; +}; + + +/** + * Class for texture maps + */ + +class PMTextureMap : public PMTextureMapBase +{ +public: + typedef PMTextureMapBase Base; + /** + * Creates a texture map + */ + PMTextureMap( PMPart* part ); + /** + * Copy constructor + */ + PMTextureMap( const PMTextureMap& m ); + /** + * Deletes the texture map + */ + virtual ~PMTextureMap( ); + + /** */ + virtual PMObject* copy( ) const { return new PMTextureMap( *this ); } + /** */ + virtual QString description( ) const; + /** */ + virtual QString mapType( ) const { return QString( "Texture" ); } + + /** */ + virtual PMMetaObject* metaObject( ) const; + /** */ + virtual void cleanUp( ) const; + + /** */ + virtual QString pixmap( ) const { return QString( "pmtexturemap" ); } + +private: + static PMMetaObject* s_pMetaObject; +}; + +/** + * Class for pigment maps + */ + +class PMPigmentMap : public PMTextureMapBase +{ +public: + typedef PMTextureMapBase Base; + /** + * Creates a pigment map + */ + PMPigmentMap( PMPart* part ); + /** + * Copy constructor + */ + PMPigmentMap( const PMPigmentMap& m ); + /** + * Deletes the pigment map + */ + virtual ~PMPigmentMap( ); + + /** */ + virtual PMObject* copy( ) const { return new PMPigmentMap( *this ); } + /** */ + virtual QString description( ) const; + /** */ + virtual QString mapType( ) const { return QString( "Pigment" ); } + + /** */ + virtual PMMetaObject* metaObject( ) const; + /** */ + virtual void cleanUp( ) const; + + /** */ + virtual QString pixmap( ) const { return QString( "pmpigmentmap" ); } + +private: + static PMMetaObject* s_pMetaObject; +}; + +/** + * Class for color maps + */ + +class PMColorMap : public PMTextureMapBase +{ +public: + typedef PMTextureMapBase Base; + /** + * Creates a color map + */ + PMColorMap( PMPart* part ); + /** + * Copy constructor + */ + PMColorMap( const PMColorMap& m ); + /** + * Deletes the color map + */ + virtual ~PMColorMap( ); + + /** */ + virtual PMObject* copy( ) const { return new PMColorMap( *this ); } + /** */ + virtual QString description( ) const; + /** */ + virtual QString mapType( ) const { return QString( "SolidColor" ); } + + /** */ + virtual PMMetaObject* metaObject( ) const; + /** */ + virtual void cleanUp( ) const; + + /** */ + virtual QString pixmap( ) const { return QString( "pmcolormap" ); } + +private: + static PMMetaObject* s_pMetaObject; +}; + + +/** + * Class for normal maps + */ + +class PMNormalMap : public PMTextureMapBase +{ +public: + typedef PMTextureMapBase Base; + /** + * Creates a normal map + */ + PMNormalMap( PMPart* part ); + /** + * Copy constructor + */ + PMNormalMap( const PMNormalMap& m ); + /** + * Deletes the normal map + */ + virtual ~PMNormalMap( ); + + /** */ + virtual PMObject* copy( ) const { return new PMNormalMap( *this ); } + /** */ + virtual QString description( ) const; + /** */ + virtual QString mapType( ) const { return QString( "Normal" ); } + + /** */ + virtual PMMetaObject* metaObject( ) const; + /** */ + virtual void cleanUp( ) const; + + /** */ + virtual QString pixmap( ) const { return QString( "pmnormalmap" ); } + +private: + static PMMetaObject* s_pMetaObject; +}; + +/** + * Class for slope maps + */ + +class PMSlopeMap : public PMTextureMapBase +{ +public: + typedef PMTextureMapBase Base; + /** + * Creates a slope map + */ + PMSlopeMap( PMPart* part ); + /** + * Copy constructor + */ + PMSlopeMap( const PMSlopeMap& m ); + /** + * Deletes the slope map + */ + virtual ~PMSlopeMap( ); + + /** */ + virtual PMObject* copy( ) const { return new PMSlopeMap( *this ); } + /** */ + virtual QString description( ) const; + /** */ + virtual QString mapType( ) const { return QString( "Slope" ); } + + /** */ + virtual PMMetaObject* metaObject( ) const; + /** */ + virtual void cleanUp( ) const; + + /** */ + virtual QString pixmap( ) const { return QString( "pmslopemap" ); } + +private: + static PMMetaObject* s_pMetaObject; +}; + +/** + * Class for density maps + */ + +class PMDensityMap : public PMTextureMapBase +{ +public: + typedef PMTextureMapBase Base; + /** + * Creates a density map + */ + PMDensityMap( PMPart* part ); + /** + * Copy constructor + */ + PMDensityMap( const PMDensityMap& m ); + /** + * Deletes the density map + */ + virtual ~PMDensityMap( ); + + /** */ + virtual PMObject* copy( ) const { return new PMDensityMap( *this ); } + /** */ + virtual QString description( ) const; + /** */ + virtual QString mapType( ) const { return QString( "Density" ); } + + /** */ + virtual PMMetaObject* metaObject( ) const; + /** */ + virtual void cleanUp( ) const; + + /** */ + virtual QString pixmap( ) const { return QString( "pmdensitymap" ); } + +private: + static PMMetaObject* s_pMetaObject; +}; + +#endif -- cgit v1.2.1