API java : RectangularShape


java.awt.geom
Class RectangularShape

java.lang.Object
  extended by java.awt.geom.RectangularShape
All Implemented Interfaces:
Shape, Cloneable
Direct Known Subclasses:
Arc2D, Ellipse2D, Rectangle2D, RoundRectangle2D

public abstract class RectangularShape
extends Object
implements Shape, Cloneable

RectangularShape is the base class for a number of Shape objects whose geometry is defined by a rectangular frame. This class does not directly specify any specific geometry by itself, but merely provides manipulation methods inherited by a whole category of Shape objects. The manipulation methods provided by this class can be used to query and modify the rectangular frame, which provides a reference for the subclasses to define their geometry.


Constructor Summary
protected RectangularShape()
          This is an abstract class that cannot be instantiated directly.
 
Method Summary
 Objectclone()
          Creates a new object of the same class and with the same contents as this object.
 booleancontains(Point2D p)
          Tests if a specified Point2D is inside the boundary of the Shape.
 booleancontains(Rectangle2D r)
          Tests if the interior of the Shape entirely contains the specified Rectangle2D.
 RectanglegetBounds()
          Returns the bounding box of the Shape.
 doublegetCenterX()
          Returns the X coordinate of the center of the framing rectangle of the Shape in double precision.
 doublegetCenterY()
          Returns the Y coordinate of the center of the framing rectangle of the Shape in double precision.
 Rectangle2DgetFrame()
          Returns the framing Rectangle2D that defines the overall shape of this object.
abstract  doublegetHeight()
          Returns the height of the framing rectangle in double precision.
 doublegetMaxX()
          Returns the largest X coordinate of the framing rectangle of the Shape in double precision.
 doublegetMaxY()
          Returns the largest Y coordinate of the framing rectangle of the Shape in double precision.
 doublegetMinX()
          Returns the smallest X coordinate of the framing rectangle of the Shape in double precision.
 doublegetMinY()
          Returns the smallest Y coordinate of the framing rectangle of the Shape in double precision.
 PathIteratorgetPathIterator(AffineTransform at, double flatness)
          Returns an iterator object that iterates along the Shape object's boundary and provides access to a flattened view of the outline of the Shape object's geometry.
abstract  doublegetWidth()
          Returns the width of the framing rectangle in double precision.
abstract  doublegetX()
          Returns the X coordinate of the upper left corner of the framing rectangle in double precision.
abstract  doublegetY()
          Returns the Y coordinate of the upper left corner of the framing rectangle in double precision.
 booleanintersects(Rectangle2D r)
          Tests if the interior of theShape intersects the interior of a specified Rectangle2D.
abstract  booleanisEmpty()
          Determines whether the RectangularShape is empty.
abstract  voidsetFrame(double x, double y, double w, double h)
          Sets the location and size of the framing rectangle of this Shape to the specified rectangular values.
 voidsetFrame(Point2D loc, Dimension2D size)
          Sets the location and size of the framing rectangle of this Shape to the specified Point2D and Dimension2D, respectively.
 voidsetFrame(Rectangle2D r)
          Sets the framing rectangle of this Shape to be the specified Rectangle2D.
 voidsetFrameFromCenter(double centerX, double centerY, double cornerX, double cornerY)
          Sets the framing rectangle of this Shape based on the specified center point coordinates and corner point coordinates.
 voidsetFrameFromCenter(Point2D center, Point2D corner)
          Sets the framing rectangle of this Shape based on a specified center Point2D and corner Point2D.
 voidsetFrameFromDiagonal(double x1, double y1, double x2, double y2)
          Sets the diagonal of the framing rectangle of this Shape based on the two specified coordinates.
 voidsetFrameFromDiagonal(Point2D p1, Point2D p2)
          Sets the diagonal of the framing rectangle of this Shape based on two specified Point2D objects.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.Shape
contains, contains, getBounds2D, getPathIterator, intersects
 

Constructor Detail

RectangularShape

protected RectangularShape()
This is an abstract class that cannot be instantiated directly.

See Also:
Arc2D, Ellipse2D, Rectangle2D, RoundRectangle2D
Method Detail

getX

public abstract double getX()
Returns the X coordinate of the upper left corner of the framing rectangle in double precision.

Returns:
the x coordinate of the upper left corner of the framing rectangle.

getY

public abstract double getY()
Returns the Y coordinate of the upper left corner of the framing rectangle in double precision.

Returns:
the y coordinate of the upper left corner of the framing rectangle.

getWidth

public abstract double getWidth()
Returns the width of the framing rectangle in double precision.

Returns:
the width of the framing rectangle.

getHeight

public abstract double getHeight()
Returns the height of the framing rectangle in double precision.

Returns:
the height of the framing rectangle.

getMinX

public double getMinX()
Returns the smallest X coordinate of the framing rectangle of the Shape in double precision.

Returns:
the smallest x coordinate of the framing rectangle of the Shape.

getMinY

public double getMinY()
Returns the smallest Y coordinate of the framing rectangle of the Shape in double precision.

Returns:
the smallest y coordinate of the framing rectangle of the Shape.

getMaxX

public double getMaxX()
Returns the largest X coordinate of the framing rectangle of the Shape in double precision.

Returns:
the largest x coordinate of the framing rectangle of the Shape.

getMaxY

public double getMaxY()
Returns the largest Y coordinate of the framing rectangle of the Shape in double precision.

Returns:
the largest y coordinate of the framing rectangle of the Shape.

getCenterX

public double getCenterX()
Returns the X coordinate of the center of the framing rectangle of the Shape in double precision.

Returns:
the x coordinate of the framing rectangle of the Shape object's center.

getCenterY

public double getCenterY()
Returns the Y coordinate of the center of the framing rectangle of the Shape in double precision.

Returns:
the y coordinate of the framing rectangle of the Shape object's center.

getFrame

public Rectangle2D getFrame()
Returns the framing Rectangle2D that defines the overall shape of this object.

Returns:
a Rectangle2D, specified in double coordinates.
See Also:
setFrame(double, double, double, double), setFrame(Point2D, Dimension2D), setFrame(Rectangle2D)

isEmpty

public abstract boolean isEmpty()
Determines whether the RectangularShape is empty. When the RectangularShape is empty, it encloses no area.

Returns:
true if the RectangularShape is empty; false otherwise.

setFrame

public abstract void setFrame(double x,
                              double y,
                              double w,
                              double h)
Sets the location and size of the framing rectangle of this Shape to the specified rectangular values. The framing rectangle is used by the subclasses of RectangularShape to define their geometry.

Parameters:
x, y - the coordinates of the upper-left corner of the specified rectangular shape
w - the width of the specified rectangular shape
h - the height of the specified rectangular shape
See Also:
getFrame()

setFrame

public void setFrame(Point2D loc,
                    
                    
                     Dimension2D size)
Sets the location and size of the framing rectangle of this Shape to the specified Point2D and Dimension2D, respectively. The framing rectangle is used by the subclasses of RectangularShape to define their geometry.

Parameters:
loc - the specified Point2D
size - the specified Dimension2D
See Also:
getFrame()

setFrame

public void setFrame(Rectangle2D r)
Sets the framing rectangle of this Shape to be the specified Rectangle2D. The framing rectangle is used by the subclasses of RectangularShape to define their geometry.

Parameters:
r - the specified Rectangle2D
See Also:
getFrame()

setFrameFromDiagonal

public void setFrameFromDiagonal(double x1,
                                 double y1,
                                 double x2,
                                 double y2)
Sets the diagonal of the framing rectangle of this Shape based on the two specified coordinates. The framing rectangle is used by the subclasses of RectangularShape to define their geometry.

Parameters:
x1, y1 - the first specified coordinates
x2, y2 - the second specified coordinates

setFrameFromDiagonal

public void setFrameFromDiagonal(Point2D p1,
                                
                                
                                 Point2D p2)
Sets the diagonal of the framing rectangle of this Shape based on two specified Point2D objects. The framing rectangle is used by the subclasses of RectangularShape to define their geometry.

Parameters:
p1, p2 - the two specified Point2D objects

setFrameFromCenter

public void setFrameFromCenter(double centerX,
                               double centerY,
                               double cornerX,
                               double cornerY)
Sets the framing rectangle of this Shape based on the specified center point coordinates and corner point coordinates. The framing rectangle is used by the subclasses of RectangularShape to define their geometry.

Parameters:
centerX, centerY - the center point coordinates
cornerX, cornerY - the corner point coordinates

setFrameFromCenter

public void setFrameFromCenter(Point2D center,
                              
                              
                               Point2D corner)
Sets the framing rectangle of this Shape based on a specified center Point2D and corner Point2D. The framing rectangle is used by the subclasses of RectangularShape to define their geometry.

Parameters:
center - the specified center Point2D
corner - the specified corner Point2D

contains

public boolean contains(Point2D p)
Tests if a specified Point2D is inside the boundary of the Shape.

Specified by:
contains in interface Shape
Parameters:
p - the specified Point2D
Returns:
true if the Point2D is inside the Shape object's boundary; false otherwise.

intersects

public boolean intersects(Rectangle2D r)
Tests if the interior of theShape intersects the interior of a specified Rectangle2D.

Specified by:
intersects in interface Shape
Parameters:
r - the specified Rectangle2D
Returns:
true if the Shape and the specified Rectangle2D intersect each other; false otherwise.
See Also:
Shape.intersects(double, double, double, double)

contains

public boolean contains(Rectangle2D r)
Tests if the interior of the Shape entirely contains the specified Rectangle2D.

Specified by:
contains in interface Shape
Parameters:
r - the specified Rectangle2D
Returns:
true if the Shape entirely contains the specified Rectangle2D; false otherwise.
See Also:
Shape.contains(double, double, double, double)

getBounds

public Rectangle getBounds()
Returns the bounding box of the Shape.

Specified by:
getBounds in interface Shape
Returns:
a Rectangle object that bounds the Shape.
See Also:
Shape.getBounds2D()

getPathIterator

public PathIterator getPathIterator(AffineTransform at,
                                    double flatness)
Returns an iterator object that iterates along the Shape object's boundary and provides access to a flattened view of the outline of the Shape object's geometry.

Only SEG_MOVETO, SEG_LINETO, and SEG_CLOSE point types will be returned by the iterator.

The amount of subdivision of the curved segments is controlled by the flatness parameter, which specifies the maximum distance that any point on the unflattened transformed curve can deviate from the returned flattened path segments. An optional AffineTransform can be specified so that the coordinates returned in the iteration are transformed accordingly.

Specified by:
getPathIterator in interface Shape
Parameters:
at - an optional AffineTransform to be applied to the coordinates as they are returned in the iteration, or null if untransformed coordinates are desired.
flatness - the maximum distance that the line segments used to approximate the curved segments are allowed to deviate from any point on the original curve
Returns:
a PathIterator object that provides access to the Shape object's flattened geometry.

clone

public Object clone()
Creates a new object of the same class and with the same contents as this object.

Overrides:
clone in class Object
Returns:
a clone of this instance.
Throws:
OutOfMemoryError - if there is not enough memory.
Since:
1.2
See Also:
Cloneable

Ces informations proviennent du site de http://java.sun.com

Remarques

Contenu

Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :

Quels sont les motivations de cette démarche?

Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.

Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.

Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.

Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.

Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

7 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-2044
Document créé le 31/08/06 02:54, dernière modification le Vendredi 17 Juin 2011, 12:12
Source du document imprimé : http://www.gaudry.be/java-api-rf-java/awt/geom/RectangularShape.html Document affiché 1 fois ce mois de Juin.
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Apparence (afficher)
Stats (afficher)
15832 documents
452 astuces.
549 niouzes.
3099 definitions.
447 membres.
8115 messages.

Document genere en :
0,60 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
La vérité est en nous, elle ne vient point du dehors.

Robert Browning [Extrait de Paracelse]
 
l'infobrol
Nous sommes le Vendredi 01 Juin 2012, 14:49, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)