public void insertRadians(double[] latlons,int coordPairIndex,boolean replaceEndsOfInsertedAtJoin){
  int minPntsNeededForInsertion=2;
  boolean atEnd=false;
  boolean isClosed=isGeometryClosed();
  int insertionPoint=coordPairIndex * 2;
  if (insertionPoint >= rawllpts.length) {
    if (isClosed) {
      insertionPoint=rawllpts.length - 2;
    }
 else {
      insertionPoint=rawllpts.length;
      atEnd=true;
    }
  }
 else   if (insertionPoint <= 0) {
    if (isClosed) {
      insertionPoint=2;
    }
 else {
      insertionPoint=0;
      atEnd=true;
    }
  }
  int newCoordStart=0;
  int newCoordLength=latlons.length;
  if (replaceEndsOfInsertedAtJoin) {
    newCoordStart=2;
    minPntsNeededForInsertion=6;
    if (atEnd) {
      minPntsNeededForInsertion-=2;
      newCoordLength-=2;
      if (insertionPoint == 0) {
        newCoordStart=0;
      }
    }
 else {
      newCoordLength-=4;
    }
  }
  if (renderType == OMGraphic.RENDERTYPE_LATLON && latlons.length >= minPntsNeededForInsertion && latlons.length % 2 == 0) {
    double[] oldrawllpnts=rawllpts;
    int oldCoordsRemaining=oldrawllpnts.length - insertionPoint;
    rawllpts=new double[oldrawllpnts.length + newCoordLength];
    System.arraycopy(oldrawllpnts,0,rawllpts,0,insertionPoint);
    System.arraycopy(latlons,newCoordStart,rawllpts,insertionPoint,newCoordLength);
    System.arraycopy(oldrawllpnts,insertionPoint,rawllpts,insertionPoint + newCoordLength,oldCoordsRemaining);
    setNeedToRegenerate(true);
  }
}

public void insertRadians ( double [ ] latlons , int coordPairIndex , boolean replaceEndsOfInsertedAtJoin ) { int minPntsNeededForInsertion = 2 ; boolean atEnd = false ; boolean isClosed = isGeometryClosed ( ) ; int insertionPoint = coordPairIndex * 2 ; if ( insertionPoint >= rawllpts . length ) { if ( isClosed ) { insertionPoint = rawllpts . length - 2 ; } else { insertionPoint = rawllpts . length ; atEnd = true ; } } else if ( insertionPoint <= 0 ) { if ( isClosed ) { insertionPoint = 2 ; } else { insertionPoint = 0 ; atEnd = true ; } } int newCoordStart = 0 ; int newCoordLength = latlons . length ; if ( replaceEndsOfInsertedAtJoin ) { newCoordStart = 2 ; minPntsNeededForInsertion = 6 ; if ( atEnd ) { minPntsNeededForInsertion -= 2 ; newCoordLength -= 2 ; if ( insertionPoint == 0 ) { newCoordStart = 0 ; } } else { newCoordLength -= 4 ; } } if ( renderType == OMGraphic . RENDERTYPE_LATLON && latlons . length >= minPntsNeededForInsertion && latlons . length % 2 == 0 ) { double [ ] oldrawllpnts = rawllpts ; int oldCoordsRemaining = oldrawllpnts . length - insertionPoint ; rawllpts = new double [ oldrawllpnts . length + newCoordLength ] ; System . arraycopy ( oldrawllpnts , 0 , rawllpts , 0 , insertionPoint ) ; System . arraycopy ( latlons , newCoordStart , rawllpts , insertionPoint , newCoordLength ) ; System . arraycopy ( oldrawllpnts , insertionPoint , rawllpts , insertionPoint + newCoordLength , oldCoordsRemaining ) ; setNeedToRegenerate ( true ) ; } }
convenience function for adding some coordinates to the polygon , for lat / lon polygons . might be tricky for closed polygons , you might want to consider the index and not make them the starting or end point to preserve closed property .
