Inheritance diagram for CanvasHxBSplineCurve::
Public Methods | |
CanvasHxBSplineCurve (String name, int nrC) | |
Constructor. More... | |
String | getSaName () |
Overrides CanvasObject interface. More... | |
void | setShowControlPoly (boolean b) |
double | getMinT () |
double | getMaxT () |
double | getCX (double t) |
double | getCY (double t) |
String | getSampleC (int n) |
int | getNumP () |
String | getControlP () |
Vector | getVisualChangeMethods () |
Overrides CanvasObject interface. More... | |
Protected Methods | |
Shape | getShape () |
Derived classes have to implement this method to supply the shape that represents the CanvasFigures. More... | |
boolean | hitOnStroke () |
Derived classes have to implement this method to indicate whether they are selected (hit) based on their stroke (border) or on their interior. More... |
|
00031 { 00032 super(0., 0., 0., 0.); 00033 _name = name; 00034 _nrC = nrC; 00035 _mediator = new HxMediatorPeer(); 00036 setInputSource(INP_SASYSTEM); 00037 updateBSplineCurve(); 00038 } |
|
Overrides CanvasObject interface.
Reimplemented from CanvasObject.
00044 { 00045 return _name; 00046 } |
|
00050 { 00051 _showControlPoly = b; 00052 } |
|
00056 { 00057 String[] args = new String[0]; 00058 String result = _mediator.callMethod("HxBSplineCurve", 00059 _name, "minT", "", args); 00060 return new Double(result).doubleValue(); 00061 } |
|
00065 { 00066 String[] args = new String[0]; 00067 String result = _mediator.callMethod("HxBSplineCurve", 00068 _name, "maxT", "", args); 00069 return new Double(result).doubleValue(); 00070 } |
|
00074 { 00075 String[] args = new String[1]; 00076 args[0] = new String("double " + java.lang.String.valueOf(t)); 00077 String result = _mediator.callMethod("HxBSplineCurve", 00078 _name, "C", "", args); 00079 int i = result.indexOf('('); 00080 int j = result.indexOf(','); 00081 return new Double(result.substring(i+1, j)).doubleValue(); 00082 } |
|
00086 { 00087 String[] args = new String[1]; 00088 args[0] = new String("double " + java.lang.String.valueOf(t)); 00089 String result = _mediator.callMethod("HxBSplineCurve", 00090 _name, "C", "", args); 00091 int i = result.indexOf(' '); 00092 int j = result.indexOf(')'); 00093 return new Double(result.substring(i+1, j)).doubleValue(); 00094 } |
|
00098 { 00099 String[] args = new String[1]; 00100 args[0] = new String("int " + java.lang.String.valueOf(n)); 00101 return _mediator.callMethod("HxBSplineCurve", _name, "sampleC", "", args); 00102 } |
|
00106 { 00107 String[] args = new String[0]; 00108 String result = _mediator.callMethod("HxBSplineCurve", 00109 _name, "numP", "", args); 00110 return new Integer(result).intValue(); 00111 } |
|
00115 { 00116 String[] args = new String[0]; 00117 return _mediator.callMethod("HxBSplineCurve", _name, "controlP", "", args); 00118 } |
|
Overrides CanvasObject interface. Extends the list of callable functions obtained from the parent with the functions for this class. Reimplemented from CanvasFigure.
00126 { 00127 Vector v = super.getVisualChangeMethods(); 00128 v.add(new CallableMethod("setShowControlPoly", "boolean", "b", "boolean")); 00129 return v; 00130 } |
|
Derived classes have to implement this method to supply the shape that represents the CanvasFigures. It is used to draw to figure as well as determine which figure is selected (hit) by the cursor within a canvas. Reimplemented from CanvasFigure.
00141 { 00142 // first do the curve itself 00143 int[] xp = getAddXCcs(); 00144 int[] yp = getAddYCcs(); 00145 GeneralPath curve = new GeneralPath(GeneralPath.WIND_NON_ZERO, xp.length); 00146 curve.moveTo(xp[0], yp[0]); 00147 for (int i=1 ; i < xp.length ; i++) 00148 curve.lineTo(xp[i], yp[i]); 00149 00150 // Then check whether control polygon should be visualized 00151 if (_showControlPoly) { 00152 int[] ccsX = new int[_cpX.length]; 00153 Converter.ICStoCCS(_cpX, ccsX, getZoomFactor()); 00154 int[] ccsY = new int[_cpY.length]; 00155 Converter.ICStoCCS(_cpY, ccsY, getZoomFactor()); 00156 GeneralPath cp = new GeneralPath(GeneralPath.WIND_NON_ZERO, _cpX.length); 00157 cp.moveTo(ccsX[0], ccsY[0]); 00158 for (int i=1 ; i < ccsX.length ; i++) 00159 cp.lineTo(ccsX[i], ccsY[i]); 00160 curve.append(cp, false); 00161 } 00162 00163 return curve; 00164 } |
|
Derived classes have to implement this method to indicate whether they are selected (hit) based on their stroke (border) or on their interior.
Reimplemented from CanvasFigure.
00168 { 00169 return true; 00170 } |