Draw a closed polygon witihin mapview

by Dudero » Tue, 25 Jan 2011 20:40:52 GMT

Sponsored Links

I want to display borders(based on GeoPoints) on my mapview but
android does not support anything like:


At the moment i solve this with the following code in the draw-method
of an ItemizedOverlay:

for(int i = 0;i< geopoints.size();i++){

                                        canvas.drawLine(Point(i).x, Point(i).y, 
Point(i+1).x, Point(i+1),
                                //Auer beim letzen Punkt: zeichne hier zum 
ersten Punkt:
mOverlays.get(0)).getPoint(), pxNew);
                                canvas.drawLine(pxOld.x, pxOld.y, pxNew.x, 
pxNew.y, mPaint);


Re: Draw a closed polygon witihin mapview

by Kostya Vasilyev » Tue, 25 Jan 2011 21:01:06 GMT

 Android doesn't use or support java.awt.* APIs, have you tried these:


 http://developer.android.com/reference/android/graphics/Canvas.html #drawPath(android.graphics.Path,

But I don't see anything really wrong with the way you're doing it (except
for possibly joins and antialiasing at the vertices).

-- Kostya

2011/1/25 Dudero <sinfanh...@googlemail.com>


Sponsored Links

Draw a closed polygon witihin mapview

by Dudero » Tue, 25 Jan 2011 21:26:06 GMT


I want to display borders (based on GeoPoints) on my mapview.
But as far as I know android does not support anything like

My problem is that if I add new points to my polygon some edges
intersect with others edges. The soloution is that I have to sort my
points into the right order, but I think this is not really trivial...

At the moment I draw my polygon with following code into the draw-
of an ItemizedOverlay:

public void draw(Canvas canvas, MapView mapView, boolean shadow) {
for(int i = 0; i < geopoints.size(); i++){
                        //If its not the last point: connect the current
point with its next
                                if ( i < size()-1 )
Point(i).y, Point(i+1).x, Point(i+1),mPaint);
                        //The last point will be connected to the
first(0) the get a closed polygon
Point(i).y, Point(0).x, Point(0).y, mPaint);

Any suggestions?

Greetz dudero


Other Threads

1. signatureOrSystem permission protectio


"signatureOrSystem" A permission that the system grants only to
applications that are in the Android system image or that are signed
with the same certificates as those in the system image.

I guess the above statement is a bit misleading. "that are signed with
the same certificates as those in the system image. "

Indeed, they must be signed by the same certificate, but not necessary
by one from the system image. Basically, this is the equivalent of the
protection level "signature". However, the above statement assumes
that "signatureOrSystem" protected permissions are only declared by
applications located in the system image.


2. Related about progrssbar

Hi Android developer

My Question is related about progressbar(Horizantal) . i have created
a progressbar using XMl Code
but i want to change the Progress Color(yello) .plz tel me how to
change the progress Color
from Yellow to Blue

thank you


3. Working with zip file in Android.

4. HTTPS connections through the browser, from within application

5. Android on ZuneHD?

6. how to edit the resource.arsc file in the android APK package

7. How to import com.android.internal.telephony.Phone?