2001-06-25 00:06:33 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
|
|
|
|
#ifndef MATHEDXARRAY_H
|
|
|
|
#define MATHEDXARRAY_H
|
|
|
|
|
|
|
|
#include <iosfwd>
|
2001-11-08 12:55:58 +00:00
|
|
|
|
|
|
|
#include "math_data.h"
|
2001-10-19 17:46:13 +00:00
|
|
|
#include "math_metricsinfo.h"
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class Painter;
|
|
|
|
|
|
|
|
class MathXArray
|
|
|
|
{
|
|
|
|
public:
|
2001-09-14 14:05:57 +00:00
|
|
|
///
|
2001-10-12 12:02:49 +00:00
|
|
|
typedef MathArray::size_type size_type;
|
|
|
|
///
|
|
|
|
typedef MathArray::const_iterator const_iterator;
|
2001-09-14 14:05:57 +00:00
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
///
|
|
|
|
MathXArray();
|
|
|
|
///
|
2001-10-19 11:25:48 +00:00
|
|
|
void metrics(MathMetricsInfo const & st) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
///
|
2001-08-06 17:20:26 +00:00
|
|
|
void draw(Painter & pain, int x, int y) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
int xo() const { return xo_; }
|
|
|
|
///
|
|
|
|
int yo() const { return yo_; }
|
|
|
|
///
|
2001-10-12 12:02:49 +00:00
|
|
|
int pos2x(size_type pos) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
///
|
2001-09-14 14:05:57 +00:00
|
|
|
size_type x2pos(int pos) const;
|
2001-11-22 10:14:19 +00:00
|
|
|
/// returns distance of this cell to the point given by x and y
|
|
|
|
// assumes valid position and size cache
|
|
|
|
int dist(int x, int y) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
int ascent() const { return ascent_; }
|
|
|
|
///
|
|
|
|
int descent() const { return descent_; }
|
|
|
|
///
|
|
|
|
int height() const { return ascent_ + descent_; }
|
|
|
|
///
|
|
|
|
int width() const { return width_; }
|
2001-11-26 13:35:08 +00:00
|
|
|
/// do we cover point(x, y)?
|
|
|
|
bool covers(int x, int y) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
///
|
|
|
|
const_iterator begin() const { return data_.begin(); }
|
|
|
|
///
|
|
|
|
const_iterator end() const { return data_.end(); }
|
|
|
|
|
|
|
|
public:
|
2001-06-25 00:06:33 +00:00
|
|
|
///
|
|
|
|
MathArray data_;
|
|
|
|
///
|
2001-08-06 17:20:26 +00:00
|
|
|
mutable int width_;
|
2001-06-25 00:06:33 +00:00
|
|
|
///
|
2001-08-06 17:20:26 +00:00
|
|
|
mutable int ascent_;
|
2001-06-25 00:06:33 +00:00
|
|
|
///
|
2001-08-06 17:20:26 +00:00
|
|
|
mutable int descent_;
|
2001-06-25 00:06:33 +00:00
|
|
|
///
|
2001-08-06 17:20:26 +00:00
|
|
|
mutable int xo_;
|
2001-06-25 00:06:33 +00:00
|
|
|
///
|
2001-08-06 17:20:26 +00:00
|
|
|
mutable int yo_;
|
2001-06-25 00:06:33 +00:00
|
|
|
///
|
2001-10-19 17:46:13 +00:00
|
|
|
mutable MathMetricsInfo size_;
|
2001-06-25 00:06:33 +00:00
|
|
|
};
|
|
|
|
|
2001-07-04 17:17:32 +00:00
|
|
|
std::ostream & operator<<(std::ostream & os, MathXArray const & ar);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
|
|
#endif
|