Java JMapViewer: How can I change the color of a MapPolygon? -


i'm creating application drawing pollution information on jmapviewer. want mappolygons, didn't find documentation it. succeeded create new mappolygons this:

private mappolygon getpolygon(double lat, double lon, color col){     list<coordinate> coords = new arraylist<>();      //add points list...      mappolygon poly = new mappolygonimpl(coords);      return poly; } 

i'm wondering how change color , remove border of mappolygon. there no function setcolor or such...

i tried directly constructor, doesn't work:

mappolygon poly = new mappolygonimpl(coords, color.red, new basicstroke(0)); 

does know how can change color of mappolygon? thanks!

because mappolygonimpl extends mapobjectimpl, mappolygonimpl inherits setcolor() , setbackcolor() mapobjectimpl. mappolygonimpl uses these colors in implementation of paint(). colors stored in parent class's style attribute, initialized calling getdefaultstyle() during construction.

you can vary alpha component of chosen color achieve variety of effects; example below uses 12.5% light gray.

mappolygonimpl poly = new mappolygonimpl(coords); color color = new color(0x20202020, true); poly.setcolor(color); poly.setbackcolor(color); poly.setstroke(new basicstroke(0)); map.addmappolygon(poly); 

image

if existing color satisfactory, similar effect may achieved setting color background color.

mappolygonimpl poly = new mappolygonimpl(route); poly.setcolor(poly.getbackcolor()); 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -