Reshaping problems


#1

hi walter,
I used setCubic(true) and overridden the gainedSelection() method as:
protected void gainedSelection(JGoSelection selection)
{
if (!isResizable())
{
selection.createBoundingHandle(this);
return;
}
else if (isReshapable())
{
super.gainedSelection(selection);
}
int nLastPoint = getLastPickPoint();
for (int i=getFirstPickPoint(); i <= nLastPoint; i++)
{
Point pnt = getPoint(i);
if (pnt != null)
selection.createResizeHandle(this, pnt.x, pnt.y,
NumReservedHandles + i, true);
}
}
As a result I am getting two handlers on either side of the JGolink,which are reshapable.This is fine.But problems I am getting are:
1.I do’nt want handlers on eitherside of the JGolink.I want Only one handler and that ResizeHandle should be at the center of the curvedline.So that I can perform my own shapes.
I found getFirstPickPoint() and getLastPickPoint() methods ,but I want centerpoint .Any method(s) available for this or how to get the centerpont,so that I can add ResizeHandle at the center?
2.After reshaping the curvedlink(JGoLink),some gap is coming at the arrowHeads(gap is not coming if it is straight line or for some little curvature),which I do’nt want to.Thats looking odd.
3.After reshaping I am saving .But while Saving I am getting “Exception occured in RequestProcessor” and getting strucked.what may be the reason for this?
Thanks in Advance,
Radhika


#2
  1. There’s an (internal) JGoStroke.BezierMidPoint method that you can copy. But since cubic Bezier curves necessarily have two control points, not one, you’ll need to reimplement handleResize to update both control points of the stroke as the user drags around that middle resize handle.
  2. I’m not sure what you mean here. But you need to get #1 implemented correctly first in any case.
  3. You’ll need to debug that; since you have the source code that shouldn’t be an issue.