Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8712487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:07:12+00:00 2026-06-13T05:07:12+00:00

My problem is that I want to create a method that when I invoke

  • 0

My problem is that I want to create a method that when I invoke it giving it two GeoPoint’s I want it to draw a line between the two points and I haven’t been able to do this.

Thanks in advance.

public class MyOverlays extends ItemizedOverlay<OverlayItem> {

private ArrayList<OverlayItem> mapOverlays = new ArrayList<OverlayItem>();
private Context context;
private int lastestIndex;
private Projection projection;
private Canvas canvas;
private MapView mapv;
private boolean shadow;

public MyOverlays(Context context, Drawable defaultMarker, String player) {
    super(boundCenterBottom(defaultMarker));
    this.context = context;
}

@Override
protected OverlayItem createItem(int i) {
    return mapOverlays.get(i);
}

@Override
public int size() {
    return mapOverlays.size();

}

public void setPj(Projection projection) {
    this.projection = projection;

}

public void draw(Canvas canvas, MapView mapv, boolean shadow) {
    super.draw(canvas, mapv, shadow);
    this.canvas = canvas;
    this.mapv = mapv;
    this.shadow = shadow;

    // Configuring the paint brush

}

Test method ideally i would want to pass 2 geopoints to draw a line between them

  public void test() {
    super.draw(canvas, mapv, shadow);
    Paint mPaint = new Paint();
    mPaint.setDither(true);
    mPaint.setColor(Color.RED);
    mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
    mPaint.setStrokeJoin(Paint.Join.ROUND);
    mPaint.setStrokeCap(Paint.Cap.ROUND);
    mPaint.setStrokeWidth(4);

    GeoPoint gP1 = new GeoPoint(34159000, 73220000);// starting point
    GeoPoint gP2 = new GeoPoint(33695043, 73050000);// End point Islamabad

    GeoPoint gP4 = new GeoPoint(33695043, 73050000);// Start point Islamabad
    GeoPoint gP3 = new GeoPoint(33615043, 73050000);// End Point Rawalpindi

    Point p1 = new Point();
    Point p2 = new Point();
    Path path1 = new Path();

    Point p3 = new Point();
    Point p4 = new Point();
    Path path2 = new Path();
    projection.toPixels(gP2, p3);
    projection.toPixels(gP1, p4);

    path1.moveTo(p4.x, p4.y);// Moving to Abbottabad location
    path1.lineTo(p3.x, p3.y);// Path till Islamabad

    projection.toPixels(gP3, p1);
    projection.toPixels(gP4, p2);

    path2.moveTo(p2.x, p2.y);// Moving to Islamabad location
    path2.lineTo(p1.x, p1.y);// Path to Rawalpindi

    canvas.drawPath(path1, mPaint);// Actually drawing the path from
                                    // Abbottabad to Islamabad
    canvas.drawPath(path2, mPaint);// Actually drawing the path from
                                    // Islamabad to Rawalpindi
    this.populate();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:07:14+00:00Added an answer on June 13, 2026 at 5:07 am

    Resolved my issue,

    public void draw(Canvas canvas, MapView mapv, boolean shadow){
         super.draw(canvas, mapv, shadow);
         this.canvas=canvas;
         this.mapv=mapv;
         this.shadow=shadow;
         if(line==1){
             Paint mPaint = new Paint();
             mPaint.setDither(true);
             mPaint.setColor(Color.RED);
             mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
             mPaint.setStrokeJoin(Paint.Join.ROUND);
             mPaint.setStrokeCap(Paint.Cap.ROUND);
             mPaint.setStrokeWidth(4);
    
             GeoPoint gP1 = new GeoPoint(34159000,73220000);//starting point Abbottabad
             GeoPoint gP2 = new GeoPoint(33695043,73050000);//End point Islamabad
    
             GeoPoint gP4 = new GeoPoint(33695043, 73050000);//Start point Islamabad
             GeoPoint gP3 = new GeoPoint(33615043, 73050000);//End Point Rawalpindi
    
            Point p1 = new Point();
             Point p2 = new Point();
             Path path1 = new Path();
    
             Point p3 = new Point();
             Point p4 = new Point();
             Path path2 = new Path();
             projection.toPixels(gP2, p3);
             projection.toPixels(gP1, p4);
    
            path1.moveTo(p4.x, p4.y);//Moving to Abbottabad location
             path1.lineTo(p3.x,p3.y);//Path till Islamabad
    
             projection.toPixels(gP3, p1);
             projection.toPixels(gP4, p2);
    
            path2.moveTo(p2.x, p2.y);//Moving to Islamabad location
             path2.lineTo(p1.x,p1.y);//Path to Rawalpindi
    
             canvas.drawPath(path1, mPaint);//Actually drawing the path from Abbottabad to Islamabad
             canvas.drawPath(path2, mPaint);//Actually drawing the path from Islamabad to Rawalpindi
         }
    
    
        //Configuring the paint brush
    
    
    
         }
    public void test(){
        System.out.println("vim ao test");
        line=1;
        draw(canvas,mapv,shadow);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a crawler with C#. The problem is that some websites
Problem I want to create an application that can be extended somehow by programmers.
I have the following problem that I want to solve in awk. I have
with my RCP program I have the problem that I want to have more
My problem is that I want to go from layout 1 to any other
My problem is that I want to have a tab bar view with its
My problem is that I want to redirect via JavaScript to a directory above.
My problem is that I want to rotate the UIImageView of a UIButton .
My Problem is that I want to check if the Arrow up or down
The problem is that I want to output Mathematica compatible floating point numbers. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.