Eclipse Community Forums Forum Search:

Home » Modeling » Graphiti » Creating three quarter circle on editor(Drawing special curved form on editor)
Creating three quarter circle on editor Wed, 13 February 2019 14:03 Stefan Mayer Messages: 1Registered: February 2019 Junior Member
Hello everyone,

I need to give the user the option du create a curvedConnection that looks like a three quarter circle.

We also did this for the quarter and semi circle without problems.
Here is what we did to draw the semi circle:

We use the method Graphiti.getPeCreateService().createCurvedConnection(double[] controllPoints, Diagram diagram).
To create the controllPoints we use a simple static method:

```	public static double[] getControlPointsForSemiCircle(double radius) {

double point1X = 0.0;
double point1Y = radius / 2;

double point2X = 0.25;
double point2Y = radius;

double point3X = 0.75;
double point3Y = radius;

double point4X = 1.0;
double point4Y = radius / 2;

double[] controlPoints = new double[] {point1X, point1Y, point2X, point2Y, point3X, point3Y, point4X, point4Y};
return controlPoints;
}
```

for this curve we create a solid polyline.
The result is as following I tried some approaches like setting two additional points for the three quarter circle that move the line backwards or the following idea with 4 controllpoints like it would be drawn in a normal coordinate system

```public static double[] getControlPointsForThreeQuarterCircle(double radius) {

double point1X = 0; // 0
double point1Y = 0; // 0

double point2X = (Math.sqrt(2) * radius) / 100; // 0.5
double point2Y = -Math.sqrt(2) * radius; // -50

double point3X = (Math.round(2 * Math.sqrt(2) * radius)) / 100; // 1.01
double point3Y = 0;

double point4X = (Math.sqrt(2) * radius) / 100; // 0.5
double point4Y = Math.sqrt(2) * radius; // 50

double[] controlPoints = new double[] {point1X, point1Y, point2X, point2Y, point3X, point3Y, point4X, point4Y};
return controlPoints;
}
```

What I want is something like that (Hard to draw it in paint but you know what I mean^^) what I get is always a scary form like that I think the editor has a hard time to draw in negative x direction. Is there any approach to resolve this issue and draw forms like a three quarter circle?

Thanks for your help. I hope this is the right forum for this topic. Sorry if not :)

greetings Stefan
 Previous Topic: Adding Combo On a Graphiti Container Next Topic: Graphiti Migration with GEF4
Goto Forum:

Current Time: Thu Sep 19 06:25:53 GMT 2019

Powered by FUDForum. Page generated in 0.01869 seconds
.:: Contact :: Home ::.