23
Share and Enjoy! Alexander Nyßen itemis AG 4

GEF4 - Share and Enjoy!

Embed Size (px)

Citation preview

Page 1: GEF4 - Share and Enjoy!

Share and Enjoy!

Alexander Nyßenitemis AG

4

Page 2: GEF4 - Share and Enjoy!

It‘s Bi!hday Time![initial contribution of Draw2d/GEF (MVC) by IBM in 2002]

[Zest joined 2007]

Page 3: GEF4 - Share and Enjoy!

GEF 3.x / Zest 1.x•Mature project with quite long history

• Base technology with lot's of users (direct & indirect through GMF/Graphiti)

• Stable API, no breaking API changes since 2004 (GEF 3.0)

•Ready for CBI (migration to Git, Maven/Tycho completed)

• But API is organically evolved and there are ~400 bugzillas, out of which several require to break it

Page 4: GEF4 - Share and Enjoy!

Some Topics for a Renewal• Re-thinking current componentization

• Support for the E4 application model

• Support for rotation and other transformations

• Support for curved connections

• Support for other rendering platforms than SWT

•Multi-touch gestures support

• Revision of the command framework

• Revision of connection handling (clipping container)

• Various renamings and restructurings on the detail level...

Page 5: GEF4 - Share and Enjoy!

Zest 2 (since 2010)• A provisional Zest 2 component was initiated in 2010, to

develop the next generation Zest API.

•Development takes place in parallel to maintenance of Zest 1.x in its own Git repository.

•API is regarded to be provisional up to the final graduation.

• Results are not provided as part of GEF 3.x / Zest 1.x but published via Eclipse Marketplace.

Page 6: GEF4 - Share and Enjoy!

GEF4 (since 2011)• GEF4 was initiated - in analogy to Zest 2 - to develop the next

generation Draw2d and GEF (MVC) API.

• Development is to take place in parallel to maintenance of Draw2d / GEF (MVC) 3.x in its own repository.

• Results are not provided as part of GEF 3.x / Zest 1.x but on own update-sites.

• Initial plans (prior to 3.8):

• Create new double-precision Geometry API before 3.8.

• Start to migrate the Draw2d and GEF (MVC) code base afterwards.

Page 7: GEF4 - Share and Enjoy!

GEF4 + Zest 2 = GEF4

Modified plan (prior to Juno): Unification of both approaches after Juno!

Page 8: GEF4 - Share and Enjoy!

GEF4 - A Unified Approach• A unified approach with a shared code base and a

common namespace (org.eclipse.gef4) for all plug-ins.

•Advantages:

• Clear distinction between GEF proper as the production component and GEF4 as the provisional one

• Chance to not only refactor GEF components but the componentization itself, which is only "historically" justified.

Page 9: GEF4 - Share and Enjoy!

GEF4 - Status Quo•GEF4 Geometry component was initiated in 2011, work

has been finalized with the Juno release:

• Functionally complete (at least for now)

• 344 JUnit tests, ~77% instruction coverage

•GEF4 Graphics component was initiated directly after Juno and is currently under work

• Initial infrastructure and simple example created

Page 10: GEF4 - Share and Enjoy!

GEF4 Geometry• No distinction in low and high precision, but just a single double-

precision API (with built-in imprecision for comparisons).

• Different geometric abstractions for different purposes:

• Euclidean (Vector, Straight, Angle)

• Projective (Vector3D, Straight3D)

• Planar (Point, Dimension, Line, QuadraticCurve, CubicCurve, BezierCurve, Polyline, PolyBezier, Ellipse, Rectangle, Pie, Arc, Polygon, CurvedPolygon, RoundedRectangle, Ring, Region, Path)

• Conversions to/from AWT and SWT (and between them)

Page 11: GEF4 - Share and Enjoy!

GEF4 Planar Geometry - Features• Support for "non-standard" geometries:

• Arbitrary Bezier curves, curved polygons

• Approximation via BezierCurves & Interpolation via PolyBeziers

• Characteristics-related core abstractions (IGeometry, ICurve, IShape, IMultiShape)

• Construction-related base-classes (AbstractRectangleBased-Geometry, AbstractPointListBasedGeometry,...)

• Direct support for affine transformations (ITranslatable, IScalable, IRotatable)

• No direct SWT dependencies (SWT-related conversions bundled in optional plug-in)

Page 12: GEF4 - Share and Enjoy!

GEF4 Planar Geometry - Overview

Page 13: GEF4 - Share and Enjoy!

GEF4 Planar Geometry - Abstractions

Page 14: GEF4 - Share and Enjoy!

GEF4 Planar Geometry - Base Classes

Page 15: GEF4 - Share and Enjoy!

GEF4 Geometry - Examples

Page 16: GEF4 - Share and Enjoy!

GEF4 Geometry - Sample Code

// Bezier approximation of curvesBezierCurve[] fromCurve = curve.toBezier();BezierCurve[] fromShape = shape.getOutline().toBezier();ICurve[] fromPolyShape = polyShape.getOutlineSegments();List<BezierCurve> beziers = new ArrayList<BezierCurve>();for (ICurve c : fromPolyShape) beziers.addAll(Arrays.asList(c.toBezier()));

// PolyBezier interpolationPolyBezier interpolation = PolyBezier.interpolateCubic(p0, p1, p2, p3, ...);

// support for affine transformationsPolygon rhomb = new Rectangle(10, 10, 10, 10).getRotatedCCW(Angle.fromDeg(45));PolyBezier slanted = new Ellipse(100, 100, 100, 50).getRotatedCCW(Angle.fromDeg(30));Ring rotatedClippingArea = region.getRotatedCCW(Angle.fromDeg(300));

Page 17: GEF4 - Share and Enjoy!

GEF4 Graphics - Features

• Support for rendering (planar) geometries, images, and text on an underlying Canvas/Graphics

•Key abstractions (Font, Image, Color) and transparent support for multiple widget toolkits (AWT, SWT)*

• Grouping of visual properties according to their respective usage context (BlitProperties, DrawProperties,..)

• Full push/pop/restore of graphics state

• Extensible image processing support (Pixel-Filter, Channel-Filter, Convolution-Filter)

*) JavaFX already prototyped by Tom Schindl

Page 18: GEF4 - Share and Enjoy!

GEF4 Graphics - Overview

Page 19: GEF4 - Share and Enjoy!

GEF4 Graphics - Examples

Page 20: GEF4 - Share and Enjoy!

GEF4 Graphics - Sample Code

final Ellipse ellipse = new Ellipse(50, 50, 350, 200);final Rectangle rectangle = new Rectangle(100, 160, 125, 220);final Polygon triangle = new Polygon(260, 170, 190, 300, 330, 300); g.drawProperties().setLineWidth(4).setAntialiasing(true);g.fillProperties().setAntialiasing(true); g.pushState(); // saves the current set of properties on the stack g.fillProperties().setColor(new Color(255, 0, 0));g.drawProperties().setDashArray(25, 10).setColor(new Color(128, 0, 0)); g.fill(ellipse);g.draw(ellipse.getOutline()); g.restoreState(); // restores the previously saved properties g.fillProperties().setColor(new Color(0, 0, 255));g.drawProperties().setLineJoin(LineJoin.ROUND)".setLineCap(LineCap.ROUND); g.fill(rectangle);g.draw(rectangle.getOutline()); g.popState(); // removes the previously saved properties from the stack" " " // and enables the prior set of properties g.fillProperties().setColor(new Color(0, 255, 0));g.drawProperties().setColor(new Color(0, 128, 0)).setLineJoin(LineJoin.MITER); g.fill(triangle);g.draw(triangle.getOutline());

Page 21: GEF4 - Share and Enjoy!

GEF4 - Outlook• Planned on the short term (Kepler):

• Creation of GEF4 Canvas component (FigureCanvas/Figures)

•Migration of Zest2 into GEF4 repository and update site (including adoption of namespace)

• Planned on the mid/long-term :

• Adoption of migrated Zest components to new GEF4 Geometry, Graphics, Canvas components

•Migration of remaining Draw2d/GEF (MVC) code base, including re-modularization and adoption

Page 22: GEF4 - Share and Enjoy!

And on the very short term...• ... we are currently implementing Image#toString()...

Page 23: GEF4 - Share and Enjoy!

Thank You! Questions?