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 snprintf(temp_buff,
sizeof(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(
286 if (!segments->empty ()) {
287 s_it.set_to_list(segments.get());
288 for (s_it.mark_cycle_pt (); !s_it.cycled_list (); s_it.forward ()) {
292 width = s_it.data ()->y ();
293 window->
SetCursor(s_it.data ()->x (), y);
294 window->
DrawTo(s_it.data ()->x () + (float) width, y);
307 ICOORDELT_IT it = &vertices;
316 vertex = *it.data ();
324 while (!it.at_first ());
329 it.set_to_list (other->
points ());
339 while (!it.at_first ());
346 ICOORDELT_LIST *result;
350 fy = (float) (y + 0.5);
351 result =
new ICOORDELT_LIST ();
352 r.set_to_list (result);
353 v.set_to_list (block->points ());
355 for (v.mark_cycle_pt (); !v.cycled_list (); v.forward ()) {
356 if (((v.data_relative (-1)->y () > y) && (v.data ()->y () <= y))
357 || ((v.data_relative (-1)->y () <= y) && (v.data ()->y () > y))) {
358 previous = v.data_relative (-1);
360 fx = (float) (0.5 + previous->
x () +
361 (current->
x () - previous->
x ()) * (fy -
363 (current->
y () - previous->
y ()));
371 for (r.mark_cycle_pt (); !r.cycled_list (); r.forward ())
373 for (r.mark_cycle_pt (); !r.cycled_list (); r.forward ()) {
374 r.data ()->
set_y (r.data_relative (1)->x () - r.data ()->x ());
376 delete (r.extract ());
384 int lessthan(
const void *first,
const void *second) {
388 if (p1->
x () < p2->
x ())
390 else if (p1->
x () > p2->
x ())
396 #ifndef GRAPHICS_DISABLED 418 return kPBColors[type];
422 #endif // GRAPHICS_DISABLED
void set_y(inT16 yin)
rewrite function
static ScrollView::Color ColorForPolyBlockType(PolyBlockType type)
Returns a color to draw the given type.
void DrawTo(int x, int y)
void fill(ScrollView *window, ScrollView::Color colour)
inT16 x() const
access function
void set_x(inT16 xin)
rewrite function
bool contains(POLY_BLOCK *other)
void rotate(FCOORD rotation)
void set_x(float xin)
rewrite function
void rotate(const FCOORD vec)
bool overlap(POLY_BLOCK *other)
void Text(int x, int y, const char *mystring)
ICOORDELT_LIST * points()
inT16 winding_number(const ICOORD &test_pt)
void TextAttributes(const char *font, int pixel_size, bool bold, bool italic, bool underlined)
void SetCursor(int x, int y)
inT16 y() const
access_function
int lessthan(const void *first, const void *second)
void set_y(float yin)
rewrite function
bool overlap(const TBOX &box) const
ICOORDELT_LIST * get_line(inT16 y)
void plot(ScrollView *window, inT32 num)