本文整理汇总了Java中org.eclipse.draw2d.Polyline.addPoint方法的典型用法代码示例。如果您正苦于以下问题:Java Polyline.addPoint方法的具体用法?Java Polyline.addPoint怎么用?Java Polyline.addPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.draw2d.Polyline
的用法示例。
在下文中一共展示了Polyline.addPoint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refreshVisuals
import org.eclipse.draw2d.Polyline; //导入方法依赖的package包/类
/**
* @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
*/
@Override
protected void refreshVisuals() {
try {
super.refreshVisuals();
NotationNode notationNode = (NotationNode) getModel();
Polyline line = (Polyline) this.getFigure();
line.removeAllPoints();
line.addPoint(new Point(notationNode.getX(), notationNode.getY()));
line.addPoint(new Point(notationNode.getX(), notationNode.getY() + notationNode.getHeight()));
Rectangle bounds = new Rectangle(notationNode.getX(),
notationNode.getY(),
notationNode.getWidth(),
notationNode.getHeight());
((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), bounds);
} catch (Exception e) {
Log.error(UMLMessage.MESSAGE_INTERACTION_USE_EDIT_PART_REFRESH_VISUALS_ERROR + e);
}
}
示例2: createFigure
import org.eclipse.draw2d.Polyline; //导入方法依赖的package包/类
/**
* Creates a filled circle containing an L like segment to simulate a clock.
*
* @see seg.jUCMNav.figures.PathNodeFigure#createFigure()
*/
protected void createFigure() {
ellipse = new Ellipse();
// we're making it larger than the empty point.
ellipse.setBounds(new Rectangle(preferredSize.width / 8, preferredSize.height / 8, DEFAULT_WIDTH * 3 / 4, DEFAULT_HEIGHT * 3 / 4));
ellipse.setAntialias(GeneralPreferencePage.getAntialiasingPref());
poly = new Polyline();
poly.addPoint(new Point(DEFAULT_WIDTH / 2, preferredSize.height / 8));
poly.addPoint(new Point(DEFAULT_WIDTH / 2, DEFAULT_HEIGHT / 2));
poly.addPoint(new Point(preferredSize.width * 7 / 8, DEFAULT_HEIGHT / 2));
poly.setAntialias(GeneralPreferencePage.getAntialiasingPref());
ellipse.add(poly);
ellipse.setLineWidth(2);
ellipse.setAntialias(GeneralPreferencePage.getAntialiasingPref());
poly.setLineWidth(2);
add(ellipse);
}
示例3: addVerticalSeparator
import org.eclipse.draw2d.Polyline; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void addVerticalSeparator(final IFigure figure, final Rectangle rect) {
final Polyline separator = new Polyline();
separator.setLineWidth(separatorWidth);
separator.addPoint(new Point(rect.x, rect.y));
separator.addPoint(new Point(rect.x, rect.y + rect.height));
figure.getChildren().add(separator);
separator.setParent(figure);
separators.add(separator);
}
示例4: addHorizontalSeparator
import org.eclipse.draw2d.Polyline; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void addHorizontalSeparator(final IFigure figure, final Rectangle rect) {
final Polyline separator = new Polyline();
separator.setLineWidth(separatorWidth);
separator.addPoint(new Point(rect.x, rect.y));
separator.addPoint(new Point(rect.x + rect.width, rect.y));
figure.getChildren().add(separator);
separator.setParent(figure);
separators.add(separator);
}
示例5: addVerticalSeparator
import org.eclipse.draw2d.Polyline; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void addVerticalSeparator(IFigure figure, Rectangle rect) {
Polyline separator = new Polyline();
separator.setLineWidth(separatorWidth);
separator.addPoint(new Point(rect.x, rect.y));
separator.addPoint(new Point(rect.x, rect.y + rect.height));
figure.getChildren().add(separator);
separator.setParent(figure);
this.separators.add(separator);
}
示例6: addHorizontalSeparator
import org.eclipse.draw2d.Polyline; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void addHorizontalSeparator(IFigure figure, Rectangle rect) {
Polyline separator = new Polyline();
separator.setLineWidth(separatorWidth);
separator.addPoint(new Point(rect.x, rect.y));
separator.addPoint(new Point(rect.x + rect.width, rect.y));
figure.getChildren().add(separator);
separator.setParent(figure);
this.separators.add(separator);
}
示例7: createFigure
import org.eclipse.draw2d.Polyline; //导入方法依赖的package包/类
/**
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
*/
@Override
protected IFigure createFigure() {
NotationNode notationNode = (NotationNode) getModel();
Polyline line = new Polyline();
line.setOpaque(false);
line.addPoint(new Point(notationNode.getX(), notationNode.getY()));
line.addPoint(new Point(notationNode.getX(), notationNode.getY() + 100));
line.setLineWidth(2);
line.setForegroundColor(UiCorePlugin.getDefault().getColor(IConstantColorRegistry.DimGray));
line.setLineStyle(Graphics.LINE_DASH);
return line;
}
示例8: addVerticalSeparator
import org.eclipse.draw2d.Polyline; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void addVerticalSeparator(IFigure figure, Rectangle rect) {
final Polyline separator = new Polyline();
separator.setLineWidth(separatorWidth);
separator.addPoint(new Point(rect.x, rect.y));
separator.addPoint(new Point(rect.x, rect.y + rect.height));
figure.getChildren().add(separator);
separator.setParent(figure);
separators.add(separator);
}
示例9: addHorizontalSeparator
import org.eclipse.draw2d.Polyline; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void addHorizontalSeparator(IFigure figure, Rectangle rect) {
final Polyline separator = new Polyline();
separator.setLineWidth(separatorWidth);
separator.addPoint(new Point(rect.x, rect.y));
separator.addPoint(new Point(rect.x + rect.width, rect.y));
figure.getChildren().add(separator);
separator.setParent(figure);
separators.add(separator);
}
示例10: createFigure
import org.eclipse.draw2d.Polyline; //导入方法依赖的package包/类
/**
* Is a Z like figure determined by the three static constants, WIDTH, HEIGHT and DELTA
*
*/
protected void createFigure() {
poly = new Polyline();
poly.setLineWidth(3);
poly.addPoint(getInitial());
poly.addPoint(new Point(-WIDTH / 2, HEIGHT / 2));
poly.addPoint(new Point(WIDTH / 2, -HEIGHT / 2));
poly.addPoint(new Point(WIDTH / 2, -DELTA));
poly.setAntialias(GeneralPreferencePage.getAntialiasingPref());
add(poly);
}
示例11: showMoveBendpointFeedback
import org.eclipse.draw2d.Polyline; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void showMoveBendpointFeedback(final BendpointRequest bendpointrequest) {
final Relation relation = (Relation) getHost().getModel();
final RelationEditPart editPart = (RelationEditPart) getHost();
if (relation.getSource() == relation.getTarget()) {
if (bendpointrequest.getIndex() != 1) {
return;
}
final Point point = bendpointrequest.getLocation();
getConnection().translateToRelative(point);
final Bendpoint rate = getRate(point);
rate.setRelative(true);
final float rateX = (100f - (rate.getX() / 2)) / 100;
final float rateY = (100f - (rate.getY() / 2)) / 100;
final ERTableEditPart tableEditPart = (ERTableEditPart) editPart.getSource();
final Rectangle bounds = tableEditPart.getFigure().getBounds();
final Rectangle rect = new Rectangle();
rect.x = (int) (bounds.x + (bounds.width * rateX));
rect.y = (int) (bounds.y + (bounds.height * rateY));
rect.width = bounds.width * rate.getX() / 100;
rect.height = bounds.height * rate.getY() / 100;
relation.setSourceLocationp(100, (int) (100 * rateY));
relation.setTargetLocationp((int) (100 * rateX), 100);
final LayerManager manager = (LayerManager) tableEditPart.getRoot();
final IFigure layer = manager.getLayer(LayerConstants.PRIMARY_LAYER);
getFeedbackLayer().setBounds(layer.getBounds());
final List children = getFeedbackLayer().getChildren();
children.clear();
getFeedbackLayer().repaint();
final ZoomManager zoomManager = ((ScalableFreeformRootEditPart) getHost().getRoot()).getZoomManager();
final double zoom = zoomManager.getZoom();
final Polyline feedbackFigure = new Polyline();
feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) (rect.y * zoom)));
feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) ((rect.y + rect.height) * zoom)));
feedbackFigure.addPoint(new Point((int) ((rect.x + rect.width) * zoom), (int) ((rect.y + rect.height) * zoom)));
feedbackFigure.addPoint(new Point((int) ((rect.x + rect.width) * zoom), (int) (rect.y * zoom)));
feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) (rect.y * zoom)));
feedbackFigure.setLineStyle(SWT.LINE_DASH);
feedbackFigure.translateToRelative(feedbackFigure.getLocation());
addFeedback(feedbackFigure);
} else {
super.showMoveBendpointFeedback(bendpointrequest);
}
}
示例12: showMoveBendpointFeedback
import org.eclipse.draw2d.Polyline; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void showMoveBendpointFeedback(BendpointRequest bendpointrequest) {
Relation relation = (Relation) getHost().getModel();
RelationEditPart editPart = (RelationEditPart) this.getHost();
Category currentCategory = getDiagram().getCurrentCategory();
if (relation.getSource() == relation.getTarget()) {
if (bendpointrequest.getIndex() != 1) {
return;
}
Point point = bendpointrequest.getLocation();
this.getConnection().translateToRelative(point);
Bendpoint rate = this.getRate(point);
rate.setRelative(true);
float rateX = (100f - (rate.getX() / 2)) / 100;
float rateY = (100f - (rate.getY() / 2)) / 100;
ERTableEditPart tableEditPart = (ERTableEditPart) editPart
.getSource();
Rectangle bounds = tableEditPart.getFigure().getBounds();
Rectangle rect = new Rectangle();
rect.x = (int) (bounds.x + (bounds.width * rateX));
rect.y = (int) (bounds.y + (bounds.height * rateY));
rect.width = (int) (bounds.width * rate.getX() / 100);
rect.height = (int) (bounds.height * rate.getY() / 100);
relation.setSourceLocationp(currentCategory, 100, (int) (100 * rateY));
relation.setTargetLocationp(currentCategory, (int) (100 * rateX), 100);
LayerManager manager = (LayerManager) tableEditPart.getRoot();
IFigure layer = manager.getLayer(LayerConstants.PRIMARY_LAYER);
this.getFeedbackLayer().setBounds(layer.getBounds());
List children = this.getFeedbackLayer().getChildren();
children.clear();
this.getFeedbackLayer().repaint();
ZoomManager zoomManager = ((ScalableFreeformRootEditPart) this
.getHost().getRoot()).getZoomManager();
double zoom = zoomManager.getZoom();
Polyline feedbackFigure = new Polyline();
feedbackFigure.addPoint(new Point((int) (rect.x * zoom),
(int) (rect.y * zoom)));
feedbackFigure.addPoint(new Point((int) (rect.x * zoom),
(int) ((rect.y + rect.height) * zoom)));
feedbackFigure.addPoint(new Point(
(int) ((rect.x + rect.width) * zoom),
(int) ((rect.y + rect.height) * zoom)));
feedbackFigure
.addPoint(new Point((int) ((rect.x + rect.width) * zoom),
(int) (rect.y * zoom)));
feedbackFigure.addPoint(new Point((int) (rect.x * zoom),
(int) (rect.y * zoom)));
feedbackFigure.setLineStyle(SWT.LINE_DASH);
feedbackFigure.translateToRelative(feedbackFigure.getLocation());
this.addFeedback(feedbackFigure);
} else {
super.showMoveBendpointFeedback(bendpointrequest);
}
}
示例13: showMoveBendpointFeedback
import org.eclipse.draw2d.Polyline; //导入方法依赖的package包/类
@Override
protected void showMoveBendpointFeedback(BendpointRequest bendpointrequest) {
final Relationship relation = (Relationship) getHost().getModel();
final RelationEditPart editPart = (RelationEditPart) getHost();
if (relation.getSourceWalker() == relation.getTargetWalker()) {
if (bendpointrequest.getIndex() != 1) {
return;
}
final Point point = bendpointrequest.getLocation();
getConnection().translateToRelative(point);
final Bendpoint rate = getRate(point);
rate.setRelative(true);
final float rateX = (100f - (rate.getX() / 2)) / 100;
final float rateY = (100f - (rate.getY() / 2)) / 100;
final ERTableEditPart tableEditPart = (ERTableEditPart) editPart.getSource();
final Rectangle bounds = tableEditPart.getFigure().getBounds();
final Rectangle rect = new Rectangle();
rect.x = (int) (bounds.x + (bounds.width * rateX));
rect.y = (int) (bounds.y + (bounds.height * rateY));
rect.width = (int) (bounds.width * rate.getX() / 100);
rect.height = (int) (bounds.height * rate.getY() / 100);
relation.setSourceLocationp(100, (int) (100 * rateY));
relation.setTargetLocationp((int) (100 * rateX), 100);
final LayerManager manager = (LayerManager) tableEditPart.getRoot();
final IFigure layer = manager.getLayer(LayerConstants.PRIMARY_LAYER);
getFeedbackLayer().setBounds(layer.getBounds());
final List<?> children = getFeedbackLayer().getChildren();
children.clear();
getFeedbackLayer().repaint();
final ZoomManager zoomManager = ((ScalableFreeformRootEditPart) getHost().getRoot()).getZoomManager();
final double zoom = zoomManager.getZoom();
final Polyline feedbackFigure = new Polyline();
feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) (rect.y * zoom)));
feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) ((rect.y + rect.height) * zoom)));
feedbackFigure.addPoint(new Point((int) ((rect.x + rect.width) * zoom), (int) ((rect.y + rect.height) * zoom)));
feedbackFigure.addPoint(new Point((int) ((rect.x + rect.width) * zoom), (int) (rect.y * zoom)));
feedbackFigure.addPoint(new Point((int) (rect.x * zoom), (int) (rect.y * zoom)));
feedbackFigure.setLineStyle(SWT.LINE_DASH);
feedbackFigure.translateToRelative(feedbackFigure.getLocation());
addFeedback(feedbackFigure);
} else {
super.showMoveBendpointFeedback(bendpointrequest);
}
}
示例14: getTemporalBoundFigure
import org.eclipse.draw2d.Polyline; //导入方法依赖的package包/类
private Polyline getTemporalBoundFigure(Timepoint timepoint, Rectangle bounds) {
Date boundDate = getTimepointBound(timepoint);
if (boundDate == null) {
// no constraint on this side, no figure needed
return null;
}
// time -> px conversion
int x = getViewer().getPage().getScreenPosition(boundDate);
// local to global coordinate transform
x += getHostFigure().getParent().getBounds().x;
Polyline figure = new Polyline() {
@Override
public void paintFigure(Graphics graphics) {
graphics.setLineWidth(2);
super.paintFigure(graphics);
graphics.fillPolygon(this.getPoints());
}
};
switch(timepoint) {
case START:
figure.setForegroundColor(ColorConstants.red);
figure.setBackgroundColor(ColorConstants.red);
break;
case END:
figure.setForegroundColor(ColorConstants.green);
figure.setBackgroundColor(ColorConstants.green);
break;
}
int y = bounds.y + 1;
int w = bounds.height/4;
int h = bounds.height - 2;
figure.addPoint(new Point(x, y));
figure.addPoint(new Point(x, y + h/4));
switch(timepoint) {
case START: figure.addPoint(new Point(x - w, y + h/2)); break;
case END: figure.addPoint(new Point(x + w, y + h/2)); break;
}
figure.addPoint(new Point(x, y + 3*h/4));
figure.addPoint(new Point(x, y + h));
figure.addPoint(new Point(x, y));
IFigure parentFigure = ((AbstractGraphicalEditPart)getHost().getParent()).getFigure();
if (parentFigure.getBounds().contains(figure.getBounds())) {
addFeedback(figure);
} else {
figure = null;
}
return figure;
}
示例15: showMoveBendpointFeedback
import org.eclipse.draw2d.Polyline; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void showMoveBendpointFeedback(BendpointRequest bendpointrequest) {
Relation relation = (Relation) getHost().getModel();
RelationEditPart editPart = (RelationEditPart) this.getHost();
if (relation.getSource() == relation.getTarget()) {
if (bendpointrequest.getIndex() != 1) {
return;
}
Point point = bendpointrequest.getLocation();
this.getConnection().translateToRelative(point);
Bendpoint rate = this.getRate(point);
rate.setRelative(true);
float rateX = (100f - (rate.getX() / 2)) / 100;
float rateY = (100f - (rate.getY() / 2)) / 100;
ERTableEditPart tableEditPart = (ERTableEditPart) editPart
.getSource();
Rectangle bounds = tableEditPart.getFigure().getBounds();
Rectangle rect = new Rectangle();
rect.x = (int) (bounds.x + (bounds.width * rateX));
rect.y = (int) (bounds.y + (bounds.height * rateY));
rect.width = (int) (bounds.width * rate.getX() / 100);
rect.height = (int) (bounds.height * rate.getY() / 100);
relation.setSourceLocationp(100, (int) (100 * rateY));
relation.setTargetLocationp((int) (100 * rateX), 100);
LayerManager manager = (LayerManager) tableEditPart.getRoot();
IFigure layer = manager.getLayer(LayerConstants.PRIMARY_LAYER);
this.getFeedbackLayer().setBounds(layer.getBounds());
List children = this.getFeedbackLayer().getChildren();
children.clear();
this.getFeedbackLayer().repaint();
ZoomManager zoomManager = ((ScalableFreeformRootEditPart) this
.getHost().getRoot()).getZoomManager();
double zoom = zoomManager.getZoom();
Polyline feedbackFigure = new Polyline();
feedbackFigure.addPoint(new Point((int) (rect.x * zoom),
(int) (rect.y * zoom)));
feedbackFigure.addPoint(new Point((int) (rect.x * zoom),
(int) ((rect.y + rect.height) * zoom)));
feedbackFigure.addPoint(new Point(
(int) ((rect.x + rect.width) * zoom),
(int) ((rect.y + rect.height) * zoom)));
feedbackFigure
.addPoint(new Point((int) ((rect.x + rect.width) * zoom),
(int) (rect.y * zoom)));
feedbackFigure.addPoint(new Point((int) (rect.x * zoom),
(int) (rect.y * zoom)));
feedbackFigure.setLineStyle(SWT.LINE_DASH);
feedbackFigure.translateToRelative(feedbackFigure.getLocation());
this.addFeedback(feedbackFigure);
} else {
super.showMoveBendpointFeedback(bendpointrequest);
}
}