com.xj.anylogic.engine.presentation
Class ShapePixel

java.lang.Object
  extended by com.xj.anylogic.engine.presentation.Shape
      extended by com.xj.anylogic.engine.presentation.ShapePixel
All Implemented Interfaces:
com.xj.anylogic.engine.internal.Child, Locatable2D, java.io.Serializable, java.lang.Cloneable

public class ShapePixel
extends Shape

Persistent pixel shape.

Author:
XJ Technologies Company Ltd. www.anylogic.com
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.xj.anylogic.engine.presentation.Shape
UNKNOWN_NAME
 
Constructor Summary
ShapePixel()
          Constructs a pixel with default attributes.
ShapePixel(boolean ispublic, double x, double y, java.awt.Color color)
          Constructs a pixel with specific attributes.
 
Method Summary
 ShapePixel clone()
          Creates and returns a copy of this shape (i.e. new shape instance).
 boolean contains(double px, double py)
          Always returns false as pixel has no area and does not contain any point.
 void draw(Panel panel, java.awt.Graphics2D g, java.awt.geom.AffineTransform xform, boolean publicOnly)
          Draws the pixel in a given context
 java.awt.Color getColor()
          Returns the color of the pixel.
 boolean onClickAt(double px, double py, boolean publicOnly)
          Always returns false as pixel has no area and does not handle clicks.
 void setColor(java.awt.Color color)
          Sets the color of the pixel.
 
Methods inherited from class com.xj.anylogic.engine.presentation.Shape
canHandleClick, getGroup, getName, getPresentable, getRotation, getScaleX, getScaleY, getX, getY, isVisible, onClick, restoreOwner, setPos, setRotation, setScale, setScale, setScaleX, setScaleY, setVisible, setX, setY
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapePixel

public ShapePixel()
Constructs a pixel with default attributes.


ShapePixel

public ShapePixel(boolean ispublic,
                  double x,
                  double y,
                  java.awt.Color color)
Constructs a pixel with specific attributes.

Parameters:
ispublic - if true, the shape is visible on container's presentation
x - the x coordinate of the pixel
y - the y coordinate of the pixel
color - color of the pixel
Method Detail

setColor

public void setColor(java.awt.Color color)
Sets the color of the pixel.

Parameters:
color - the new color, null = do not draw the pixel

getColor

public java.awt.Color getColor()
Returns the color of the pixel.

Returns:
the color of the pixel

onClickAt

public boolean onClickAt(double px,
                         double py,
                         boolean publicOnly)
Always returns false as pixel has no area and does not handle clicks.

Overrides:
onClickAt in class Shape
Parameters:
px - the x coordinate of the click
py - the y coordinate of the click
publicOnly - if true, not public shape returns false
Returns:
false

contains

public boolean contains(double px,
                        double py)
Always returns false as pixel has no area and does not contain any point.

Specified by:
contains in class Shape
Parameters:
px - the x coordinate relative to this shape's container
py - the y coordinate relative to this shape's container
Returns:
true if the shape contains the point with the given coordinates

draw

public void draw(Panel panel,
                 java.awt.Graphics2D g,
                 java.awt.geom.AffineTransform xform,
                 boolean publicOnly)
Draws the pixel in a given context

Specified by:
draw in class Shape
Parameters:
g - the graphics where the drawing takes place
xform - the "original" transform that must be restored before drawing
publicOnly - if true, the shape is only drawn if it is public
panel - the panel where the drawing is done

clone

public final ShapePixel clone()
Description copied from class: Shape
Creates and returns a copy of this shape (i.e. new shape instance).
The returned shape is the object of the same class
The returned copy isn't automatically added to the group this shape belongs to.
The clone is created in the context of the same experiment or active object

Note that cloning of GIS shape, controls and charts is not supported

Overrides:
clone in class Shape


Copyright © 1991-2008 XJ Technlogies. All Rights Reserved.