/usr/include/paraview/pqAnimationModel.h is in paraview-dev 5.0.1+dfsg1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /*=========================================================================
Program: ParaView
Module: pqAnimationModel.h
Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#ifndef pqAnimationModel_h
#define pqAnimationModel_h
#include "pqWidgetsModule.h"
#include <QObject>
#include <QGraphicsScene>
#include <QStandardItemModel>
#include <QPolygonF>
class pqAnimationTrack;
class pqAnimationKeyFrame;
class QGraphicsView;
class pqCheckBoxPixMaps;
// a model that represents a collection of animation tracks
class PQWIDGETS_EXPORT pqAnimationModel : public QGraphicsScene
{
Q_OBJECT
Q_ENUMS(ModeType)
Q_PROPERTY(ModeType mode READ mode WRITE setMode)
Q_PROPERTY(int ticks READ ticks WRITE setTicks)
Q_PROPERTY(double currentTime READ currentTime WRITE setCurrentTime)
Q_PROPERTY(double startTime READ startTime WRITE setStartTime)
Q_PROPERTY(double endTime READ endTime WRITE setEndTime)
Q_PROPERTY(bool interactive READ interactive WRITE setInteractive)
public:
/// Real, Sequence or Custom mode
/// Real mode shows no tick marks for timesteps
/// Sequence mode shows evenly spaced ticks for teach timestep
/// where the number of ticks can be controled by the ticks property
/// Custom shows tick marks at the location indicated by the setTickMarks().
enum ModeType
{
Real,
Sequence,
Custom
};
pqAnimationModel(QGraphicsView* p = 0);
~pqAnimationModel();
/// the number of tracks
int count();
/// get a track at an index
pqAnimationTrack* track(int);
/// add a track.
/// If \c trackToAdd is NULL, we create a new pqAnimationTrack instance.
pqAnimationTrack* addTrack(pqAnimationTrack* trackToAdd=NULL);
/// remove a track
void removeTrack(pqAnimationTrack* track);
/// get the animation mode
ModeType mode() const;
/// get the number of ticks
int ticks() const;
/// get the current time
double currentTime() const;
/// get the start time
double startTime() const;
/// get the end time
double endTime() const;
/// get whether this scene is interactive
bool interactive() const;
QAbstractItemModel* header();
QAbstractItemModel* enabledHeader();
void setRowHeight(int);
int rowHeight() const;
/// provides access to the custom ticks set using
/// setTickMarks() method.
const QList<double>& customTicks() const
{ return this->CustomTicks; }
/// set the tooltip to use for the checkbox in the EnabledHeader.
/// default is "Enable/Disable Track".
void setEnabledHeaderToolTip(const QString& val);
const QString& enabledHeaderToolTip() const
{ return this->EnabledHeaderToolTip; }
public slots:
/// set the animation mode
void setMode(ModeType);
/// set the number of ticks
void setTicks(int);
/// set the current time
void setCurrentTime(double);
/// set the start time
void setStartTime(double);
/// set the end time
void setEndTime(double);
/// set whether this scene is interactive
void setInteractive(bool);
/// set the locations for tick marks if Mode is Custom.
/// This also results in a call to setTicks().
void setTickMarks(int num, double* tick_marks);
signals:
// emitted when a track is double clicked on
void trackSelected(pqAnimationTrack*);
// emitted when the current time was changed by this model
void currentTimeSet(double);
// emitted when the time of a keyframe was changed by this model
void keyFrameTimeChanged(pqAnimationTrack* track, pqAnimationKeyFrame* kf, int end, double time);
protected slots:
void resizeTracks();
void trackNameChanged();
void enabledChanged();
protected:
QPolygonF timeBarPoly(double time);
double positionFromTime(double time);
double timeFromPosition(double pos);
double timeFromTick(int tick);
int tickFromTime(double pos);
void drawForeground(QPainter* painter, const QRectF& rect);
bool hitTestCurrentTimePoly(const QPointF& pos);
pqAnimationTrack* hitTestTracks(const QPointF& pos);
pqAnimationKeyFrame* hitTestKeyFrame(pqAnimationTrack* t, const QPointF& pos);
bool eventFilter(QObject* w, QEvent* e);
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* mouseEvent);
void mousePressEvent(QGraphicsSceneMouseEvent* mouseEvent);
void mouseMoveEvent(QGraphicsSceneMouseEvent* mouseEvent);
void mouseReleaseEvent(QGraphicsSceneMouseEvent* mouseEvent);
double timeToNormalizedTime(double) const;
double normalizedTimeToTime(double) const;
/// Based on this->Mode, this will either returns the number of custom ticks
/// or return this->ticks().
int currentTicks() const;
private:
ModeType Mode;
int Ticks;
double CurrentTime;
double StartTime;
double EndTime;
int RowHeight;
bool Interactive;
QList<double> CustomTicks;
// vars to support interaction
bool CurrentTimeGrabbed;
double NewCurrentTime;
pqAnimationTrack* CurrentTrackGrabbed;
pqAnimationKeyFrame* CurrentKeyFrameGrabbed;
int CurrentKeyFrameEdge;
QPair<double, double> InteractiveRange;
QList<double> SnapHints;
QList<pqAnimationTrack*> Tracks;
// model that provides names of tracks
QStandardItemModel Header;
// model that provides enabled state for the tracks.
QStandardItemModel EnabledHeader;
pqCheckBoxPixMaps* CheckBoxPixMaps;
QString EnabledHeaderToolTip;
};
#endif // pqAnimationModel_h
|