public void deletePoint(int position){
  int renderType=poly.getRenderType();
  Projection proj=getProjection();
  boolean needToHookUp=false;
  if (position <= 0 && isEnclosed()) {
    enclose(false);
    needToHookUp=true;
  }
  if (renderType == OMGraphic.RENDERTYPE_LATLON) {
    Debug.message("eomg","EditableOMPoly: removing point from lat/lon poly");
    if (proj != null) {
      double[] ll=poly.getLatLonArray();
      double[] newll=new double[ll.length - 2];
      int actualPosition=(position == Integer.MAX_VALUE ? ll.length : position * 2);
      if (actualPosition >= ll.length) {
        System.arraycopy(ll,0,newll,0,ll.length - 2);
        position=(ll.length - 2) / 2;
      }
 else       if (actualPosition <= 0) {
        System.arraycopy(ll,2,newll,0,ll.length - 2);
        position=0;
      }
 else {
        System.arraycopy(ll,0,newll,0,actualPosition);
        System.arraycopy(ll,actualPosition + 2,newll,actualPosition,ll.length - actualPosition - 2);
      }
      poly.setLocation(newll,poly.getUnits());
    }
  }
 else {
    Debug.message("eomg","EditableOMPoly: removing point from x/y or offset poly");
    int currentLength=poly.xs.length;
    int[] newxs=new int[currentLength - 1];
    int[] newys=new int[currentLength - 1];
    if (position >= currentLength) {
      System.arraycopy(poly.xs,0,newxs,0,currentLength - 1);
      System.arraycopy(poly.ys,0,newys,0,currentLength - 1);
      position=currentLength - 1;
    }
 else     if (position <= 0) {
      System.arraycopy(poly.xs,1,newxs,0,currentLength - 1);
      System.arraycopy(poly.ys,1,newys,0,currentLength - 1);
      position=0;
    }
 else {
      System.arraycopy(poly.xs,0,newxs,0,position);
      System.arraycopy(poly.xs,position + 1,newxs,position,currentLength - position - 1);
      System.arraycopy(poly.ys,0,newys,0,position);
      System.arraycopy(poly.ys,position + 1,newys,position,currentLength - position - 1);
    }
    if (poly.getRenderType() == OMGraphic.RENDERTYPE_OFFSET) {
      poly.setLocation(poly.lat,poly.lon,poly.getUnits(),newxs,newys);
    }
 else {
      poly.setLocation(newxs,newys);
    }
  }
  if (proj != null) {
    poly.regenerate(proj);
  }
  GrabPoint gp=(GrabPoint)polyGrabPoints.remove(position);
  if (gpo != null && gp != null) {
    gpo.removeGrabPoint(gp);
  }
  if (needToHookUp) {
    enclose(true);
  }
}

public void deletePoint ( int position ) { int renderType = poly . getRenderType ( ) ; Projection proj = getProjection ( ) ; boolean needToHookUp = false ; if ( position <= 0 && isEnclosed ( ) ) { enclose ( false ) ; needToHookUp = true ; } if ( renderType == OMGraphic . RENDERTYPE_LATLON ) { Debug . message ( "eomg" , "EditableOMPoly: removing point from lat/lon poly" ) ; if ( proj != null ) { double [ ] ll = poly . getLatLonArray ( ) ; double [ ] newll = new double [ ll . length - 2 ] ; int actualPosition = ( position == Integer . MAX_VALUE ? ll . length : position * 2 ) ; if ( actualPosition >= ll . length ) { System . arraycopy ( ll , 0 , newll , 0 , ll . length - 2 ) ; position = ( ll . length - 2 ) / 2 ; } else if ( actualPosition <= 0 ) { System . arraycopy ( ll , 2 , newll , 0 , ll . length - 2 ) ; position = 0 ; } else { System . arraycopy ( ll , 0 , newll , 0 , actualPosition ) ; System . arraycopy ( ll , actualPosition + 2 , newll , actualPosition , ll . length - actualPosition - 2 ) ; } poly . setLocation ( newll , poly . getUnits ( ) ) ; } } else { Debug . message ( "eomg" , "EditableOMPoly: removing point from x/y or offset poly" ) ; int currentLength = poly . xs . length ; int [ ] newxs = new int [ currentLength - 1 ] ; int [ ] newys = new int [ currentLength - 1 ] ; if ( position >= currentLength ) { System . arraycopy ( poly . xs , 0 , newxs , 0 , currentLength - 1 ) ; System . arraycopy ( poly . ys , 0 , newys , 0 , currentLength - 1 ) ; position = currentLength - 1 ; } else if ( position <= 0 ) { System . arraycopy ( poly . xs , 1 , newxs , 0 , currentLength - 1 ) ; System . arraycopy ( poly . ys , 1 , newys , 0 , currentLength - 1 ) ; position = 0 ; } else { System . arraycopy ( poly . xs , 0 , newxs , 0 , position ) ; System . arraycopy ( poly . xs , position + 1 , newxs , position , currentLength - position - 1 ) ; System . arraycopy ( poly . ys , 0 , newys , 0 , position ) ; System . arraycopy ( poly . ys , position + 1 , newys , position , currentLength - position - 1 ) ; } if ( poly . getRenderType ( ) == OMGraphic . RENDERTYPE_OFFSET ) { poly . setLocation ( poly . lat , poly . lon , poly . getUnits ( ) , newxs , newys ) ; } else { poly . setLocation ( newxs , newys ) ; } } if ( proj != null ) { poly . regenerate ( proj ) ; } GrabPoint gp = ( GrabPoint ) polyGrabPoints . remove ( position ) ; if ( gpo != null && gp != null ) { gpo . removeGrabPoint ( gp ) ; } if ( needToHookUp ) { enclose ( true ) ; } }
delete a point at a certain point in the polygon coordinate list . if the position is less than zero , the deleted point will be the starting point . if the position is greater than the list of current points , the point will be deleted from the end of the poly .
