Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

GEF4 - Share and Enjoy!

909 views

Published on

Talk at EclipseCon Europe 2012, Ludwigsburg, Germany

Published in: Software
  • Be the first to comment

  • Be the first to like this

GEF4 - Share and Enjoy!

  1. 1. Share and Enjoy! Alexander Nyßen itemis AG 4
  2. 2. It‘s Bi!hday Time! [initial contribution of Draw2d/GEF (MVC) by IBM in 2002] [Zest joined 2007]
  3. 3. 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
  4. 4. SomeTopics 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...
  5. 5. 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.
  6. 6. 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.
  7. 7. GEF4 + Zest 2 = GEF4 Modified plan (prior to Juno): Unification of both approaches after Juno!
  8. 8. 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.
  9. 9. 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
  10. 10. 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)
  11. 11. 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)
  12. 12. GEF4 Planar Geometry - Overview
  13. 13. GEF4 Planar Geometry - Abstractions
  14. 14. GEF4 Planar Geometry - Base Classes
  15. 15. GEF4 Geometry - Examples
  16. 16. GEF4 Geometry - Sample Code // Bezier approximation of curves BezierCurve[] 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 interpolation PolyBezier interpolation = PolyBezier.interpolateCubic(p0, p1, p2, p3, ...); // support for affine transformations Polygon 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));
  17. 17. 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 byTom Schindl
  18. 18. GEF4 Graphics - Overview
  19. 19. GEF4 Graphics - Examples
  20. 20. 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());
  21. 21. 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
  22. 22. And on the very short term... • ... we are currently implementing Image#toString()...
  23. 23. ThankYou! Questions?

×