00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PDBLOCK_H
00021 #define PDBLOCK_H
00022
00023 #include "clst.h"
00024 #include "img.h"
00025 #include "strngs.h"
00026 #include "polyblk.h"
00027
00028 #include "hpddef.h"
00029
00030 class DLLSYM PDBLK;
00031 struct Pix;
00032
00033 CLISTIZEH (PDBLK)
00035 class PDBLK
00036 {
00037 friend class BLOCK_RECT_IT;
00038
00039 public:
00041 PDBLK() {
00042 hand_poly = NULL;
00043 index_ = 0;
00044 }
00046 PDBLK(inT16 xmin,
00047 inT16 ymin,
00048 inT16 xmax,
00049 inT16 ymax);
00050
00054 void set_sides(ICOORDELT_LIST *left,
00055 ICOORDELT_LIST *right);
00056
00058 ~PDBLK () {
00059 if (hand_poly) delete hand_poly;
00060 }
00061
00062 POLY_BLOCK *poly_block() const {
00063 return hand_poly;
00064 }
00066 void set_poly_block(POLY_BLOCK *blk) {
00067 hand_poly = blk;
00068 }
00070 void bounding_box(ICOORD &bottom_left,
00071 ICOORD &top_right) const {
00072 bottom_left = box.botleft ();
00073 top_right = box.topright ();
00074 }
00076 const TBOX &bounding_box() const {
00077 return box;
00078 }
00079
00080 int index() const {
00081 return index_;
00082 }
00083 void set_index(int value) {
00084 index_ = value;
00085 }
00086
00088 BOOL8 contains(ICOORD pt);
00089
00091 void move(const ICOORD vec);
00092
00093
00094
00095 Pix* render_mask(const FCOORD& rerotation);
00100 void plot(ScrollView* window,
00101 inT32 serial,
00102 ScrollView::Color colour);
00103
00107 void show(IMAGE *image,
00108 ScrollView* window);
00109
00112 PDBLK & operator= (const PDBLK & source);
00113
00114 protected:
00115 POLY_BLOCK *hand_poly;
00116 ICOORDELT_LIST leftside;
00117 ICOORDELT_LIST rightside;
00118 TBOX box;
00119 int index_;
00120 };
00121
00122 class DLLSYM BLOCK_RECT_IT
00123 {
00124 public:
00127 BLOCK_RECT_IT(PDBLK *blkptr);
00128
00130 void set_to_block (
00131 PDBLK * blkptr);
00132
00134 void start_block();
00135
00137 void forward();
00138
00140 BOOL8 cycled_rects() {
00141 return left_it.cycled_list () && right_it.cycled_list ();
00142 }
00143
00147 void bounding_box(ICOORD &bleft,
00148 ICOORD &tright) {
00149
00150 bleft = ICOORD (left_it.data ()->x (), ymin);
00151
00152 tright = ICOORD (right_it.data ()->x (), ymax);
00153 }
00154
00155 private:
00156 inT16 ymin;
00157 inT16 ymax;
00158 PDBLK *block;
00159 ICOORDELT_IT left_it;
00160 ICOORDELT_IT right_it;
00161 };
00162
00164 class DLLSYM BLOCK_LINE_IT
00165 {
00166 public:
00169 BLOCK_LINE_IT (PDBLK * blkptr)
00170 :rect_it (blkptr) {
00171 block = blkptr;
00172 }
00173
00176 void set_to_block (PDBLK * blkptr) {
00177 block = blkptr;
00178
00179 rect_it.set_to_block (blkptr);
00180 }
00181
00185 inT16 get_line(inT16 y,
00186 inT16 &xext);
00187
00188 private:
00189 PDBLK * block;
00190 BLOCK_RECT_IT rect_it;
00191 };
00192
00193 int decreasing_top_order(const void *row1,
00194 const void *row2);
00195 #endif