Вопрос

I have a shape file, a simple a map of countries that I need to display on screen, but each country needs to be a specific color. Say I have an int variable named HKDensity = 21, then if a value of 21 is red, the color of the Hongkong polygon should be red.

This is for a school assignment in Java Swing, any help, hints examples is greatly appreciated. Thanks.

Это было полезно?

Решение

Have a look at the GeoTools Style tutorial for details of how to display a shapefile and colour in the polygons. The tutorial only shows how to produce a single colour but you should be able to work out how to create a variable colour fill with out too much difficulty.

Другие советы

Color colour = new Color(/*r*/ density / MAX_DENSITY, /*g*/ density / MAX_DENSITY, /*b*/ density / MAX_DENSITY);

or something.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top