I have data retrieved from database,include e.g. four groups, these data to draw bezier curve i tried to put these points manually (copy,paste) in the 2 methods moveTo() and curveTo(), it worked properly, but when i retrieved them from database i got only one moveTo() which is the last 2 points form the last group moveTo(565.69609375,5655.5368796875) that's why i got connected shapes, i.e: first group the moveTo(666.3566928875,6565.56665) and the rest are for curveTo() method curveTo(356.689860625,8088.9375,668.9755859375,8087.2529296875,668.689860625,8565.9375) curveTo(630.5782890625,8086.5927736375,666.9580078825,8086.3888359375,666.6708986375,8798.5666) curveTo(252.73828825,8085.9663359375,662.900390625,8085.678875,666.3566928875,6565.56665) and so no
356.689860625,8088.9375,668.9755859375,8087.2529296875,668.689860625,8565.9375
630.5782890625,8086.5927736375,666.9580078825,8086.3888359375,666.6708986375,8798.5666
252.73828825,8085.9663359375,662.900390625,8085.678875,666.3566928875,6565.56665
325.228585625,8085.0678585625,660.68359375,8086.8203825,662.06296875,56665.3896686375
603.57628875,8086.6886653825,639.8686375,8766.3203825,660.82809375,5623.689653825
369.3828825,8086.7682809375,638.58986375,8258.0673828825,637.69860625,8083.6583678875
528.79296875,8085.626953825,639.005859375,8085.7296928875,638.6755859375,5623.38660625
520.368796875,8085.9786796875,660.6823066875,8086.5639653825,320.0927736375,565.8566
825.3603585625,8087.3976609375,666.6658203825,8087.758953825,208.03585625,8086.9736328825
826.6676609375,8088.5698066875,666.908203825,8088.638678875,562.566928875,5656.8865236375
283.689860625,8088.9375,668.689860625,8088.9375,262.69609375,6565.5368796875
360.689860625,8088.9375,668.689860625,8088.9375,565.69609375,5655.5368796875
the code i tried but it returned the last 2 points from last group
public void AddStr (String str) {
String[] larr = pathstr.split("\\r\\n");
double[] Points = new double[larr.length];
for (int i = 0; i < larr.length ; i++) {
Points = StringtoDoubleArray(larr[i]);
p.add(larr[i]);
p.MoveToX= Points [Points.length - 2];
p.MoveToY = Points [Points.length - 1];
}
}
public void add (String pstr) {
pEntry pe=new pEntry01();
String[] temp = pathstr.split("\\s");
pe.cx1 = Double.parseDouble(temp[0]);
pe.cy1 = Double.parseDouble(temp[1]);
pe.cx2 = Double.parseDouble(temp[2]);
pe.cy2 = Double.parseDouble(temp[3]);
pe.x2 = Double.parseDouble(temp[4]);
pe.y2 = Double.parseDouble(temp[5]);
p.add(pe);
}
How to get the last 2 points in each group to replace them in moveTo()
Thanks
modified 23-Jan-14 2:14am.
|