I have file (*.shp used in GIS) that contains collection of polygons and maybe other vector objects (but polygons are most important for me). I need to remove non printable objects it.
I don't know what criteria chose. I think removing objects with small border length would be better then removing objects with small area (so long objects will reduce to line). But maybe there is special algorithm for that?
In other words I want to find only that objects that are visible at given zoom level.
Thats quite simple. As you dont mention any language consider the following pseudocode
drawRect = myDevice.GetDrawRect();
for(oneShape in allShapes)
{
shapeRect = oneShape.GetRect()
if(! drawRect.Contains(shapeRect))
oneShape.MarkAsInvisible();
else
oneShape.Draw();
}
the Contains() function would look something like that, assuming that y-values increase from bottom to top:
bool Rect::Contains(OtherRect)
{
if(left <= OtherRect.right &&
right >= OtherRect.left &&
top >= OtherRect.bottom &&
bottom <= OtherRect.top)
return true
return false;
}