Class PainterConvex2D
java.lang.Object
jaba.panels.PainterConvex2D
This class draws all the part of the graph
- Author:
- Carlo Gimondi
-
Constructor Summary
ConstructorsConstructorDescriptionPainterConvex2D(Vector<Point2D> allDominants, int height, int width) Initialize the object from the vector where all the points are sored -
Method Summary
Modifier and TypeMethodDescriptionvoidaxis(Graphics2D g, String[] className) It draws the axis of the graphvoiddrawArea(Graphics g, Vector<Point2D> allConvex, Vector<Point2D> allDominants, Color area, Color maskedoff) This function draw the area among the axis and the point of the convex hullvoiddrawDominantArrow(Graphics2D g, Vector<Point2D> dominant, Vector<Point2D> dominates) When is select a Dominat point is draw an arrow from the dominantvoiddrawDragArea(Graphics2D g, Point dragPoint, Point beginPoint, Color c) Draw a semi-trasparet areavoiddrawFiltArea(Graphics2D g, Area filtArea) Draw a semi-trasparent area that is the filtered areavoiddrawMousePosition(Graphics2D g, Point dragPoint) This function traw a line near the coordinate of the mousevoidIt draws the points contained in a vector.voiddrawSelectLine(Graphics2D g, DPoint p1, DPoint p2, Vector<Object> s3d, String[] classNames) Draw the selected line of the convex hull and the information about itvoiddrawShadowPoint(Graphics2D g, Point p, Color c, int size) It draw a temporary point when a point is moved in another placeintReturn the size of the points on screendoublegetScale()Return the scale factordoublegetTrueX(double XonScreen) Return the true x on the graph from the mouse positiondoublegetTrueY(double YonScreen) Return the true y on the graph from the mouse positioninsidePoint(Point p) Set the parameter point as the dragPoint.voidpointLabel(Graphics2D g, Vector<Point2D> points) Print a label over every point, if the point is select the label contain the coordinate toobooleanselectLine(DPoint p1, DPoint p2, Point point) Return true if the point is on a line between the first and the second pointvoidIt draws that explains the simbols on the graphicbooleanIf a generic point and a point on the screen are the same pointtwoPointRectangle(int xP1, int yP1, int xP2, int yP2) Create a Polygon that is a rectangle draw between two pointbooleanupdate(int height, int width) If the height or the width are changed the parameters of the graph are update
-
Constructor Details
-
PainterConvex2D
-
-
Method Details
-
drawSelectLine
public void drawSelectLine(Graphics2D g, DPoint p1, DPoint p2, Vector<Object> s3d, String[] classNames) Draw the selected line of the convex hull and the information about it- Parameters:
g- Graphic objectp1- The first point of the linep2- The second point of the lines3d- Information aboute the classesclassNames- The name of the classes
-
update
public boolean update(int height, int width) If the height or the width are changed the parameters of the graph are update- Parameters:
height- The height of the windowwidth- The width of the window- Returns:
- true if somethig is change
-
axis
It draws the axis of the graph- Parameters:
g- The graphic objectclassName- The name of the classes
-
summary
It draws that explains the simbols on the graphic- Parameters:
g- The graphic object
-
twoPointRectangle
Create a Polygon that is a rectangle draw between two point- Parameters:
xP1- The x of the first pointyP1- The y of the first pointxP2- The x of the second pointyP2- The y of the second point- Returns:
- The rectangle in a polygon object
-
drawPoint
-
drawShadowPoint
It draw a temporary point when a point is moved in another place- Parameters:
g- The graphic objectp- The position of the pointc- The color of the pointsize- The size of the point
-
getScale
public double getScale()Return the scale factor- Returns:
- the scale factor
-
drawArea
public void drawArea(Graphics g, Vector<Point2D> allConvex, Vector<Point2D> allDominants, Color area, Color maskedoff) This function draw the area among the axis and the point of the convex hull- Parameters:
g- The graphic objectallConvex- The vector with the points of the convex hullallDominants- The vector with the dominant pointsarea- The filter areamaskedoff- The vector with the masked-off points
-
pointLabel
Print a label over every point, if the point is select the label contain the coordinate too- Parameters:
g- The graphic objectpoints- The vector with all points
-
drawDominantArrow
When is select a Dominat point is draw an arrow from the dominant- Parameters:
g- The graphic objectdominant- The vector with the dominant pointsdominates- The vector with the dominates points
-
drawMousePosition
This function traw a line near the coordinate of the mouse- Parameters:
g- The graphic objectdragPoint- The position of the mouse
-
drawFiltArea
Draw a semi-trasparent area that is the filtered area- Parameters:
g- The graphic objectfiltArea- The filtered area
-
drawDragArea
Draw a semi-trasparet area- Parameters:
g- The graphic objectdragPoint- The first pointbeginPoint- The second pointc- The color of the area
-
insidePoint
-
getTrueX
public double getTrueX(double XonScreen) Return the true x on the graph from the mouse position- Parameters:
XonScreen- The x of the point on screen- Returns:
- The true x point
-
getTrueY
public double getTrueY(double YonScreen) Return the true y on the graph from the mouse position- Parameters:
YonScreen- The y of the point on screen- Returns:
- The true y point
-
getPointSize
public int getPointSize()Return the size of the points on screen- Returns:
- The size of the points
-
selectLine
Return true if the point is on a line between the first and the second point- Parameters:
p1- The first point of the linep2- The second point of the linepoint- The point that could be on the line- Returns:
- True if the point is on a line between the first and the second point
-
theSame
-