Class Convex2DGraph
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
jaba.graphs.JabaGraph
jaba.graphs.Convex2DGraph
- All Implemented Interfaces:
MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
This class draws all the part of the graph
- Author:
- Carlo Gimondi, modified by Sebastiano Spicuglia
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class JabaGraph
JabaGraph.PlotPopupMenuNested classes/interfaces inherited from class JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
Fields inherited from class JabaGraph
popup, zoomStartPointFields inherited from class JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionConvex2DGraph(JabaModel data, JabaController mainWin) Initialize the object from the vector where all the points are sored -
Method Summary
Modifier and TypeMethodDescriptionvoiddrawArea(Graphics2D g, Vector<Point2D> allConvex, Color color) 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 dominantvoiddrawFiltArea(Graphics2D g, Area filtArea) Draw a semi-trasparent area that is the filtered areavoiddrawMaskedOffRectangle(Graphics2D g, Point2D point, Color color) voidIt draws the points contained in a vector.voiddrawSelectLine(Graphics2D g, DPoint p1, DPoint p2) 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 placevoidfillArea(Graphics2D g, Vector<Point2D> allConvex, Color color) intReturn the size of the points on screendoublegetTrueX(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 positionvoidvoidvoidvoidvoidvoidvoidvoidvoidpointLabel(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 pointvoidshowAllLabels(boolean b) voidIt 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 pointMethods inherited from class JabaGraph
adjustMousePoint, adjustMousePoint, adjustMousePoint2, rightClick, translateX, translateY, zoomMethods inherited from class JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Constructor Details
-
Convex2DGraph
Initialize the object from the vector where all the points are sored- Parameters:
data- the Jaba model to showmainWin- the Jaba controller
-
-
Method Details
-
paint
-
drawSelectLine
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 line
-
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
-
drawArea
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 hullcolor- The color of the area
-
fillArea
-
drawMaskedOffRectangle
-
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
-
drawFiltArea
Draw a semi-trasparent area that is the filtered area- Parameters:
g- The graphic objectfiltArea- The filtered area
-
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
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener
-
mouseDragged
- Specified by:
mouseDraggedin interfaceMouseMotionListener
-
mouseEntered
- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseExited
- Specified by:
mouseExitedin interfaceMouseListener
-
mouseClicked
- Specified by:
mouseClickedin interfaceMouseListener
-
showAllLabels
public void showAllLabels(boolean b)
-