org.opensourcephysics.drawing2d
Class VectorField

java.lang.Object
  extended by org.opensourcephysics.drawing2d.Element
      extended by org.opensourcephysics.drawing2d.Group
          extended by org.opensourcephysics.drawing2d.VectorField
All Implemented Interfaces:
Data, Drawable, Interactive, LogMeasurable, Measurable

public class VectorField
extends Group

A group of arrows that implements a simpler 2D vector field


Field Summary
 
Fields inherited from class org.opensourcephysics.drawing2d.Element
TARGET_POSITION, TARGET_SIZE
 
Constructor Summary
VectorField()
           
 
Method Summary
 void draw(DrawingPanel _panel, java.awt.Graphics _g)
          Draws the element on a given Graphics2D.
 VectorColorMapper getColorMapper()
           
 double getMagnitudeMaximum()
           
 double getMagnitudeMinimum()
           
 double getXMax()
          Gets the maximum x needed to draw this object.
 double getXMaxLogscale()
          Gets the maximum x needed to draw this object on a log scale.
 double getXMin()
          Gets the minimum x needed to draw this object.
 double getXMinLogscale()
          Gets the minimum x needed to draw this object on a log scale.
 double getYMax()
          Gets the maximum y needed to draw this object.
 double getYMaxLogscale()
          Gets the maximum y needed to draw this object on a log scale on a log scale.
 double getYMin()
          Gets the minimum y needed to draw this object.
 double getYMinLogscale()
          Gets the minimum y needed to draw this object on a log scale.
 double indexToX(int i)
          Gets the x coordinate for the given index.
 double indexToY(int i)
          Gets the y coordinate for the given index.
 boolean isMeasured()
          Determines if information is available to set min/max values.
 boolean prepareField()
           
 void setArrowType(int type)
           
 void setAutoscaleMagnitude(boolean scale)
           
 void setConstantLength(double length)
           
 void setInvisibleLevel(int level)
           
 void setMagnitude(double magnitude)
           
 void setMagnitudeData(double[][] data)
           
 void setMagnitudeExtrema(double min, double max)
           
 void setMapperPaletteType(int _type)
           
 void setMaxColor(java.awt.Color _aColor)
           
 void setMaximumX(double max)
           
 void setMaximumY(double max)
           
 void setMinColor(java.awt.Color _aColor)
           
 void setMinimumX(double min)
           
 void setMinimumY(double min)
           
 void setNumberOfLevels(int _lev)
           
 void setRelativePosition(int position)
           
 void setShowLegend(boolean _visible)
           
 void setUseColorMapper(boolean _do)
           
 void setVectorAngle(double size)
           
 void setVectorAngleData(double[][] data)
           
 void setVectorSizeX(double size)
           
 void setVectorSizeXData(double[][] data)
           
 void setVectorSizeY(double size)
           
 void setVectorSizeYData(double[][] data)
           
 
Methods inherited from class org.opensourcephysics.drawing2d.Group
addElement, addElementAtIndex, addElements, clear, findInteractive, getColumnNames, getData2D, getData3D, getDataList, getDatasets, getElement, getElements, getFillColors, getID, getInteractedIndex, getLineColors, hasChanged, initialize, removeAllElements, removeElement, setID, setNeedToProject
 
Methods inherited from class org.opensourcephysics.drawing2d.Element
addInteractionListener, getCanBeMeasured, getDataObject, getInteractionTarget, getName, getPanel, getPosition, getSize, getSizeX, getSizeY, getStyle, getTransformation, getX, getY, invokeActions, isEnabled, isVisible, removeInteractionListener, setCanBeMeasured, setDataObject, setElementChanged, setEnabled, setName, setPanel, setPosition, setSize, setSizeX, setSizeXY, setSizeY, setTransformation, setVisible, setX, setXY, setY, toBodyFrame, toSpaceFrame, updateHotSpot
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensourcephysics.display.Data
getName
 

Constructor Detail

VectorField

public VectorField()
Method Detail

setMinimumX

public void setMinimumX(double min)

setMaximumX

public void setMaximumX(double max)

setMinimumY

public void setMinimumY(double min)

setMaximumY

public void setMaximumY(double max)

setVectorSizeXData

public void setVectorSizeXData(double[][] data)

setVectorSizeX

public void setVectorSizeX(double size)

setVectorSizeYData

public void setVectorSizeYData(double[][] data)

setVectorSizeY

public void setVectorSizeY(double size)

setVectorAngleData

public void setVectorAngleData(double[][] data)

setVectorAngle

public void setVectorAngle(double size)

setConstantLength

public void setConstantLength(double length)

setAutoscaleMagnitude

public void setAutoscaleMagnitude(boolean scale)

setMagnitudeExtrema

public void setMagnitudeExtrema(double min,
                                double max)

getMagnitudeMinimum

public double getMagnitudeMinimum()

getMagnitudeMaximum

public double getMagnitudeMaximum()

setMagnitudeData

public void setMagnitudeData(double[][] data)

setMagnitude

public void setMagnitude(double magnitude)

setNumberOfLevels

public void setNumberOfLevels(int _lev)

setMinColor

public void setMinColor(java.awt.Color _aColor)

setMaxColor

public void setMaxColor(java.awt.Color _aColor)

setInvisibleLevel

public void setInvisibleLevel(int level)

setArrowType

public void setArrowType(int type)

setRelativePosition

public void setRelativePosition(int position)

setUseColorMapper

public void setUseColorMapper(boolean _do)

setMapperPaletteType

public void setMapperPaletteType(int _type)

getColorMapper

public VectorColorMapper getColorMapper()

setShowLegend

public void setShowLegend(boolean _visible)

indexToX

public double indexToX(int i)
Gets the x coordinate for the given index.

Parameters:
i - int
Returns:
double the x coordinate

indexToY

public double indexToY(int i)
Gets the y coordinate for the given index.

Parameters:
i - int
Returns:
double the y coordinate

isMeasured

public boolean isMeasured()
Description copied from interface: Measurable
Determines if information is available to set min/max values. Objects that store data should return false if data is null.

Specified by:
isMeasured in interface Measurable
Overrides:
isMeasured in class Group
Returns:
true if min/max values are valid

getXMin

public double getXMin()
Description copied from interface: Measurable
Gets the minimum x needed to draw this object.

Specified by:
getXMin in interface Measurable
Overrides:
getXMin in class Element
Returns:
minimum

getXMax

public double getXMax()
Description copied from interface: Measurable
Gets the maximum x needed to draw this object.

Specified by:
getXMax in interface Measurable
Overrides:
getXMax in class Element
Returns:
maximum

getYMin

public double getYMin()
Description copied from interface: Measurable
Gets the minimum y needed to draw this object.

Specified by:
getYMin in interface Measurable
Overrides:
getYMin in class Element
Returns:
minimum

getYMax

public double getYMax()
Description copied from interface: Measurable
Gets the maximum y needed to draw this object.

Specified by:
getYMax in interface Measurable
Overrides:
getYMax in class Element
Returns:
minimum

getXMinLogscale

public double getXMinLogscale()
Description copied from interface: LogMeasurable
Gets the minimum x needed to draw this object on a log scale.

Specified by:
getXMinLogscale in interface LogMeasurable
Overrides:
getXMinLogscale in class Element
Returns:
minimum

getXMaxLogscale

public double getXMaxLogscale()
Description copied from interface: LogMeasurable
Gets the maximum x needed to draw this object on a log scale.

Specified by:
getXMaxLogscale in interface LogMeasurable
Overrides:
getXMaxLogscale in class Element
Returns:
maximum

getYMinLogscale

public double getYMinLogscale()
Description copied from interface: LogMeasurable
Gets the minimum y needed to draw this object on a log scale.

Specified by:
getYMinLogscale in interface LogMeasurable
Overrides:
getYMinLogscale in class Element
Returns:
minimum

getYMaxLogscale

public double getYMaxLogscale()
Description copied from interface: LogMeasurable
Gets the maximum y needed to draw this object on a log scale on a log scale.

Specified by:
getYMaxLogscale in interface LogMeasurable
Overrides:
getYMaxLogscale in class Element
Returns:
maximum

draw

public void draw(DrawingPanel _panel,
                 java.awt.Graphics _g)
Description copied from class: Element
Draws the element on a given Graphics2D. Required by Drawable (in Interactive)

Specified by:
draw in interface Drawable
Overrides:
draw in class Group

prepareField

public boolean prepareField()