Logo Search packages:      
Sourcecode: kmess version File versions  Download package

isfqtdrawing.h

/***************************************************************************
 *   Copyright (C) 2009 by Valerio Pilo                                    *
 *   valerio@kmess.org                                                     *
 *                                                                         *
 *   Copyright (C) 2009 by Adam Goossens                                   *
 *   adam@kmess.org                                                        *
 ***************************************************************************/

/***************************************************************************
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Lesser General Public License as        *
 *   published by the Free Software Foundation; either version 2.1 of the  *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU Lesser General Public      *
 *   License along with this program; if not, write to the                 *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef ISFQTDRAWING_H
#define ISFQTDRAWING_H

#include <IsfQt>

#include <QMap>
#include <QMatrix>
#include <QPaintDevice>
#include <QUuid>
#include <QPixmap>


// Forward declarations
class QByteArray;



namespace Isf
{



  /**
   * @class Drawing
   * @brief This is a manipulable representation of an ISF stream.
   *
   * This class is a container for the data of ISF (Ink Serialized Format)
   * drawings. You can manipulate its contents, or create a new one and
   * fill it, then save it back to ISF format with the Isf::Stream methods.
   *
   * @see Isf::Stream
   * @author Adam Goossens (adam@kmess.org)
   * @author Valerio Pilo (valerio@kmess.org)
   */
00060   class Drawing
  {
    friend class Stream;
    friend class TagsParser;
    friend class TagsWriter;

    public: // public constructors
                                 Drawing();
                                 Drawing( const Drawing &other );
                                ~Drawing();

    public: // public state retrieval methods
      AttributeSet              *attributeSet( quint32 index );
      const QList<AttributeSet*> attributeSets();
      QRect                      boundingRect();
      void                       clear();
      IsfError                   error() const;
      bool                       isNull() const;
      QPixmap                    pixmap( const QColor backgroundColor = Qt::white );
      QSize                      size();
      Stroke                    *stroke( quint32 index );
      Stroke                    *strokeAtPoint( const QPoint &point );
      const QList<Stroke*>       strokes();
      QMatrix                   *transform( quint32 index );
      const QList<QMatrix*>      transforms();

    public: // public manipulation methods
      qint32                     addAttributeSet( AttributeSet *newAttributeSet );
      qint32                     addStroke( Stroke *newStroke );
      qint32                     addTransform( QMatrix *newTransform );
      bool                       deleteAttributeSet( quint32 index );
      bool                       deleteStroke( quint32 index );
      bool                       deleteStroke( Stroke *stroke ) ;
      bool                       deleteTransform( quint32 index );
      bool                       setCurrentAttributeSet( AttributeSet *attributeSet );
      bool                       setCurrentTransform( QMatrix *transform );

    private: // Private properties
      /// List of attributes of the points in the drawing
00099       QList<AttributeSet*>       attributeSets_;
      /// Bounding rectangle of the drawing
00101       QRect                      boundingRect_;
      /// Cached bounding rectangle
00103       QRect                      cacheRect_;
      /// The cached pixmap
00105       QPixmap                    cachePixmap_;
      /// Virtual drawing canvas dimensions
00107       QRect                      canvas_;
      /// A list of strokes that need to be repainted.
00109       QList<Stroke*>             changedStrokes_;
      /// Link to the currently used metric data
00111       Metrics                   *currentMetrics_;
      /// Link to the currently used point info data
00113       AttributeSet              *currentAttributeSet_;
      /// Link to the currently used stroke info data
00115       StrokeInfo                *currentStrokeInfo_;
      /// Link to the currently used transformation
00117       QMatrix                   *currentTransform_;
      /// Link to the default metric data
00119       Metrics                    defaultMetrics_;
      /// Link to the default point info data
00121       AttributeSet               defaultAttributeSet_;
      /// Link to the default stroke info data
00123       StrokeInfo                 defaultStrokeInfo_;
      /// Link to the default transformation
00125       QMatrix                    defaultTransform_;
      /// Is the drawing dirty? i.e, requires repainting?
00127       bool                       dirty_;
      /// Last parsing error (if there is one)
00129       IsfError                   error_;
      /// List of registered GUIDs
00131       QList<QUuid>               guids_;
      /// Whether the drawing contains X coordinates or not
00133       bool                       hasXData_;
      /// Whether the drawing contains Y coordinates or not
00135       bool                       hasYData_;
      /// Whether the drawing is invalid or valid
00137       bool                       isNull_;
      /// Maximum GUID available in the drawing
00139       quint64                    maxGuid_;
      /// Maximum thickness of the strokes
00141       QSizeF                     maxPenSize_;
      /// List of metrics used in the drawing
00143       QList<Metrics*>            metrics_;
      /// Pixel size of the drawing
00145       QSize                      size_;
      /// List of information about the drawing's strokes
00147       QList<StrokeInfo*>         strokeInfo_;
      /// List of strokes composing this drawing
00149       QList<Stroke*>             strokes_;
      /// Transformation matrices
00151       QList<QMatrix*>            transforms_;

  };



}; // namespace Isf



#endif // ISFQTDRAWING_H

Generated by  Doxygen 1.6.0   Back to index