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 125: Line 125:
 
== Conversions ==
 
== Conversions ==
  
=== From SWT to Geometry ===
+
=== From Geometry to SWT ===
  
 
via the toSWT...() methods
 
via the toSWT...() methods
  
=== From AWT to Geometry ===
+
=== AWT2Geometry ===
  
=== From Geometry to AWT ===
+
=== Geometry2AWT ===
  
=== From AWT to SWT ===
+
=== SWT2AWT ===
 
+
=== From SWT to AWT ===
+
  
 
== Affine transformations ==
 
== Affine transformations ==

Revision as of 09:27, 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

QuadraticCurve

CubicCurve

CubicCurve

BezierCurve

BezierCurve

Arc

Arc

IPolyCurve

IPolyCurve

Polyline

Polyline

PolyBezier

PolyBezier

IShape

IShape

Rectangle

Rectangle

RoundedRectangle

RoundedRectangle

Polygon

Polygon

Ellipse

Ellipse

Pie

Pie

IPolyShape

IPolyShape

Region

Region

Ring

Ring

Path

Path

Conversions

From Geometry to SWT

via the toSWT...() methods

AWT2Geometry

Geometry2AWT

SWT2AWT

Affine transformations

Via projective geometry. All transformations are combined before applying them to the particular shape.

Translation

Rotation

Scaling

Shearing

Euclidean geometry

Vector

Vector

Straight

Straight

Projective geometry

Vector3D

Vector3D

Straight3D

Straight3D

Back to the top