Hello,
I am trying to save shape coords in db and send them to server and redraw it again from db. Its working great but the only problem is in erase! Whatever points I am getting from erase is not matching with shape stored in db.
Below is the code snippet for erase inside Erase.java where I am trying retrieve x,y cords of annotation that is being deleted.
// Erase
double[] pt1points = mPDFView.convScreenPtToPagePt(mPrevPt.x, mPrevPt.y, mDownPageNum);
double[] pt2points = mPDFView.convScreenPtToPagePt(mCurrentPt.x, mCurrentPt.y, mDownPageNum);
Point pdfPt1 = new Point(pt1points[0], pt1points[1]);
Point pdfPt2 = new Point(pt2points[0], pt2points[1]);
try {
mPDFView.docLock(true);
Page page = mPDFView.getDoc().getPage(mDownPageNum);
int annot_num = page.getNumAnnots();
int count=0;
for (int i=annot_num-1;i>=0;–i) {
Annot annot = page.getAnnot(i);
if (!annot.isValid())
continue;
if (annot.getType() == Annot.e_Ink) {
Ink ink = new Ink(annot);
Point point =ink.GetPoint(0, count); //Getting points of annotation I think I am messing here!
if (ink.erase(pdfPt1, pdfPt2, mEraserHalfThickness)) {
ErasedPoints erased=new ErasedPoints();
erased.setxCoord(point.x);
erased.setyCoord(point.y);
erasedPoints.add(erased);
Log.i(“Erased”, "Erased GetPoint at “+count+” “+point.x+” "+point.y );
Log.i(“Erased”, "Erased onMove “+pdfPt1.x+” “+pdfPt1.y+” “+pdfPt2.x+” "+pdfPt2.y);
if (!mInkList.contains(ink)) {
mInkList.add(ink);
mDoUpdate = true;
}
}
}
count++;
}
Log.i("Loop count ","Loop count "+count);
} catch (Exception ex) {
} finally {
mPDFView.docUnlock();
mPrevPt.x = mCurrentPt.x;
mPrevPt.y = mCurrentPt.y;
}