Skip to content
Snippets Groups Projects
Commit 71f65789 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

rework of layout data utils

refs 214
parent a87ee6cc
No related branches found
No related tags found
No related merge requests found
Showing
with 143 additions and 107 deletions
...@@ -15,18 +15,19 @@ $Id$ ...@@ -15,18 +15,19 @@ $Id$
| See the License for the specific language governing permissions and | | See the License for the specific language governing permissions and |
| limitations under the License. | | limitations under the License. |
+--------------------------------------------------------------------------*/ +--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.layout.util; package org.fortiss.tooling.base.ui.utils;
import java.awt.Polygon; import java.awt.Polygon;
import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.draw2d.geometry.Rectangle;
import org.fortiss.tooling.base.layout.DefaultLayoutConstants;
import org.fortiss.tooling.base.model.layout.EOrientation; import org.fortiss.tooling.base.model.layout.EOrientation;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.model.layout.OffsetOrientation; import org.fortiss.tooling.base.model.layout.OffsetOrientation;
import org.fortiss.tooling.base.ui.dnd.DropContext; import org.fortiss.tooling.base.ui.dnd.DropContext;
import org.fortiss.tooling.base.ui.layout.constants.DefaultLayoutConstants; import org.fortiss.tooling.base.utils.LayoutModelElementFactory;
/** /**
* Utility class for rectangle-shaped edit part layout. * Utility class for rectangle-shaped edit part layout.
...@@ -85,8 +86,8 @@ public class RectangleLayoutUtils { ...@@ -85,8 +86,8 @@ public class RectangleLayoutUtils {
offset = (int) (source.y * (1 - (2 * inset) offset = (int) (source.y * (1 - (2 * inset)
/ (double) bounds.height)); / (double) bounds.height));
} }
return OffsetOrientationUtil.createOffsetOrientation(offset, return LayoutModelElementFactory.createOffsetOrientation(offset,
orientation); orientation, null);
} }
/** Ensure that the minimum size of a rectangular shape is redeemed. */ /** Ensure that the minimum size of a rectangular shape is redeemed. */
......
...@@ -15,12 +15,12 @@ $Id$ ...@@ -15,12 +15,12 @@ $Id$
| See the License for the specific language governing permissions and | | See the License for the specific language governing permissions and |
| limitations under the License. | | limitations under the License. |
+--------------------------------------------------------------------------*/ +--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.layout.util; package org.fortiss.tooling.base.ui.utils;
import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.GraphicalEditPart; import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.SnapToGrid; import org.eclipse.gef.SnapToGrid;
import org.fortiss.tooling.base.ui.layout.constants.DefaultLayoutConstants; import org.fortiss.tooling.base.layout.DefaultLayoutConstants;
/** /**
* Utility methods for snap-to-grid support. * Utility methods for snap-to-grid support.
...@@ -28,7 +28,7 @@ import org.fortiss.tooling.base.ui.layout.constants.DefaultLayoutConstants; ...@@ -28,7 +28,7 @@ import org.fortiss.tooling.base.ui.layout.constants.DefaultLayoutConstants;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating GREEN Hash: EEE21E715A74AC8326AF6F81DC92DCD4 * @ConQAT.Rating GREEN Hash: 355E22E06C416C645FD984BAF96E1D1D
*/ */
public final class SnapToGridUtils { public final class SnapToGridUtils {
......
...@@ -15,7 +15,7 @@ $Id$ ...@@ -15,7 +15,7 @@ $Id$
| See the License for the specific language governing permissions and | | See the License for the specific language governing permissions and |
| limitations under the License. | | limitations under the License. |
+--------------------------------------------------------------------------*/ +--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.layout.util; package org.fortiss.tooling.base.ui.utils;
import org.eclipse.gef.RootEditPart; import org.eclipse.gef.RootEditPart;
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
......
...@@ -11,6 +11,7 @@ Require-Bundle: org.fortiss.tooling.kernel;bundle-version="0.0.1";visibility:=re ...@@ -11,6 +11,7 @@ Require-Bundle: org.fortiss.tooling.kernel;bundle-version="0.0.1";visibility:=re
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Export-Package: org.fortiss.tooling.base, Export-Package: org.fortiss.tooling.base,
org.fortiss.tooling.base.decompose, org.fortiss.tooling.base.decompose,
org.fortiss.tooling.base.layout,
org.fortiss.tooling.base.model.base, org.fortiss.tooling.base.model.base,
org.fortiss.tooling.base.model.base.impl, org.fortiss.tooling.base.model.base.impl,
org.fortiss.tooling.base.model.base.util, org.fortiss.tooling.base.model.base.util,
...@@ -19,4 +20,5 @@ Export-Package: org.fortiss.tooling.base, ...@@ -19,4 +20,5 @@ Export-Package: org.fortiss.tooling.base,
org.fortiss.tooling.base.model.element.util, org.fortiss.tooling.base.model.element.util,
org.fortiss.tooling.base.model.layout, org.fortiss.tooling.base.model.layout,
org.fortiss.tooling.base.model.layout.impl, org.fortiss.tooling.base.model.layout.impl,
org.fortiss.tooling.base.model.layout.util org.fortiss.tooling.base.model.layout.util,
org.fortiss.tooling.base.utils
/*--------------------------------------------------------------------------+ /*--------------------------------------------------------------------------+
$Id$ $Id$
| | | |
| Copyright 2011 ForTISS GmbH | | Copyright 2011 ForTISS GmbH |
| | | |
| Licensed under the Apache License, Version 2.0 (the "License"); | | Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. | | you may not use this file except in compliance with the License. |
...@@ -15,31 +15,24 @@ $Id$ ...@@ -15,31 +15,24 @@ $Id$
| See the License for the specific language governing permissions and | | See the License for the specific language governing permissions and |
| limitations under the License. | | limitations under the License. |
+--------------------------------------------------------------------------*/ +--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.layout.constants; package org.fortiss.tooling.base.layout;
import org.conqat.ide.commons.ui.swt.FontUtils;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
/** /**
* Default layout constants for GEF-based editors. * Default constants for graphical layouts.
* *
* @author wandinger * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating GREEN Hash: 1ADDF13DA92039D5C42C0993B683A4F2 * @ConQAT.Rating YELLOW Hash: C73875A2DF5C4FA193DBD6AD12A220E4
*/ */
public final class DefaultLayoutConstants { public class DefaultLayoutConstants {
/** Title font. */
public static final Font TITLE_FONT = FontUtils.derive(
JFaceResources.getDefaultFont(), 0, SWT.BOLD);
// editor grid constants // editor grid constants
/** The default offset of the grid. */ /** The default origin x of the grid. */
public static final Point DEFAULT_GRID_ORIGIN = new Point(0, 0); public static final int DEFAULT_GRID_ORIGIN_X = 0;
/** The default origin y of the grid. */
public static final int DEFAULT_GRID_ORIGIN_Y = 0;
/** The default size between two lines of the grid. */ /** The default size between two lines of the grid. */
public static final int DEFAULT_GRID_SIZE = 12; public static final int DEFAULT_GRID_SIZE = 12;
...@@ -63,4 +56,5 @@ public final class DefaultLayoutConstants { ...@@ -63,4 +56,5 @@ public final class DefaultLayoutConstants {
/** The default position offset of a shape. */ /** The default position offset of a shape. */
public static final int DEFAULT_SHAPE_OFFSET = 2 * DEFAULT_GRID_SIZE; public static final int DEFAULT_SHAPE_OFFSET = 2 * DEFAULT_GRID_SIZE;
} }
...@@ -15,7 +15,7 @@ $Id$ ...@@ -15,7 +15,7 @@ $Id$
| See the License for the specific language governing permissions and | | See the License for the specific language governing permissions and |
| limitations under the License. | | limitations under the License. |
+--------------------------------------------------------------------------*/ +--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.layout.constants; package org.fortiss.tooling.base.layout;
/** /**
* Layout constants defining keys for the commonly used layout objects, like * Layout constants defining keys for the commonly used layout objects, like
......
...@@ -15,12 +15,11 @@ $Id$ ...@@ -15,12 +15,11 @@ $Id$
| See the License for the specific language governing permissions and | | See the License for the specific language governing permissions and |
| limitations under the License. | | limitations under the License. |
+--------------------------------------------------------------------------*/ +--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.layout.util; package org.fortiss.tooling.base.utils;
import org.fortiss.tooling.base.model.layout.Angle; import org.fortiss.tooling.base.model.layout.Angle;
import org.fortiss.tooling.base.model.layout.ILayoutData; import org.fortiss.tooling.base.model.layout.ILayoutData;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.model.layout.LayoutFactory;
/** /**
* Utility methods for {@link Angle} layout data. * Utility methods for {@link Angle} layout data.
...@@ -28,16 +27,9 @@ import org.fortiss.tooling.base.model.layout.LayoutFactory; ...@@ -28,16 +27,9 @@ import org.fortiss.tooling.base.model.layout.LayoutFactory;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating GREEN Hash: 2E92D07592321B47E50BE5DE3633D8E8 * @ConQAT.Rating YELLOW Hash: 5ED5978CC95E6A94BE5CBEF3E4FD3842
*/ */
/* package */final class AngleUtil { public final class AngleUtils {
/** Creates a new {@link Angle}. */
public static Angle createAngle(double angle) {
Angle a = LayoutFactory.eINSTANCE.createAngle();
a.setAngle(angle);
return a;
}
/** Returns an angle. */ /** Returns an angle. */
public static Angle getAngle(ILayoutedModelElement lobject, String key) { public static Angle getAngle(ILayoutedModelElement lobject, String key) {
...@@ -57,8 +49,7 @@ import org.fortiss.tooling.base.model.layout.LayoutFactory; ...@@ -57,8 +49,7 @@ import org.fortiss.tooling.base.model.layout.LayoutFactory;
lobject.getLayoutDataList().remove(old); lobject.getLayoutDataList().remove(old);
} }
Angle a = createAngle(angle); Angle a = LayoutModelElementFactory.createAngle(angle, key);
a.setKey(key);
lobject.getLayoutDataList().add(a); lobject.getLayoutDataList().add(a);
} }
} }
...@@ -15,12 +15,11 @@ $Id$ ...@@ -15,12 +15,11 @@ $Id$
| See the License for the specific language governing permissions and | | See the License for the specific language governing permissions and |
| limitations under the License. | | limitations under the License. |
+--------------------------------------------------------------------------*/ +--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.layout.util; package org.fortiss.tooling.base.utils;
import org.fortiss.tooling.base.model.layout.Dimension; import org.fortiss.tooling.base.model.layout.Dimension;
import org.fortiss.tooling.base.model.layout.ILayoutData; import org.fortiss.tooling.base.model.layout.ILayoutData;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.model.layout.LayoutFactory;
/** /**
* Utility class for {@link Dimension} layout data. * Utility class for {@link Dimension} layout data.
...@@ -28,17 +27,9 @@ import org.fortiss.tooling.base.model.layout.LayoutFactory; ...@@ -28,17 +27,9 @@ import org.fortiss.tooling.base.model.layout.LayoutFactory;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating GREEN Hash: D5C32EC0DD697B73E8BE1FE02816876F * @ConQAT.Rating YELLOW Hash: 3C92A9EB8051A4FA661C64CA936DA905
*/ */
/* package */final class DimensionUtil { public final class DimensionUtils {
/** Creates a new {@link Dimension}. */
public static Dimension createDimension(int w, int h) {
Dimension d = LayoutFactory.eINSTANCE.createDimension();
d.setWidth(w);
d.setHeight(h);
return d;
}
/** Returns a {@link Dimension} layout data object with the given key. */ /** Returns a {@link Dimension} layout data object with the given key. */
public static Dimension getDimension(ILayoutedModelElement lobject, public static Dimension getDimension(ILayoutedModelElement lobject,
...@@ -59,8 +50,7 @@ import org.fortiss.tooling.base.model.layout.LayoutFactory; ...@@ -59,8 +50,7 @@ import org.fortiss.tooling.base.model.layout.LayoutFactory;
lobject.getLayoutDataList().remove(old); lobject.getLayoutDataList().remove(old);
} }
Dimension d = createDimension(w, h); Dimension d = LayoutModelElementFactory.createDimension(w, h, key);
d.setKey(key);
lobject.getLayoutDataList().add(d); lobject.getLayoutDataList().add(d);
} }
} }
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.utils;
import org.fortiss.tooling.base.layout.LayoutKeyConstants;
import org.fortiss.tooling.base.model.layout.Angle;
import org.fortiss.tooling.base.model.layout.Dimension;
import org.fortiss.tooling.base.model.layout.EOrientation;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.model.layout.LayoutFactory;
import org.fortiss.tooling.base.model.layout.OffsetOrientation;
import org.fortiss.tooling.base.model.layout.Point;
import org.fortiss.tooling.base.model.layout.Points;
/**
* This class provides the creation methods for model elements.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: F89151582818B77DAA804D5042AF68F7
*/
public final class LayoutModelElementFactory {
/** Creates a new connection layout. */
public static void createConnectionLayout(ILayoutedModelElement lo) {
Points points = LayoutModelElementFactory
.createPoints(LayoutKeyConstants.CONNECTION_POINTS);
lo.getLayoutDataList().add(points);
}
/** Creates a new {@link Angle}. */
public static Angle createAngle(double angle, String key) {
Angle a = LayoutFactory.eINSTANCE.createAngle();
a.setAngle(angle);
a.setKey(key);
return a;
}
/** Creates a new {@link Dimension}. */
public static Dimension createDimension(int w, int h, String key) {
Dimension d = LayoutFactory.eINSTANCE.createDimension();
d.setWidth(w);
d.setHeight(h);
d.setKey(key);
return d;
}
/** Creates a new {@link Points} layout data. */
public static Points createPoints(String key) {
Points pts = LayoutFactory.eINSTANCE.createPoints();
pts.setKey(key);
return pts;
}
/** Creates a new {@link Point}. */
public static Point createPoint(int x, int y, String key) {
Point p = LayoutFactory.eINSTANCE.createPoint();
p.setX(x);
p.setY(y);
p.setKey(key);
return p;
}
/** Returns a new {@link OffsetOrientation} object with the given values. */
public static OffsetOrientation createOffsetOrientation(int offset,
EOrientation orientation, String key) {
OffsetOrientation oo = LayoutFactory.eINSTANCE
.createOffsetOrientation();
oo.setOrientation(orientation);
oo.setOffset(offset);
oo.setKey(key);
return oo;
}
}
...@@ -15,12 +15,11 @@ $Id$ ...@@ -15,12 +15,11 @@ $Id$
| See the License for the specific language governing permissions and | | See the License for the specific language governing permissions and |
| limitations under the License. | | limitations under the License. |
+--------------------------------------------------------------------------*/ +--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.layout.util; package org.fortiss.tooling.base.utils;
import org.fortiss.tooling.base.model.layout.EOrientation; import org.fortiss.tooling.base.model.layout.EOrientation;
import org.fortiss.tooling.base.model.layout.ILayoutData; import org.fortiss.tooling.base.model.layout.ILayoutData;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.model.layout.LayoutFactory;
import org.fortiss.tooling.base.model.layout.OffsetOrientation; import org.fortiss.tooling.base.model.layout.OffsetOrientation;
import org.fortiss.tooling.base.model.layout.Orientation; import org.fortiss.tooling.base.model.layout.Orientation;
...@@ -31,19 +30,9 @@ import org.fortiss.tooling.base.model.layout.Orientation; ...@@ -31,19 +30,9 @@ import org.fortiss.tooling.base.model.layout.Orientation;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating GREEN Hash: CB7A6378410128772C9D2687A4682FA4 * @ConQAT.Rating YELLOW Hash: 557B7E385BC75BF05E76F4B4D292C318
*/ */
/* package */final class OffsetOrientationUtil { public final class OffsetOrientationUtils {
/** Returns a new {@link OffsetOrientation} object with the given values. */
public static OffsetOrientation createOffsetOrientation(int offset,
EOrientation orientation) {
OffsetOrientation oo = LayoutFactory.eINSTANCE
.createOffsetOrientation();
oo.setOrientation(orientation);
oo.setOffset(offset);
return oo;
}
/** /**
* Returns a {@link OffsetOrientation} layout data object with the given * Returns a {@link OffsetOrientation} layout data object with the given
...@@ -67,8 +56,8 @@ import org.fortiss.tooling.base.model.layout.Orientation; ...@@ -67,8 +56,8 @@ import org.fortiss.tooling.base.model.layout.Orientation;
lobject.getLayoutDataList().remove(old); lobject.getLayoutDataList().remove(old);
} }
Orientation o = createOffsetOrientation(offset, orientation); Orientation o = LayoutModelElementFactory.createOffsetOrientation(
o.setKey(key); offset, orientation, key);
lobject.getLayoutDataList().add(o); lobject.getLayoutDataList().add(o);
} }
} }
...@@ -15,35 +15,24 @@ $Id$ ...@@ -15,35 +15,24 @@ $Id$
| See the License for the specific language governing permissions and | | See the License for the specific language governing permissions and |
| limitations under the License. | | limitations under the License. |
+--------------------------------------------------------------------------*/ +--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.layout.util; package org.fortiss.tooling.base.utils;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.ecore.util.EcoreUtil;
import org.fortiss.tooling.base.model.layout.ILayoutData; import org.fortiss.tooling.base.model.layout.ILayoutData;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.model.layout.LayoutFactory;
import org.fortiss.tooling.base.model.layout.Point; import org.fortiss.tooling.base.model.layout.Point;
/** /**
* TODO: What is the difference between {@link PointUtil} and {@link PointsUtil} * Utility class for handling {@link Point} layout data, i.e., position of nodes
* ? * in a graphical layout.
*
* Utility class for handling {@link Point} layout data.
* *
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: ECCAD8A00B043640F19A975F3B45B36B * @ConQAT.Rating YELLOW Hash: 5313D4F99884C64AAAB9009A59D9392F
*/ */
/* package */final class PointUtil { public final class PointUtils {
/** Creates a new {@link Point}. */
public static Point createPoint(int x, int y) {
Point p = LayoutFactory.eINSTANCE.createPoint();
p.setX(x);
p.setY(y);
return p;
}
/** Gets the position stored at the given key. */ /** Gets the position stored at the given key. */
public static Point getPosition(ILayoutedModelElement layouted, String key) { public static Point getPosition(ILayoutedModelElement layouted, String key) {
...@@ -55,8 +44,8 @@ import org.fortiss.tooling.base.model.layout.Point; ...@@ -55,8 +44,8 @@ import org.fortiss.tooling.base.model.layout.Point;
if (container != null) { if (container != null) {
index = 1 + container.eContents().indexOf(layouted); index = 1 + container.eContents().indexOf(layouted);
} }
Point p = createPoint(index * 20, index * 20); Point p = LayoutModelElementFactory.createPoint(index * 20,
p.setKey(key); index * 20, key);
return p; return p;
} }
return EcoreUtil.copy(point); return EcoreUtil.copy(point);
...@@ -80,8 +69,7 @@ import org.fortiss.tooling.base.model.layout.Point; ...@@ -80,8 +69,7 @@ import org.fortiss.tooling.base.model.layout.Point;
lobject.getLayoutDataList().remove(old); lobject.getLayoutDataList().remove(old);
} }
Point p = createPoint(x, y); Point p = LayoutModelElementFactory.createPoint(x, y, key);
p.setKey(key);
lobject.getLayoutDataList().add(p); lobject.getLayoutDataList().add(p);
} }
} }
...@@ -15,31 +15,23 @@ $Id$ ...@@ -15,31 +15,23 @@ $Id$
| See the License for the specific language governing permissions and | | See the License for the specific language governing permissions and |
| limitations under the License. | | limitations under the License. |
+--------------------------------------------------------------------------*/ +--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.layout.util; package org.fortiss.tooling.base.utils;
import org.fortiss.tooling.base.model.layout.ILayoutData; import org.fortiss.tooling.base.model.layout.ILayoutData;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.model.layout.LayoutFactory;
import org.fortiss.tooling.base.model.layout.Point; import org.fortiss.tooling.base.model.layout.Point;
import org.fortiss.tooling.base.model.layout.Points; import org.fortiss.tooling.base.model.layout.Points;
/** /**
* TODO: What is the difference between {@link PointUtil} and {@link PointsUtil} * Utility class for {@link Points} layout data, i.e., a series of points
* ? * usually encountered with layouts of connections.
*
* Utility class for {@link Points} layout data.
* *
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating GREEN Hash: 1BF8F215A3DAA9B28B98088EE369162A * @ConQAT.Rating YELLOW Hash: DC34D51E185873F7623A981356FCDBDD
*/ */
/* package */final class PointsUtil { public final class PointsUtils {
/** Creates a new {@link Points} layout data. */
public static Points createPoints() {
return LayoutFactory.eINSTANCE.createPoints();
}
/** Returns a {@link Points} layout data object with the given key. */ /** Returns a {@link Points} layout data object with the given key. */
public static Points getPoints(ILayoutedModelElement lobject, String key) { public static Points getPoints(ILayoutedModelElement lobject, String key) {
...@@ -59,10 +51,10 @@ import org.fortiss.tooling.base.model.layout.Points; ...@@ -59,10 +51,10 @@ import org.fortiss.tooling.base.model.layout.Points;
lobject.getLayoutDataList().remove(old); lobject.getLayoutDataList().remove(old);
} }
Points pts = createPoints(); Points pts = LayoutModelElementFactory.createPoints(key);
pts.setKey(key);
for (Point p : points.getPointsList()) { for (Point p : points.getPointsList()) {
Point np = PointUtil.createPoint(p.getX(), p.getY()); Point np = LayoutModelElementFactory.createPoint(p.getX(),
p.getY(), null);
pts.getPointsList().add(np); pts.getPointsList().add(np);
} }
lobject.getLayoutDataList().add(pts); lobject.getLayoutDataList().add(pts);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment