00001
00002 #ifndef __J2K__JRectangle_HPP__
00003 #define __J2K__JRectangle_HPP__
00004
00005
00006 #include <j2k/Fred/StdTypes.hpp>
00007 #include <j2k/Fred/Basic.hpp>
00008 #include <j2k/Fred/Geometry/Point.hpp>
00009
00010 class JRectangle {
00011 public:
00012 JRectangle()
00013 JRectangle( double X );
00014 JRectangle( double X, double Y );
00015
00016 JRectangle( double X, double Y,
00017 double Length );
00018
00019 JRectangle( double X, double Y,
00020 double Length, double Width );
00021
00022 double getLength() const;
00023 double getWidth() const;
00024
00025 double area() const;
00026
00027 inline JRectangle& setJSquare( double X, double Y, double Length );
00028
00029 inline JRectangle& setJRectangle( double X, double Y,
00030 double Length, double Width );
00031
00032 inline JRectangle& setLength( double Length );
00033 inline JRectangle& setWidth( double Width );
00034
00035
00036
00037 friend ostream& operator<<( ostream &output, const JRectangle &rec )
00038 {
00039 output << "Position = " << rec.p
00040 << "; Length = "
00041 << setiosflags( ios::fixed | ios::showpoint )
00042 << setprecision( 2 ) << rec.length;
00043 << "; Width = "
00044 << setiosflags( ios::fixed | ios::showpoint )
00045 << setprecision( 2 ) << rec.width;
00046 return output;
00047 }
00048
00049
00050 inline JRectangle& setPoint( double X, double Y );
00051 inline JRectangle& setPolar( double X, double Y );
00052
00053 inline JRectangle& setX( double X );
00054 inline JRectangle& setY( double Y );
00055 inline JRectangle& setR( double R );
00056 inline JRectangle& setAngle( double Theta );
00057
00058 inline double getX() const;
00059 inline double getY() const;
00060 inline double getR() const;
00061 inline double getAngle() const;
00062
00063 protected:
00064 Point& p;
00065 double length;
00066 double width;
00067 double area_cache;
00068 };
00069
00070 #endif
00071
00072