File: fractalpresenter.h

package info (click to toggle)
fraqtive 0.4.3-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 988 kB
  • ctags: 1,249
  • sloc: cpp: 8,387; sh: 103; makefile: 45
file content (100 lines) | stat: -rw-r--r-- 2,640 bytes parent folder | download
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
/**************************************************************************
* This file is part of the Fraqtive program
* Copyright (C) 2004-2008 Michał Męciński
*
* 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 FRACTALPRESENTER_H
#define FRACTALPRESENTER_H

#include <QObject>

#include "datastructures.h"
#include "fractaldata.h"

class FractalModel;
class AbstractView;
class FractalGenerator;
class FractalData;

class FractalPresenter : public QObject
{
    Q_OBJECT
public:
    FractalPresenter( QObject* parent );
    ~FractalPresenter();

public:
    void setModel( FractalModel* model );
    void setView( AbstractView* view );

    void setPreviewMode( bool preview );
    void setPriority( int priority );

    void setEnabled( bool enabled );

    void setParameters( const FractalType& type, const Position& position );
    void setFractalType( const FractalType& type );
    void setPosition( const Position& position );

    void setColorSettings( const Gradient& gradient, const QColor& background, const ColorMapping& mapping );
    void setGradient( const Gradient& gradient );
    void setBackgroundColor( const QColor& color );
    void setColorMapping( const ColorMapping& mapping );

    void setGeneratorSettings( const GeneratorSettings& settings );
    void setViewSettings( const ViewSettings& settings );

    void setAnimationState( const AnimationState& state );

    const FractalData* fractalData();

    int maximumIterations() const;

    void setResolution( const QSize& resolution );

    void setHoveringPoint( const QPointF& point );
    void clearHovering();

    void setTrackingTransform( const QMatrix& transform );
    void clearTracking();

    void changePosition( const QMatrix& transform );

    void switchToJulia( const QPointF& point );

    void adjustCameraZoom( double delta );

protected: // overrides
    void customEvent( QEvent* e );

private:
    QMatrix matrixFromPosition( const Position& position );
    Position positionFromMatrix( const QMatrix& matrix );

    FractalType juliaType( const QPointF& point );
    Position juliaPosition();

private:
    FractalGenerator* m_generator;

    FractalModel* m_model;
    AbstractView* m_view;

    bool m_preview;

    bool m_enabled;

    FractalData m_data;

    FractalType m_type;
    Position m_position;

    QSize m_resolution;
};

#endif