M
Manavan
I am writing an application which needs to display CAD data, a few
millions of Polygons. I am using Java Graphics2d. I extended
JComponent to create a Canvas widget. In the paint module, I am
drawing each of these shapes.
My questions are:
The application needs to be able to zoom-in, zoom-out, show a
particular area. What is the best way to do this?
In the paint component should I draw all the millions of shapes and
then set clip area and transforms to zoom to the interested area? That
would be lot slower - wouldn't it?
Or should I come up with an algorithm which will find out the shapes
that fall within the interested area and call drawShape() for only
those? This algorithm looks so common I wonder if Java already has a
way to essentially do this? Or any library that I can look into?
millions of Polygons. I am using Java Graphics2d. I extended
JComponent to create a Canvas widget. In the paint module, I am
drawing each of these shapes.
My questions are:
The application needs to be able to zoom-in, zoom-out, show a
particular area. What is the best way to do this?
In the paint component should I draw all the millions of shapes and
then set clip area and transforms to zoom to the interested area? That
would be lot slower - wouldn't it?
Or should I come up with an algorithm which will find out the shapes
that fall within the interested area and call drawShape() for only
those? This algorithm looks so common I wonder if Java already has a
way to essentially do this? Or any library that I can look into?