This repository has been archived on 2020-09-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
libs/qad_blockview/blockviewwavetrace.h
Бычков Андрей ba8bc27298 1
git-svn-id: svn://db.shs.com.ru/libs@1 a8b55f48-bf90-11e4-a774-851b48703e85
2015-02-28 21:28:53 +00:00

44 lines
1.5 KiB
C++

#ifndef BLOCKVIEWWAVETRACE_H
#define BLOCKVIEWWAVETRACE_H
#include "blockitem.h"
class BlockViewWavetrace {
public:
BlockViewWavetrace(int width = 1, int height = 1);
enum CellState {Empty = -1, Blocked = -2};
enum Direction {Horizontal = 0, Vertical = 1};
int width() const {return wid;}
int height() const {return hei;}
void resize(int width, int height);
void resize(const QSize & sz) {resize(sz.width(), sz.height());}
void fill(short val = -1);
void fill(const QRect & rect, short val = -1);
void fill(const QPoint & point, short val = -1) {field[point.x()][point.y()] = val;}
void fill(int px, int py, short val = -1) {field[px][py] = val;}
void fill(BlockViewWavetrace::CellState val = Empty) {fill((short)val);}
void fill(const QRect & rect, BlockViewWavetrace::CellState val = Empty) {fill(rect, (short)val);}
void fill(const QPoint & point, BlockViewWavetrace::CellState val = Empty) {fill(point, (short)val);}
void fill(int px, int py, BlockViewWavetrace::CellState val = Empty) {fill(px, py, (short)val);}
void clear() {fill(-1);}
bool trace(const QPoint & start, const QPoint & finish);
Direction preferredDirection() const {return dir_;}
void setPreferredDirection(Direction dir);
void setMaximumSteps(int steps) {max_steps = steps;}
int maximumSteps() const {return max_steps;}
void gatherPath();
const QVector<QPoint> & path() const;
private:
int wid, hei, max_steps;
Direction dir_;
QVector<QVector<short> > field;
QVector<QPoint> path_;
QPoint dps[4], st, fn;
};
#endif // BLOCKVIEWWAVETRACE_H