|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectgrafica.GLayer
public class GLayer
Layer class. A GLayer usually contains an array of points and a histogram
| Field Summary |
|---|
| Constructor Summary | |
|---|---|
GLayer(PApplet parent,
String id,
float[] dim,
float[] xLim,
float[] yLim,
boolean xLog,
boolean yLog)
GLayer constructor |
|
| Method Summary | |
|---|---|
void |
addPoint(float x,
float y)
Adds a new point to the layer points |
void |
addPoint(float x,
float y,
String label)
Adds a new point to the layer points |
void |
addPoint(GPoint newPoint)
Adds a new point to the layer points |
void |
addPoint(int index,
float x,
float y)
Adds a new point to the layer points |
void |
addPoint(int index,
float x,
float y,
String label)
Adds a new point to the layer points |
void |
addPoint(int index,
GPoint newPoint)
Adds a new point to the layer points |
void |
addPoints(GPointsArray newPoints)
Adds new points to the layer points |
void |
drawAnnotation(String text,
float x,
float y,
int horAlign,
int verAlign)
Draws an annotation at a given plot value |
void |
drawFilledContour(int contourType,
float referenceValue)
Draws a filled contour connecting consecutive points in the layer and a reference value |
void |
drawHistogram()
Draws the histogram |
void |
drawHorizontalLine(float value)
Draws an horizontal line |
void |
drawHorizontalLine(float value,
int lc,
float lw)
Draws an horizontal line |
void |
drawLabel(GPoint point)
Draws the label of a given point |
void |
drawLabelAtPlotPos(float xPlot,
float yPlot)
Draws the label of the closest point in the layer to a given plot position |
void |
drawLine(float slope,
float yCut)
Draws a line defined by the slope and the cut in the y axis |
void |
drawLine(float slope,
float yCut,
int lc,
float lw)
Draws a line defined by the slope and the cut in the y axis |
void |
drawLine(GPoint point1,
GPoint point2)
Draws a line between two points |
void |
drawLine(GPoint point1,
GPoint point2,
int lc,
float lw)
Draws a line between two points |
void |
drawLines()
Draws lines connecting consecutive points in the layer |
void |
drawPoint(GPoint point)
Draws a point |
void |
drawPoint(GPoint point,
int pointColor,
float pointSize)
Draws a point |
void |
drawPoint(GPoint point,
PImage pointImg)
Draws a point |
void |
drawPoint(GPoint point,
PShape pointShape)
Draws a point |
void |
drawPoint(GPoint point,
PShape pointShape,
int pointColor)
Draws a point |
void |
drawPoints()
Draws the points inside the layer limits |
void |
drawPoints(PImage pointImg)
Draws the points inside the layer limits |
void |
drawPoints(PShape pointShape)
Draws the points inside the layer limits |
void |
drawPolygon(GPointsArray polygonPoints,
int polygonColor)
Draws a polygon defined by a set of points |
void |
drawVerticalLine(float value)
Draws a vertical line |
void |
drawVerticalLine(float value,
int lc,
float lw)
Draws a vertical line |
float[] |
getDim()
Returns the layer dimensions |
GHistogram |
getHistogram()
Returns the layer histogram |
String |
getId()
Returns the layer id |
int |
getLineColor()
Returns the layer line color |
float |
getLineWidth()
Returns the layer line width |
GPoint |
getPointAtPlotPos(float xPlot,
float yPlot)
Returns the closest point (if any) to a given position in the plot reference system |
int[] |
getPointColors()
Returns the layer point colors array |
int |
getPointIndexAtPlotPos(float xPlot,
float yPlot)
Returns the position index of the closest point (if any) to a given position in the plot reference system |
GPointsArray |
getPoints()
Returns a copy of the layer points |
float[] |
getPointSizes()
Returns the layer point sizes array |
GPointsArray |
getPointsRef()
Returns the layer points |
float[] |
getXLim()
Returns the layer horizontal limits |
boolean |
getXLog()
Returns the layer horizontal scale |
float[] |
getYLim()
Returns the layer vertical limits |
boolean |
getYLog()
Returns the layer vertical scale |
boolean |
isId(String someId)
Checks if the layer's id is equal to a given id |
boolean |
isInside(float xPlot,
float yPlot)
Checks if a given (xPlot, yPlot) position in the plot reference system is inside the layer limits |
boolean |
isInside(GPoint plotPoint)
Checks if a given point in the plot reference system is inside the layer limits |
boolean[] |
isInside(GPointsArray plotPts)
Checks if a given set of points in the plot reference system is inside the layer limits |
float[] |
plotToValue(float xPlot,
float yPlot)
Returns the plot values at a given position in the plot reference system |
void |
removePoint(int index)
Removes one of the layer points |
void |
setAllFontProperties(String newFontName,
int newFontColor,
int newFontSize)
Sets the font properties in the layer and the histogram |
void |
setDim(float[] newDim)
Sets the layer dimensions, which should be equal to the plot box dimensions |
void |
setDim(float xDim,
float yDim)
Sets the layer dimensions |
void |
setDrawHistLabels(boolean drawHistLabels)
Sets if the histogram labels will be drawn or not |
void |
setFontColor(int newFontColor)
Sets the font color |
void |
setFontName(String newFontName)
Sets the font name |
void |
setFontProperties(String newFontName,
int newFontColor,
int newFontSize)
Sets all the font properties at once |
void |
setFontSize(int newFontSize)
Sets the font size |
void |
setHistBasePoint(GPoint newHistBasePoint)
Sets the histogram base point |
void |
setHistType(int histType)
Sets the histogram type |
void |
setHistVisible(boolean visible)
Sets if the histogram is visible or not |
void |
setInside(boolean[] newInside)
Sets which points are inside the box |
void |
setLabelBgColor(int newLabelBgColor)
Sets the label background color |
void |
setLabelSeparation(float[] newLabelSeparation)
Sets the label separation |
void |
setLimAndLog(float[] newXLim,
float[] newYLim,
boolean newXLog,
boolean newYLog)
Sets the horizontal and vertical limits and the horizontal and vertical scales |
void |
setLimAndLog(float xMin,
float xMax,
float yMin,
float yMax,
boolean newXLog,
boolean newYLog)
Sets the horizontal and vertical limits and the horizontal and vertical scales |
void |
setLineColor(int newLineColor)
Sets the line color |
void |
setLineWidth(float newLineWidth)
Sets the line width |
void |
setPoint(int index,
float x,
float y)
Sets one of the layer points |
void |
setPoint(int index,
float x,
float y,
String label)
Sets one of the layer points |
void |
setPoint(int index,
GPoint newPoint)
Sets one of the layer points |
void |
setPointColor(int newPointColor)
Sets the points color |
void |
setPointColors(int[] newPointColors)
Sets the points colors |
void |
setPoints(GPointsArray newPoints)
Sets the layer points |
void |
setPointSize(float newPointSize)
Sets the points size |
void |
setPointSizes(float[] newPointSizes)
Sets the points sizes |
void |
setXLim(float[] newXLim)
Sets the horizontal limits |
void |
setXLim(float xMin,
float xMax)
Sets the horizontal limits |
void |
setXLog(boolean newXLog)
Sets the horizontal scale |
void |
setXYLim(float[] newXLim,
float[] newYLim)
Sets the horizontal and vertical limits |
void |
setXYLim(float xMin,
float xMax,
float yMin,
float yMax)
Sets the horizontal and vertical limits |
void |
setYLim(float[] newYLim)
Sets the vertical limits |
void |
setYLim(float yMin,
float yMax)
Sets the vertical limits |
void |
setYLog(boolean newYLog)
Sets the vertical scale |
void |
startHistogram(int histType)
Initializes the histogram |
float[] |
valueToPlot(float x,
float y)
Calculates the position of a given (x, y) point in the plot reference system |
GPoint |
valueToPlot(GPoint point)
Calculates the position of a given point in the plot reference system |
GPointsArray |
valueToPlot(GPointsArray pts)
Calculates the positions of a given set of points in the plot reference system |
float |
valueToXPlot(float x)
Calculates the position of the x value in the plot reference system |
float |
valueToYPlot(float y)
Calculates the position of the y value in the plot reference system |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GLayer(PApplet parent,
String id,
float[] dim,
float[] xLim,
float[] yLim,
boolean xLog,
boolean yLog)
parent - the parent Processing appletid - the layer iddim - the plot box dimensions in pixelsxLim - the horizontal limitsyLim - the vertical limitsxLog - the horizontal scale. True if it's logarithmicyLog - the vertical scale. True if it's logarithmic| Method Detail |
|---|
public boolean isId(String someId)
someId - the id to check
public float valueToXPlot(float x)
x - the x value
public float valueToYPlot(float y)
y - the y value
public float[] valueToPlot(float x,
float y)
x - the x valuey - the y value
public GPoint valueToPlot(GPoint point)
point - the point
public GPointsArray valueToPlot(GPointsArray pts)
pts - the set of points
public float[] plotToValue(float xPlot,
float yPlot)
xPlot - x position in the plot reference systemyPlot - y position in the plot reference system
public boolean isInside(float xPlot,
float yPlot)
xPlot - x position in the plot reference systemyPlot - y position in the plot reference system
public boolean isInside(GPoint plotPoint)
plotPoint - the point in the plot reference system
public boolean[] isInside(GPointsArray plotPts)
plotPts - the set of points to check
public int getPointIndexAtPlotPos(float xPlot,
float yPlot)
xPlot - x position in the plot reference systemyPlot - y position in the plot reference system
public GPoint getPointAtPlotPos(float xPlot,
float yPlot)
xPlot - x position in the plot reference systemyPlot - y position in the plot reference system
public void startHistogram(int histType)
histType - the type of histogram to use. It can be GPlot.VERTICAL or
GPlot.HORIZONTALpublic void drawPoints()
public void drawPoints(PShape pointShape)
pointShape - the shape that should be used to represent the pointspublic void drawPoints(PImage pointImg)
pointImg - the image that should be used to represent the points
public void drawPoint(GPoint point,
int pointColor,
float pointSize)
point - the point to drawpointColor - color to usepointSize - point size in pixelspublic void drawPoint(GPoint point)
point - the point to draw
public void drawPoint(GPoint point,
PShape pointShape)
point - the point to drawpointShape - the shape that should be used to represent the point
public void drawPoint(GPoint point,
PShape pointShape,
int pointColor)
point - the point to drawpointShape - the shape that should be used to represent the pointspointColor - color to use
public void drawPoint(GPoint point,
PImage pointImg)
point - the point to drawpointImg - the image that should be used to represent the pointpublic void drawLines()
public void drawLine(GPoint point1,
GPoint point2,
int lc,
float lw)
point1 - first pointpoint2 - second pointlc - line colorlw - line width
public void drawLine(GPoint point1,
GPoint point2)
point1 - first pointpoint2 -
public void drawLine(float slope,
float yCut,
int lc,
float lw)
slope - the line slopeyCut - the line y axis cutlc - line colorlw - line width
public void drawLine(float slope,
float yCut)
slope - the line slopeyCut - the line y axis cut
public void drawHorizontalLine(float value,
int lc,
float lw)
value - line horizontal valuelc - line colorlw - line widthpublic void drawHorizontalLine(float value)
value - line horizontal value
public void drawVerticalLine(float value,
int lc,
float lw)
value - line vertical valuelc - line colorlw - line widthpublic void drawVerticalLine(float value)
value - line vertical value
public void drawFilledContour(int contourType,
float referenceValue)
contourType - the type of contours to use. It can be GPlot.VERTICAL or
GPlot.HORIZONTALreferenceValue - the reference value to use to close the contourpublic void drawLabel(GPoint point)
point - the point
public void drawLabelAtPlotPos(float xPlot,
float yPlot)
xPlot - x position in the plot reference systemyPlot - y position in the plot reference systempublic void drawHistogram()
public void drawPolygon(GPointsArray polygonPoints,
int polygonColor)
polygonPoints - the points that define the polygonpolygonColor - the color to use to draw the polygon (contour and background)
public void drawAnnotation(String text,
float x,
float y,
int horAlign,
int verAlign)
text - the annotation textx - x plot valuey - y plot valuehorAlign - text horizontal alignment. It can be RIGHT, LEFT or CENTERverAlign - text vertical alignment. It can be TOP, BOTTOM or CENTER
public void setDim(float xDim,
float yDim)
xDim - the new layer x dimensionyDim - the new layer y dimensionpublic void setDim(float[] newDim)
newDim - the new layer dimensions
public void setXLim(float xMin,
float xMax)
xMin - the minimum limit valuexMax - the maximum limit valuepublic void setXLim(float[] newXLim)
newXLim - the new horizontal limits
public void setYLim(float yMin,
float yMax)
yMin - the minimum limit valueyMax - the maximum limit valuepublic void setYLim(float[] newYLim)
newYLim - the new vertical limits
public void setXYLim(float xMin,
float xMax,
float yMin,
float yMax)
xMin - the minimum horizontal limit valuexMax - the maximum horizontal limit valueyMin - the minimum vertical limit valueyMax - the maximum vertical limit value
public void setXYLim(float[] newXLim,
float[] newYLim)
newXLim - the new horizontal limitsnewYLim - the new vertical limits
public void setLimAndLog(float xMin,
float xMax,
float yMin,
float yMax,
boolean newXLog,
boolean newYLog)
xMin - the minimum horizontal limit valuexMax - the maximum horizontal limit valueyMin - the minimum vertical limit valueyMax - the maximum vertical limit valuenewXLog - the new horizontal scalenewYLog - the new vertical scale
public void setLimAndLog(float[] newXLim,
float[] newYLim,
boolean newXLog,
boolean newYLog)
newXLim - the new horizontal limitsnewYLim - the new vertical limitsnewXLog - the new horizontal scalenewYLog - the new vertical scalepublic void setXLog(boolean newXLog)
newXLog - the new horizontal scalepublic void setYLog(boolean newYLog)
newYLog - the new vertical scalepublic void setPoints(GPointsArray newPoints)
newPoints - the new points
public void setPoint(int index,
float x,
float y,
String label)
index - the point positionx - the point new x coordinatey - the point new y coordinatelabel - the point new label
public void setPoint(int index,
float x,
float y)
index - the point positionx - the point new x coordinatey - the point new y coordinate
public void setPoint(int index,
GPoint newPoint)
index - the point positionnewPoint - the new point
public void addPoint(float x,
float y,
String label)
x - the new point x coordinatey - the new point y coordinatelabel - the new point label
public void addPoint(float x,
float y)
x - the new point x coordinatey - the new point y coordinatepublic void addPoint(GPoint newPoint)
newPoint - the point to add
public void addPoint(int index,
float x,
float y,
String label)
index - the position to add the pointx - the new point x coordinatey - the new point y coordinatelabel - the new point label
public void addPoint(int index,
float x,
float y)
index - the position to add the pointx - the new point x coordinatey - the new point y coordinate
public void addPoint(int index,
GPoint newPoint)
index - the position to add the pointnewPoint - the point to addpublic void addPoints(GPointsArray newPoints)
newPoints - the points to addpublic void removePoint(int index)
index - the point positionpublic void setInside(boolean[] newInside)
newInside - a boolean array with the information whether a point is inside
or notpublic void setPointColors(int[] newPointColors)
newPointColors - the new point colorspublic void setPointColor(int newPointColor)
newPointColor - the new point colorpublic void setPointSizes(float[] newPointSizes)
newPointSizes - the new point sizespublic void setPointSize(float newPointSize)
newPointSize - the new point sizepublic void setLineColor(int newLineColor)
newLineColor - the new line colorpublic void setLineWidth(float newLineWidth)
newLineWidth - the new line widthpublic void setHistBasePoint(GPoint newHistBasePoint)
newHistBasePoint - the new histogram base pointpublic void setHistType(int histType)
histType - the new histogram type. It can be GPlot.HORIZONTAL or
GPlot.VERTICALpublic void setHistVisible(boolean visible)
visible - if true, the histogram is visiblepublic void setDrawHistLabels(boolean drawHistLabels)
drawHistLabels - if true, the histogram labels will be drawnpublic void setLabelBgColor(int newLabelBgColor)
newLabelBgColor - the new label background colorpublic void setLabelSeparation(float[] newLabelSeparation)
newLabelSeparation - the new label separationpublic void setFontName(String newFontName)
newFontName - the name of the new fontpublic void setFontColor(int newFontColor)
newFontColor - the new font colorpublic void setFontSize(int newFontSize)
newFontSize - the new font size
public void setFontProperties(String newFontName,
int newFontColor,
int newFontSize)
newFontName - the name of the new fontnewFontColor - the new font colornewFontSize - the new font size
public void setAllFontProperties(String newFontName,
int newFontColor,
int newFontSize)
newFontName - the new font namenewFontColor - the new font colornewFontSize - the new font sizepublic String getId()
public float[] getDim()
public float[] getXLim()
public float[] getYLim()
public boolean getXLog()
public boolean getYLog()
public GPointsArray getPoints()
public GPointsArray getPointsRef()
public int[] getPointColors()
public float[] getPointSizes()
public int getLineColor()
public float getLineWidth()
public GHistogram getHistogram()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||