Inheritance diagram for CanvasColoredPolyline::
Public Methods | |
CanvasColoredPolyline (double[] xpoints, double[] ypoints, int npoints, Color[] colors) | |
CanvasColoredPolyline (double[] xpoints, double[] ypoints, int npoints, Color[] colors, boolean closed) | |
CanvasColoredPolyline (double[] xpoints, double[] ypoints, int npoints, Color[] colors, boolean stroke, float linew, float trans, boolean closed, double ccs_scale) | |
void | draw (Graphics g) |
Draw CanvasObject on 'g', using internal CCS values. More... | |
Object | clone () |
Return an identical copy of this CanvasObject. More... | |
void | setColor (Color color) |
void | addPoint (double x, double y, Color color) |
boolean | removePoint (int index) |
CanvasColoredPolyline (int[] xpoints, int[] ypoints, int npoints, Color[] colors, boolean closed, double ccs_scale) | |
void | addPoint (int x, int y, Color color) |
Protected Methods | |
void | initColoredPoly (Color[] colors) |
void | transformICStoCCS () |
Perform a full ICS to CCS coordinate transformation. More... | |
void | transformCCStoICS () |
Perform a full CCS to ICS coordinate transformation. More... | |
void | setMidPoints () |
Protected Attributes | |
Color[] | colors = null |
int[] | midXPoints = null |
int[] | midYPoints = null |
|
|
|
|
|
00048 { 00049 00050 super(xpoints, ypoints, npoints, COPY_MODE, 00051 DEF_COLOR, stroke, linew, trans, closed, ccs_scale); 00052 initColoredPoly(colors); 00053 } |
|
00153 { 00154 super(xpoints, ypoints, npoints, 00155 COPY_MODE, DEF_COLOR, closed, ccs_scale); 00156 initColoredPoly(colors); 00157 } |
|
Draw CanvasObject on 'g', using internal CCS values.
Reimplemented from CanvasPolyline.
00060 { 00061 setupDrawMode(g); 00062 00063 if (!getTransformOK()) { 00064 transformICStoCCS(); 00065 } 00066 00067 for (int i=0; i<ccs_poly.npoints-1; i++) { 00068 g.setColor(colors[i]); 00069 g.drawLine(ccs_poly.xpoints[i], ccs_poly.ypoints[i], 00070 midXPoints[i], midYPoints[i]); 00071 g.setColor(colors[i+1]); 00072 g.drawLine(midXPoints[i], midYPoints[i], 00073 ccs_poly.xpoints[i+1], ccs_poly.ypoints[i+1]); 00074 } 00075 00076 if (closed) { 00077 int index = ccs_poly.npoints-1; 00078 g.drawLine(ccs_poly.xpoints[index], ccs_poly.ypoints[index], 00079 midXPoints[index], midYPoints[index]); 00080 g.setColor(colors[0]); 00081 g.drawLine(midXPoints[index], midYPoints[index], 00082 ccs_poly.xpoints[0], ccs_poly.ypoints[0]); 00083 } 00084 } |
|
Return an identical copy of this CanvasObject.
Reimplemented from CanvasPolyline.
00088 { 00089 return (new CanvasColoredPolyline(ics_xPoints, ics_yPoints, 00090 ccs_poly.npoints, colors, strokeSet, 00091 lineWidth, transparency, closed, getZoomFactor())); 00092 } |
|
Reimplemented from ScribbleFigure.
|
|
00108 { 00109 super.addPoint(x, y); 00110 00111 Color[] tmp = new Color[colors.length+1]; 00112 for (int i=0; i<colors.length; i++) { 00113 tmp[i] = colors[i]; 00114 } 00115 tmp[tmp.length-1] = color; 00116 00117 colors = new Color[tmp.length]; 00118 for (int i=0; i<tmp.length; i++) { 00119 colors[i] = tmp[i]; 00120 } 00121 00122 setTransformOK(false); 00123 } |
|
Reimplemented from CanvasPolyline.
00127 { 00128 if (!(super.removePoint(index))) { 00129 return false; 00130 } 00131 setTransformOK(false); 00132 return true; 00133 } |
|
00161 { 00162 super.addPoint(x, y); 00163 00164 Color[] tmp = new Color[colors.length+1]; 00165 for (int i=0; i<colors.length; i++) { 00166 tmp[i] = colors[i]; 00167 } 00168 tmp[tmp.length-1] = color; 00169 00170 colors = new Color[tmp.length]; 00171 for (int i=0; i<tmp.length; i++) { 00172 colors[i] = tmp[i]; 00173 } 00174 } |
|
00188 { 00189 hasNoColor = false; 00190 setInputSource(INP_SASYSTEM); 00191 this.colors = new Color[colors.length]; 00192 for (int i=0; i<colors.length; i++) { 00193 this.colors[i] = colors[i]; 00194 } 00195 midXPoints = new int[ccs_poly.npoints]; 00196 midYPoints = new int[ccs_poly.npoints]; 00197 setMidPoints(); 00198 } |
|
Perform a full ICS to CCS coordinate transformation.
Reimplemented from CanvasPolyline.
00202 { 00203 super.transformICStoCCS(); 00204 setMidPoints(); 00205 } |
|
Perform a full CCS to ICS coordinate transformation. This function is used only for scribbled objects. Reimplemented from CanvasPolyline.
00209 { 00210 super.transformCCStoICS(); 00211 setMidPoints(); 00212 } |
|
00216 { 00217 if (ccs_poly != null) { 00218 midXPoints = new int[ccs_poly.npoints]; 00219 midYPoints = new int[ccs_poly.npoints]; 00220 00221 for (int i=0; i<ccs_poly.npoints-1; i++) { 00222 midXPoints[i] = (int)((ccs_poly.xpoints[i] + ccs_poly.xpoints[i+1]) / 2 + 0.5); 00223 midYPoints[i] = (int)((ccs_poly.ypoints[i] + ccs_poly.ypoints[i+1]) / 2 + 0.5); 00224 } 00225 midXPoints[ccs_poly.npoints-1] = (int)((ccs_poly.xpoints[ccs_poly.npoints-1] + ccs_poly.xpoints[0]) / 2 + 0.5); 00226 midYPoints[ccs_poly.npoints-1] = (int)((ccs_poly.ypoints[ccs_poly.npoints-1] + ccs_poly.ypoints[0]) / 2 + 0.5); 00227 } 00228 } |
|
|
|
|
|
|