import plot2d_class; D = matrix("double"); tri = zegraph("polygon"); xyz = zegraph("vertex"); tri:vertex(xyz); tri:type("triangles"); function callback(west, east, south, north) { if (west >= 180 || east <= 110 || south >= 80 || north <= 10) return; // polygon outside the rectangle [n, m] = D:size(); if (n < 3) return; // discard bad polygon if any T = null; if (west >= 110 && east <= 180 && south >= 10 && north <= 80) { // polygon inside the rectangle T = D:triangulate(); } else { // part of polygon inside the rectangle T = D:clip(110, 10, 71, 70); if (isuser(T)) T = T:triangulate(); } if (isuser(T)) { // add data to triangle vertex [n, m] = T:size(); if (n > 0) { T:insert(2, 0); [ptr, n, e] = T:ptr(); xyz:add(ptr, n); } } } G = new Plot2D; G->xaxis(range=[110, 180], tickmarks=[110, 10, 0]); G->yaxis(range=[10, 80], tickmarks=[10, 10, 0]); plot = G->c_plot:add(tri); // let the callback function process coastline data D:readgshhs("data\\gshhs_l.b", "land", "callback"); //G->show(); G->c_render:tofile("filled_map.png");