Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "GEF/GEF4/Geometry"

< GEF‎ | GEF4
m
m
Line 47: Line 47:
 
The getCopy() method returns a newly constructed IGeometry of same type that is equal to the original IGeometry.
 
The getCopy() method returns a newly constructed IGeometry of same type that is equal to the original IGeometry.
  
=== ICurve ==
+
=== ICurve ===
  
 
[[Image:icurve-class-diagram.png|ICurve]]
 
[[Image:icurve-class-diagram.png|ICurve]]
Line 67: Line 67:
 
=== PolyBezier ===
 
=== PolyBezier ===
  
=== IShape ==
+
=== IShape ===
  
 
=== Rectangle ===
 
=== Rectangle ===
Line 79: Line 79:
 
=== Ellipse ===
 
=== Ellipse ===
  
=== Path ==
+
=== Path ===
  
 
== Conversions (From/To AWT/SWT/Geometry) ==
 
== Conversions (From/To AWT/SWT/Geometry) ==

Revision as of 08:52, 16 March 2012

Description

This is the documentation of the GEF4 Geometry API. You can find a small tutorial for the API here.

Geometric primitives

Point

Point

Dimension

Dimension

Angle

Angle

Geometrc figures

Interface hierarchy

This diagram depicts the interface hierarchy which underlies the individual geometry classes. In turn, the inheritance hierarchy classifies the figures by their construction type, so that many operations are generalized in a few abstract classes. Additionally, the different geometric figures provide extra functionality, for example, computing the area of a Polygon, or unifying two Rectangles.

IGeometry

IGeometry

The IGeometry interface defines the functionality that every geometric figure implements.

  • IGeometry.contains(Point) : boolean

The contains(Point) method tests if the given Point lies on/in the particular IGeometry.

  • IGeometry.getBounds() : Rectangle

The getBounds() method computes a bounding box for the particular IGeometry. The bounding box is the smallest Rectangle that contains this IGeometry.

  • IGeometry.touches(IGeometry) : boolean

The touches(IGeometry) method tests the given other IGeometry for at least one Point in common with this IGeometry. touches(IGeometry) works differently for ICurves and IShapes. For the latter ones, only the particular IShape's outline is regarded.

  • IGeometry.getTransformed(AffineTransform) : IGeometry

The getTransformed(AffineTransform) method applies an AffineTransform to this IGeometry and returns a new IGeometry that reflects the particular transformation. The resulting IGeometry is not necessarily of the same type as the original IGeometry, because some transformations - for example the rotation of an Ellipse - yield geometric figures that are not representable by the original IGeometry.

  • IGeometry.toPath() : Path

The toPath() method creates a Path representing this IGeometry. A Path implements Therefore, the Path is the general IGeometry that is used when you have to burst the boundaries of the other classes.

  • IGeometry.getCopy() : IGeometry

The getCopy() method returns a newly constructed IGeometry of same type that is equal to the original IGeometry.

ICurve

ICurve

Line

Line

QuadraticCurve

CubicCurve

BezierCurve

IPolyCurve

Polyline

PolyBezier

IShape

Rectangle

Rectangle

RoundedRectangle

Polygon

Ellipse

Path

Conversions (From/To AWT/SWT/Geometry)

From SWT to Geometry

Important. Very easy via the toSWT...() methods.

From AWT to Geometry

From Geometry to AWT

From AWT to SWT

From SWT to AWT

Affine transformations

Via projective geometry. All matrices can be combined before applying them to the particular shape.

Translation

Rotation

Scaling

Shearing

Euclidean geometry

Vector

Straight

Projective geometry

Vector3D

Straight3D

Back to the top