Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes
Class WhiteboardShapePolygon

java.lang.Object
  extended by net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes.WhiteboardShape
      extended by net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes.WhiteboardShapePolygon
All Implemented Interfaces:
WhiteboardObject, WhiteboardObjectPolygon

public class WhiteboardShapePolygon
extends WhiteboardShape
implements WhiteboardObjectPolygon

a WhiteboardShapePolygon, in XML :

Author:
Julien Waechter

Field Summary
 
Fields inherited from interface net.java.sip.communicator.service.protocol.whiteboardobjects.WhiteboardObjectPolygon
NAME
 
Constructor Summary
WhiteboardShapePolygon(String id, int thickness, Color color, List<WhiteboardPoint> points, boolean fill)
          WhiteboardShapePolygon constructor.
WhiteboardShapePolygon(String id, int t, Color c, List<WhiteboardPoint> m_points, boolean fill, AffineTransform at)
          WhiteboardShapePolygon constructor.
 
Method Summary
 boolean contains(Point2D p)
          Tests if the shape contains a point.
 int getBackgroundColor()
          Returns an integer representing the background color of this object.
 List<WhiteboardPoint> getPoints()
          Returns a list of all the WhiteboardPoint instances that this WhiteboardObject is composed of.
 WhiteboardPoint getSelectionPoint(Point2D p)
          Tests if a point p is over a selection point.
 List<WhiteboardPoint> getSelectionPoints()
          Returns the list of selected WhiteboardPoints.
 boolean isFill()
          Returns the fill state of the WhiteboardObject.
 void paintShape(Graphics2D g, AffineTransform t)
          Code to paint the WhiteboardShapePolygon.
 void setBackgroundColor(int backColor)
          Specifies the background color for this object.
 void setFill(boolean fill)
          Sets the fill state of the WhiteboardObject.
 void setPoints(List<WhiteboardPoint> points)
          Sets the list of WhiteboardPoint instances that this WhiteboardObject is composed of.
 void translate(double deltaX, double deltaY)
          Translates the shape.
 void translateSelectedPoint(double deltaX, double deltaY)
          Translates a point from the shape.
 
Methods inherited from class net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes.WhiteboardShape
drawSelectedPoint, equals, getColor, getID, getModifyPoint, getOpacity, getThickness, isSelected, paint, preselect, select, setColor, setColor, setID, setModifyPoint, setOpacity, setSelected, setThickness
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.java.sip.communicator.service.protocol.whiteboardobjects.WhiteboardObject
getColor, getID, getThickness, setColor, setThickness
 

Constructor Detail

WhiteboardShapePolygon

public WhiteboardShapePolygon(String id,
                              int thickness,
                              Color color,
                              List<WhiteboardPoint> points,
                              boolean fill)
WhiteboardShapePolygon constructor.

Parameters:
id - String that uniquely identifies this WhiteboardObject
thickness - number of pixels that this object (or its border) should be thick
color - WhiteboardShapePolygon's color (or rather it's border)
points - list of WhiteboardPoint
fill - True is filled, false is unfilled

WhiteboardShapePolygon

public WhiteboardShapePolygon(String id,
                              int t,
                              Color c,
                              List<WhiteboardPoint> m_points,
                              boolean fill,
                              AffineTransform at)
WhiteboardShapePolygon constructor.

Parameters:
id - String that uniquely identifies this WhiteboardObject
t - number of pixels that this object (or its border) should be thick
c - WhiteboardShapePolygon's color (or rather it's border)
m_points - list of WhiteboardPoint
fill - True is filled, false is unfilled
at - 2D affine transformation
Method Detail

isFill

public boolean isFill()
Returns the fill state of the WhiteboardObject.

Specified by:
isFill in interface WhiteboardObjectPolygon
Returns:
True is filled, false is unfilled.

setFill

public void setFill(boolean fill)
Sets the fill state of the WhiteboardObject. True is filled, false is unfilled.

Specified by:
setFill in interface WhiteboardObjectPolygon
Parameters:
fill - The new fill state.

paintShape

public void paintShape(Graphics2D g,
                       AffineTransform t)
Code to paint the WhiteboardShapePolygon.

Specified by:
paintShape in class WhiteboardShape
Parameters:
g - graphics context
t - 2D affine transform

getSelectionPoints

public List<WhiteboardPoint> getSelectionPoints()
Returns the list of selected WhiteboardPoints.

Specified by:
getSelectionPoints in class WhiteboardShape
Returns:
list of selected WhiteboardPoints

contains

public boolean contains(Point2D p)
Tests if the shape contains a point.

Specified by:
contains in class WhiteboardShape
Parameters:
p - coord point
Returns:
true if shape contains p

getPoints

public List<WhiteboardPoint> getPoints()
Returns a list of all the WhiteboardPoint instances that this WhiteboardObject is composed of.

Specified by:
getPoints in interface WhiteboardObjectPolygon
Returns:
the list of WhiteboardPoints composing this object.

setPoints

public void setPoints(List<WhiteboardPoint> points)
Sets the list of WhiteboardPoint instances that this WhiteboardObject is composed of.

Specified by:
setPoints in interface WhiteboardObjectPolygon
Parameters:
points - the list of WhiteboardPoint instances that this WhiteboardObject is composed of.

translate

public void translate(double deltaX,
                      double deltaY)
Translates the shape.

Specified by:
translate in class WhiteboardShape
Parameters:
deltaX - x coord
deltaY - y coord

translateSelectedPoint

public void translateSelectedPoint(double deltaX,
                                   double deltaY)
Translates a point from the shape.

Specified by:
translateSelectedPoint in class WhiteboardShape
Parameters:
deltaX - x coord
deltaY - y coord

getSelectionPoint

public WhiteboardPoint getSelectionPoint(Point2D p)
Tests if a point p is over a selection point.

Specified by:
getSelectionPoint in class WhiteboardShape
Parameters:
p - point
Returns:
nearest selection point

setBackgroundColor

public void setBackgroundColor(int backColor)
Specifies the background color for this object. The color parameter must be encoded with standard RGB encoding: bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue.

Specified by:
setBackgroundColor in interface WhiteboardObjectPolygon
Parameters:
backColor - the color that we'd like to set for the background of this WhiteboardObject (using standard RGB encoding).

getBackgroundColor

public int getBackgroundColor()
Returns an integer representing the background color of this object. The return value uses standard RGB encoding: bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue.

Specified by:
getBackgroundColor in interface WhiteboardObjectPolygon
Returns:
the RGB value of the background color of this object.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.