/usr/lib/Wt/examples/planner/Shape.h is in witty-examples 3.1.10-1ubuntu2.
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 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2010 Emweb bvba, Heverlee, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef SHAPE_H_
#define SHAPE_H_
#include <Wt/WPainter>
#include <Wt/WColor>
#include <Wt/WString>
class ShapeColor : public Wt::WColor
{
public:
ShapeColor(const Wt::WColor& color, const Wt::WString& colorName)
: WColor(color),
colorName_(colorName)
{ }
Wt::WString colorName() {
return colorName_;
}
private:
Wt::WString colorName_;
};
class Shape
{
public:
Shape(const Wt::WPointF& center, const ShapeColor& color, const double size)
: center_(center),
color_(color),
size_(size)
{}
virtual ~Shape();
virtual bool contains(const Wt::WPointF& point) const =0;
virtual Wt::WString shapeName() const =0;
virtual void paint(Wt::WPainter& painter) const =0;
ShapeColor color() const {
return color_;
}
double size() const {
return size_;
}
protected:
Wt::WPointF center() const {
return center_;
}
private:
Wt::WPointF center_;
ShapeColor color_;
double size_;
};
class Circle : public Shape
{
public:
Circle(const Wt::WPointF& center,
const ShapeColor& color,
const double size);
virtual bool contains(const Wt::WPointF& point) const;
virtual Wt::WString shapeName() const;
virtual void paint(Wt::WPainter& painter) const;
private:
double distanceTo(const double x1, const double y1,
const double x2, const double y2) const;
};
class Rectangle : public Shape
{
public:
Rectangle(const Wt::WPointF& center,
const ShapeColor& color,
const double size);
virtual bool contains(const Wt::WPointF& point) const;
virtual Wt::WString shapeName() const;
virtual void paint(Wt::WPainter& painter) const;
};
#endif // SHAPE_H_
|