Rectangle2D.h

Go to the documentation of this file.
00001 #ifndef JAVA_AWT_GEOM_RECTANGLE2D_H
00002 #define JAVA_AWT_GEOM_RECTANGLE2D_H 1
00003 
00004 #ifndef JAVA_AWT_GEOM_RECTANGULARSHAPE_H
00005 #include <java_awt_geom/RectangularShape.h>
00006 #endif /* JAVA_AWT_GEOM_RECTANGULARSHAPE_H */
00007 #ifndef JAVA_AWT_GEOM_LINE2D_H
00008 #include <java_awt_geom/Line2D.h>
00009 #endif /* JAVA_AWT_GEOM_LINE2D_H */
00010 #ifndef JAVA_AWT_SPEC
00011 #include <java_awt/Spec.h>
00012 #endif /* JAVA_AWT_SPEC */
00013 
00014 namespace java {
00015   namespace awt {
00016     namespace geom {
00017 
00031       class JAVA_AWT_SPEC Rectangle2D : public RectangularShape {
00032 
00033       public:
00034 
00035         class Float;
00036         class Double;
00037 
00038         enum POINT_INDICATOR {
00039           OUT_LEFT = 1,
00040           OUT_TOP = 2,
00041           OUT_RIGHT = 4,
00042           OUT_BOTTOM = 8,
00043         };
00044 
00057         virtual void setRect(jdouble x, jdouble y, jdouble w, jdouble) = 0;
00058 
00065         virtual void setRect(const Rectangle2D& r);
00066 
00079         virtual jboolean intersectsLine(jdouble x1, jdouble y1, jdouble x2, jdouble y2) const;
00080 
00091         virtual jboolean intersectsLine(const Line2D& l) const;
00092 
00108         virtual jint outcode(jdouble x, jdouble) const = 0;
00109 
00125         virtual jint outcode(const Point2D& p) const;
00126 
00139         virtual void setFrame(jdouble x, jdouble y, jdouble w, jdouble h);
00140 
00151         virtual void setFrame(const Point2D& loc, const Dimension2D& size);
00152 
00161         virtual void setFrame(const Rectangle2D& r);
00162 
00169         virtual Ref<Rectangle2D> getBounds2D() const;
00170 
00180         virtual jboolean contains(jdouble x, jdouble y) const;
00181 
00191         virtual jboolean contains(const Point2D& p) const;
00192 
00208         virtual jboolean intersects(jdouble x, jdouble y, jdouble w, jdouble h) const;
00209 
00233         virtual jboolean intersects(const Rectangle2D& r) const;
00234         
00249         virtual jboolean contains(jdouble x, jdouble y, jdouble w, jdouble h) const;
00250 
00279         virtual jboolean contains(const Rectangle2D& r) const;
00280 
00292         virtual Ref<Rectangle2D> createIntersection(const Rectangle2D& r) const = 0;
00293 
00310         static void intersect(const Rectangle2D& src1, const Rectangle2D& src2, Rectangle2D& dest);
00311 
00323         virtual Ref<Rectangle2D> createUnion(const Rectangle2D& r) const = 0;
00324 
00341         static void unionOf(const Rectangle2D& src1, const Rectangle2D& src2, Rectangle2D& dest);
00342 
00361         virtual void add(jdouble newx, jdouble newy);
00362 
00381         virtual void add(const Point2D& pt);
00382 
00391         virtual void add(const Rectangle2D& r);
00392 
00414         virtual Ref<PathIterator> getPathIterator(const AffineTransform& at, jdouble flatness = -1.0) const;
00415 
00420         virtual jint hashCode() const;
00421 
00422 
00436         virtual jboolean equals(const Object& obj) const;
00437 
00438       private:
00439 
00440         REGISTER_MEMBERS;
00441 
00442       };
00443 
00444       class Rectangle2D::Float : public Rectangle2D {
00445 
00446       public:
00447 
00452         jfloat x;
00453 
00458         jfloat y;
00459 
00464         jfloat width;
00465 
00470         jfloat height;
00471 
00472         Float(jfloat x = 0, jfloat y = 0, jfloat w = 0, jfloat h = 0);
00473 
00480         virtual jdouble getX() const;
00481 
00488         virtual jdouble getY() const;
00489 
00496         virtual jdouble getWidth() const;
00497 
00504         virtual jdouble getHeight() const;
00505 
00513         virtual jboolean isEmpty() const;
00514 
00527         virtual void setRect(jfloat x, jfloat y, jfloat w, jfloat h);
00528 
00540         virtual void setRect(jdouble x, jdouble y, jdouble w, jdouble h);
00541 
00548         virtual void setRect(const Rectangle2D& r);
00549         
00565         virtual jint outcode(jdouble x, jdouble y) const;
00566 
00582         virtual jint outcode(const Point2D& p) const;
00583 
00590         virtual Ref<Rectangle2D> getBounds2D() const;
00591 
00603         virtual Ref<Rectangle2D> createIntersection(const Rectangle2D& r) const;
00604 
00616         virtual Ref<Rectangle2D> createUnion(const Rectangle2D& r) const;
00617 
00618       private:
00619 
00620         REGISTER_MEMBERS;
00621 
00622       };
00623 
00624       class Rectangle2D::Double : public Rectangle2D {
00625 
00626       public:
00627 
00632         jdouble x;
00633 
00638         jdouble y;
00639 
00644         jdouble width;
00645 
00650         jdouble height;
00651 
00652         Double(jdouble x = 0, jdouble y = 0, jdouble w = 0, jdouble h = 0);
00653 
00660         virtual jdouble getX() const;
00661 
00668         virtual jdouble getY() const;
00669 
00676         virtual jdouble getWidth() const;
00677 
00684         virtual jdouble getHeight() const;
00685 
00693         virtual jboolean isEmpty() const;
00694 
00706         virtual void setRect(jdouble x, jdouble y, jdouble w, jdouble h);
00707 
00714         virtual void setRect(const Rectangle2D& r);
00715         
00731         virtual jint outcode(jdouble x, jdouble y) const;
00732 
00748         virtual jint outcode(const Point2D& p) const;
00749 
00756         virtual Ref<Rectangle2D> getBounds2D() const;
00757 
00769         virtual Ref<Rectangle2D> createIntersection(const Rectangle2D& r) const;
00770 
00782         virtual Ref<Rectangle2D> createUnion(const Rectangle2D& r) const;
00783 
00784       private:
00785 
00786         REGISTER_MEMBERS;
00787 
00788       };
00789 
00790     } // namespace geom
00791   } // namespace awt
00792 } // namespace java
00793 
00794 #endif /* JAVA_AWT_GEOM_RECTANGLE2D_H */

Generated on Fri May 16 11:54:43 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3