Horus Doc || Java GUI Reference || Doxygen's quick Index  

CanvasHxBSplineCurve Class Reference

Display a HxBSplineCurve (C++ object). More...

Inheritance diagram for CanvasHxBSplineCurve::

CanvasFigure CanvasObject List of all members.

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...


Detailed Description

Display a HxBSplineCurve (C++ object).


Constructor & Destructor Documentation

CanvasHxBSplineCurve::CanvasHxBSplineCurve String    name,
int    nrC
[inline]
 

Constructor.

00031 {
00032     super(0., 0., 0., 0.);
00033     _name = name;
00034     _nrC = nrC;
00035     _mediator = new HxMediatorPeer();
00036     setInputSource(INP_SASYSTEM);
00037     updateBSplineCurve();
00038 }


Member Function Documentation

String CanvasHxBSplineCurve::getSaName   [inline]
 

Overrides CanvasObject interface.

Reimplemented from CanvasObject.

00044 {
00045     return _name;
00046 }

void CanvasHxBSplineCurve::setShowControlPoly boolean    b [inline]
 

00050 {
00051     _showControlPoly = b;
00052 }

double CanvasHxBSplineCurve::getMinT   [inline]
 

00056 {
00057     String[] args = new String[0];
00058     String result = _mediator.callMethod("HxBSplineCurve",
00059                                          _name, "minT", "", args);
00060     return new Double(result).doubleValue();
00061 }

double CanvasHxBSplineCurve::getMaxT   [inline]
 

00065 {
00066     String[] args = new String[0];
00067     String result = _mediator.callMethod("HxBSplineCurve",
00068                                          _name, "maxT", "", args);
00069     return new Double(result).doubleValue();
00070 }

double CanvasHxBSplineCurve::getCX double    t [inline]
 

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 }

double CanvasHxBSplineCurve::getCY double    t [inline]
 

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 }

String CanvasHxBSplineCurve::getSampleC int    n [inline]
 

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 }

int CanvasHxBSplineCurve::getNumP   [inline]
 

00106 {
00107     String[] args = new String[0];
00108     String result = _mediator.callMethod("HxBSplineCurve",
00109                                          _name, "numP", "", args);
00110     return new Integer(result).intValue();
00111 }

String CanvasHxBSplineCurve::getControlP   [inline]
 

00115 {
00116     String[] args = new String[0];
00117     return _mediator.callMethod("HxBSplineCurve", _name, "controlP", "", args);
00118 }

Vector CanvasHxBSplineCurve::getVisualChangeMethods   [inline]
 

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 }

Shape CanvasHxBSplineCurve::getShape   [inline, protected, virtual]
 

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 }

boolean CanvasHxBSplineCurve::hitOnStroke   [inline, protected, virtual]
 

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 }


The documentation for this class was generated from the following file:
Generated on Tue Feb 3 14:19:39 2004 for JavaReference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001