29 #include "config_auto.h" 32 #define PBLOCK_LABEL_SIZE 150 33 #define INTERSECTING MAX_INT16 35 int lessthan(
const void *first,
const void *second);
38 ICOORDELT_IT
v = &vertices;
42 v.add_list_before(points);
50 ICOORDELT_IT
v = &vertices;
71 ICOORDELT_IT pts = &vertices;
73 botleft = *pts.data ();
77 if (pos.
x () < botleft.
x ())
79 botleft =
ICOORD (pos.
x (), botleft.
y ());
80 if (pos.
y () < botleft.
y ())
81 botleft =
ICOORD (botleft.
x (), pos.
y ());
82 if (pos.
x () > topright.
x ())
83 topright =
ICOORD (pos.
x (), topright.
y ());
84 if (pos.
y () > topright.
y ())
85 topright =
ICOORD (topright.
x (), pos.
y ());
88 while (!pts.at_first ());
89 ibl =
ICOORD (botleft.
x (), botleft.
y ());
90 itr =
ICOORD (topright.
x (), topright.
y ());
91 box =
TBOX (ibl, itr);
108 ICOORDELT_IT it = &vertices;
114 vvec = *it.data_relative (1) - pt;
116 if (vec.
y () <= 0 && vec.
y () + vvec.
y () > 0) {
123 else if (vec.
y () > 0 && vec.
y () + vvec.
y () <= 0) {
130 else if (vec.
y () == 0 && vec.
x () == 0)
134 while (!it.at_first ());
142 ICOORDELT_IT it = &vertices;
151 vertex = *it.data ();
159 while (!it.at_first ());
164 it.set_to_list (other->
points ());
166 vertex = *it.data ();
174 while (!it.at_first ());
189 ICOORDELT_IT pts = &vertices;
200 while (!pts.at_first ());
212 ICOORDELT_IT pts = &vertices;
219 while (!pts.at_first());
233 ICOORDELT_IT pts = &vertices;
240 while (!pts.at_first ());
245 #ifndef GRAPHICS_DISABLED 247 ICOORDELT_IT
v = &vertices;
256 #if defined(__UNIX__) || defined(MINGW) 257 sprintf(temp_buff,
"%" PRId32, num);
259 ltoa (num, temp_buff, 10);
261 window->
Text(v.data ()->x (), v.data ()->y (), temp_buff);
264 window->
SetCursor(v.data ()->x (), v.data ()->y ());
265 for (v.mark_cycle_pt (); !v.cycled_list (); v.forward ()) {
266 window->
DrawTo(v.data ()->x (), v.data ()->y ());
269 window->
DrawTo(v.data ()->x (), v.data ()->y ());
284 const std::unique_ptr< ICOORDELT_LIST> segments(lines->
get_line (y));
285 if (!segments->empty ()) {
286 s_it.set_to_list (segments.get());
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);
306 ICOORDELT_IT it = &vertices;
315 vertex = *it.data ();
323 while (!it.at_first ());
328 it.set_to_list (other->
points ());
338 while (!it.at_first ());
345 ICOORDELT_LIST *result;
349 fy = (float) (y + 0.5);
350 result =
new ICOORDELT_LIST ();
351 r.set_to_list (result);
352 v.set_to_list (block->points ());
354 for (v.mark_cycle_pt (); !v.cycled_list (); v.forward ()) {
355 if (((v.data_relative (-1)->y () > y) && (v.data ()->y () <= y))
356 || ((v.data_relative (-1)->y () <= y) && (v.data ()->y () > y))) {
357 previous = v.data_relative (-1);
359 fx = (float) (0.5 + previous->
x () +
360 (current->
x () - previous->
x ()) * (fy -
362 (current->
y () - previous->
y ()));
370 for (r.mark_cycle_pt (); !r.cycled_list (); r.forward ())
372 for (r.mark_cycle_pt (); !r.cycled_list (); r.forward ()) {
373 r.data ()->
set_y (r.data_relative (1)->x () - r.data ()->x ());
375 delete (r.extract ());
383 int lessthan(
const void *first,
const void *second) {
387 if (p1->
x () < p2->
x ())
389 else if (p1->
x () > p2->
x ())
395 #ifndef GRAPHICS_DISABLED 417 return kPBColors[type];
421 #endif // GRAPHICS_DISABLED
inT16 winding_number(const ICOORD &test_pt)
bool overlap(const TBOX &box) const
bool contains(POLY_BLOCK *other)
ICOORDELT_LIST * points()
void rotate(const FCOORD vec)
void rotate(FCOORD rotation)
void set_x(inT16 xin)
rewrite function
void plot(ScrollView *window, inT32 num)
inT16 x() const
access function
void set_x(float xin)
rewrite function
int lessthan(const void *first, const void *second)
void set_y(float yin)
rewrite function
void SetCursor(int x, int y)
ICOORDELT_LIST * get_line(inT16 y)
inT16 y() const
access_function
void fill(ScrollView *window, ScrollView::Color colour)
static ScrollView::Color ColorForPolyBlockType(PolyBlockType type)
Returns a color to draw the given type.
void Text(int x, int y, const char *mystring)
bool overlap(POLY_BLOCK *other)
void set_y(inT16 yin)
rewrite function
void DrawTo(int x, int y)
void TextAttributes(const char *font, int pixel_size, bool bold, bool italic, bool underlined)