28 #include "config_auto.h"
31 #define PBLOCK_LABEL_SIZE 150
32 #define INTERSECTING MAX_INT16
34 int lessthan(
const void *first,
const void *second);
37 ICOORDELT_IT v = &vertices;
41 v.add_list_before(points);
49 ICOORDELT_IT v = &vertices;
70 ICOORDELT_IT pts = &vertices;
72 botleft = *pts.data ();
76 if (pos.
x () < botleft.
x ())
78 botleft =
ICOORD (pos.
x (), botleft.
y ());
79 if (pos.
y () < botleft.
y ())
80 botleft =
ICOORD (botleft.
x (), pos.
y ());
81 if (pos.
x () > topright.
x ())
82 topright =
ICOORD (pos.
x (), topright.
y ());
83 if (pos.
y () > topright.
y ())
84 topright =
ICOORD (topright.
x (), pos.
y ());
87 while (!pts.at_first ());
88 ibl =
ICOORD (botleft.
x (), botleft.
y ());
89 itr =
ICOORD (topright.
x (), topright.
y ());
90 box =
TBOX (ibl, itr);
107 ICOORDELT_IT it = &vertices;
113 vvec = *it.data_relative (1) - pt;
115 if (vec.
y () <= 0 && vec.
y () + vvec.
y () > 0) {
122 else if (vec.
y () > 0 && vec.
y () + vvec.
y () <= 0) {
129 else if (vec.
y () == 0 && vec.
x () == 0)
133 while (!it.at_first ());
141 ICOORDELT_IT it = &vertices;
150 vertex = *it.data ();
158 while (!it.at_first ());
163 it.set_to_list (other->
points ());
165 vertex = *it.data ();
173 while (!it.at_first ());
188 ICOORDELT_IT pts = &vertices;
199 while (!pts.at_first ());
211 ICOORDELT_IT pts = &vertices;
218 while (!pts.at_first());
232 ICOORDELT_IT pts = &vertices;
239 while (!pts.at_first ());
244 #ifndef GRAPHICS_DISABLED
246 ICOORDELT_IT v = &vertices;
255 #if defined(__UNIX__) || defined(MINGW)
258 ltoa (num, temp_buff, 10);
260 window->
Text(v.data ()->x (), v.data ()->y (), temp_buff);
263 window->
SetCursor(v.data ()->x (), v.data ()->y ());
264 for (v.mark_cycle_pt (); !v.cycled_list (); v.forward ()) {
265 window->
DrawTo(v.data ()->x (), v.data ()->y ());
268 window->
DrawTo(v.data ()->x (), v.data ()->y ());
276 ICOORDELT_LIST *segments;
285 if (!segments->empty ()) {
286 s_it.set_to_list (segments);
287 for (s_it.mark_cycle_pt (); !s_it.cycled_list (); s_it.forward ()) {
291 width = s_it.data ()->y ();
292 window->
SetCursor(s_it.data ()->x (), y);
293 window->
DrawTo(s_it.data ()->x () + (float) width, y);
304 ICOORDELT_IT it = &vertices;
313 vertex = *it.data ();
321 while (!it.at_first ());
326 it.set_to_list (other->
points ());
336 while (!it.at_first ());
343 ICOORDELT_LIST *result;
347 fy = (float) (y + 0.5);
348 result =
new ICOORDELT_LIST ();
349 r.set_to_list (result);
350 v.set_to_list (block->
points ());
352 for (v.mark_cycle_pt (); !v.cycled_list (); v.forward ()) {
353 if (((v.data_relative (-1)->y () > y) && (v.data ()->y () <= y))
354 || ((v.data_relative (-1)->y () <= y) && (v.data ()->y () > y))) {
355 previous = v.data_relative (-1);
357 fx = (float) (0.5 + previous->
x () +
358 (current->
x () - previous->
x ()) * (fy -
360 (current->
y () - previous->
y ()));
368 for (r.mark_cycle_pt (); !r.cycled_list (); r.forward ())
370 for (r.mark_cycle_pt (); !r.cycled_list (); r.forward ()) {
371 r.data ()->
set_y (r.data_relative (1)->x () - r.data ()->x ());
373 delete (r.extract ());
381 int lessthan(
const void *first,
const void *second) {
385 if (p1->
x () < p2->
x ())
387 else if (p1->
x () > p2->
x ())
393 #ifndef GRAPHICS_DISABLED
415 return kPBColors[type];
419 #endif // GRAPHICS_DISABLED
void set_x(inT16 xin)
rewrite function
int lessthan(const void *first, const void *second)
void rotate(FCOORD rotation)
static ScrollView::Color ColorForPolyBlockType(PolyBlockType type)
Returns a color to draw the given type.
void Text(int x, int y, const char *mystring)
void DrawTo(int x, int y)
bool contains(POLY_BLOCK *other)
void rotate(const FCOORD vec)
void TextAttributes(const char *font, int pixel_size, bool bold, bool italic, bool underlined)
ICOORDELT_LIST * get_line(inT16 y)
bool overlap(POLY_BLOCK *other)
inT16 y() const
access_function
void set_x(float xin)
rewrite function
void SetCursor(int x, int y)
void set_y(float yin)
rewrite function
ICOORDELT_LIST * points()
void fill(ScrollView *window, ScrollView::Color colour)
void set_y(inT16 yin)
rewrite function
void plot(ScrollView *window, inT32 num)
inT16 x() const
access function
inT16 winding_number(const ICOORD &test_pt)
bool overlap(const TBOX &box) const