title: Getting all coordinates from a line drawn on a map
body: <p>in my <code>MapView</code> I give the ability to tap on the map to create as many points as you want and the points get connected by a line but I dont want to draw any lines that may intersect with another line on the map like this</p>
  
  <p><img src="https://i.stack.imgur.com/DyB49.png" alt="enter image description here"></p>
  
  <p>Is there anyway to get the coordinates of the lines to check if the new line will intersect with one of the others?</p>
  
  <p>Or if anyone else has any suggestion on how to check for this that would be great too</p>
  
  <p>this is my draw method that draws the lines</p>
  
  <pre><code>@Override
      public void draw(final Canvas canvas, final MapView mapView, final boolean shadow){
          super.draw(canvas, mapView, shadow);
  
          try{
          Paint paint = new Paint();
          paint.setAntiAlias(true);
          paint.setDither(true);
          paint.setColor(Color.RED);
          paint.setStrokeWidth(3);
          paint.setAlpha(100);
          paint.setStyle(Style.STROKE);
  
          Path path = new Path();
          Point point1 = null;
          boolean runOnce = false;
          for(int i = 0;i&lt;items.size();i++){
              Point point = new Point();
              mapView.getProjection().toPixels(items.get(i).mGeoPoint, point);
  
              if(!runOnce)
              {
                  path.moveTo(point.x, point.y);
                  point1 = new Point(point.x, point.y);
                  runOnce = true;
              }
              else
              {
                  path.lineTo(point.x, point.y);
              }
          }
          path.lineTo(point1.x, point1.y);
          canvas.drawPath(path, paint);
  
          path.lineTo(point1.x, point1.y);
          canvas.drawPath(path, paint);
  
          Paint paint2 = new Paint();
          paint2.setAntiAlias(true);
          paint2.setDither(true);
          paint2.setColor(Color.RED);
          paint2.setStrokeWidth(3);
          paint2.setAlpha(20);
          paint2.setStyle(Style.FILL);
  
          Path path2 = new Path();
          Point point2 = null;
          boolean runOnce2 = false;
          for(int i = 0; i &lt; items.size(); i++)
          {
              Point point = new Point();
              mapView.getProjection().toPixels(items.get(i).mGeoPoint, point);
  
              if(!runOnce2)
              {
                  path2.moveTo(point.x, point.y);
                  point2 = new Point(point.x, point.y);
                  runOnce2 = true;
              }
              else
              {
                  path2.lineTo(point.x, point.y);
              }
          }
  
          path2.lineTo(point2.x, point2.y);
          canvas.drawPath(path2, paint2);
          }catch(Exception e){
  
          }
      }
  </code></pre>