本文整理匯總了Java中org.eclipse.draw2d.geometry.Point類的典型用法代碼示例。如果您正苦於以下問題:Java Point類的具體用法?Java Point怎麽用?Java Point使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Point類屬於org.eclipse.draw2d.geometry包,在下文中一共展示了Point類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAnchor
import org.eclipse.draw2d.geometry.Point; //導入依賴的package包/類
public Point getAnchor(Point curr, int level) {
int x = 0, y = 0;
switch (level) {
case 0:
return curr;
case 1:
Rectangle lArect = getParent().getConstraints();
x = curr.x - lArect.x;
y = curr.y - lArect.y;
return new Point(x, y);
case 2:
Rectangle lBpRect = getParent().getConstraints();
Rectangle lBgpRect = getParent().getParent().getConstraints();
x = curr.x - (lBpRect.x + lBgpRect.x);
y = curr.y - (lBpRect.y + lBgpRect.y);
return new Point(x, y);
case 3:
Rectangle lCpRect = getParent().getConstraints();
Rectangle lCgpRect = getParent().getParent().getConstraints();
Rectangle lCggpRect = getParent().getParent().getParent().getConstraints();
x = curr.x - (lCpRect.x + lCpRect.x + lCggpRect.x);
y = curr.y - (lCgpRect.y + lCgpRect.y + lCggpRect.y);
return new Point(x, y);
}
return curr;
}
示例2: getAbsolute
import org.eclipse.draw2d.geometry.Point; //導入依賴的package包/類
public Point getAbsolute(Point curr, int level) {
int x = 0, y = 0;
switch (level) {
case 0:
return new Point(x, y);
case 1:
Rectangle lArect = getParent().getConstraints();
x = curr.x + lArect.x;
y = curr.y + lArect.y;
return new Point(x, y);
case 2:
Rectangle lBpRect = getParent().getConstraints();
Rectangle lBgpRect = getParent().getParent().getConstraints();
x = curr.x + (lBpRect.x + lBgpRect.x);
y = curr.y + (lBpRect.y + lBgpRect.y);
return new Point(x, y);
case 3:
Rectangle lCpRect = getParent().getConstraints();
Rectangle lCgpRect = getParent().getParent().getConstraints();
Rectangle lCggpRect = getParent().getParent().getParent().getConstraints();
x = curr.x + (lCpRect.x + lCpRect.x + lCggpRect.x);
y = curr.y + (lCgpRect.y + lCgpRect.y + lCggpRect.y);
return new Point(x, y);
}
return curr;
}
示例3: getCreateCommand
import org.eclipse.draw2d.geometry.Point; //導入依賴的package包/類
@Override
protected Command getCreateCommand(CreateRequest request) {
Command ret = null;
if (request.getNewObjectType().equals(ModuleInstancePropertyNode.class) && getHost().getModel() instanceof ModuleInstanceNode) {
ModuleInstancePropertyCreateCommand cmd = new ModuleInstancePropertyCreateCommand();
Node node = (Node) request.getNewObject();
node.setParent((Node) getHost().getModel());
Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
Point viewSize = vp.getViewLocation();
Point p = request.getLocation();
p.setX(p.x + viewSize.x);
p.setY(p.y + viewSize.y);
p = node.getAnchor(p, 2);
cmd.setNode((ModuleInstancePropertyNode) node);
cmd.setParent((ModuleInstanceNode) node.getParent());
cmd.setLocation(new Rectangle(p.x, p.y, ModuleInstancePropertyNode.DEF_WIDTH, ModuleInstancePropertyNode.DEF_HEIGHT));
ret = cmd;
}
return ret;
}
示例4: getCreateCommand
import org.eclipse.draw2d.geometry.Point; //導入依賴的package包/類
@Override
protected Command getCreateCommand(CreateRequest request) {
Command ret = null;
if (request.getNewObjectType().equals(ModuleOperationParameterNode.class) && (getHost().getModel() instanceof ModuleOperationNode)) {
ModuleOperationNode par = (ModuleOperationNode) getHost().getModel();
if (!(par.getType().equalsIgnoreCase(Enums.ModuleOperationTypes.DATA_READ.name()) || par.getType().equalsIgnoreCase(Enums.ModuleOperationTypes.DATA_WRITE.name()))) {
ModuleOperationParameterCreateCommand cmd = new ModuleOperationParameterCreateCommand();
Node node = (Node) request.getNewObject();
node.setParent((Node) getHost().getModel());
Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
Point viewSize = vp.getViewLocation();
Point p = request.getLocation();
p.setX(p.x + viewSize.x);
p.setY(p.y + viewSize.y);
p = node.getAnchor(p, 2);
cmd.setNode((ModuleOperationParameterNode) node);
cmd.setParent((ModuleOperationNode) node.getParent());
cmd.setLocation(new Rectangle(p.x, p.y, ModuleOperationParameterNode.DEF_WIDTH, ModuleOperationParameterNode.DEF_HEIGHT));
ret = cmd;
}
}
return ret;
}
示例5: trackExecution
import org.eclipse.draw2d.geometry.Point; //導入依賴的package包/類
private void trackExecution(Graphics graphics) {
Rectangle rectangle = getBounds().getCopy();
if(componentStatus!=null){
if (componentStatus.equals(ComponentExecutionStatus.BLANK)){
compStatusImage = null;
}else if (componentStatus.equals(ComponentExecutionStatus.PENDING)){
compStatusImage =ImagePathConstant.COMPONENT_PENDING_ICON.getImageFromRegistry();
}else if (componentStatus.equals(ComponentExecutionStatus.RUNNING)){
compStatusImage =ImagePathConstant.COMPONENT_RUNNING_ICON.getImageFromRegistry();
}else if (componentStatus.equals(ComponentExecutionStatus.SUCCESSFUL)){
compStatusImage =ImagePathConstant.COMPONENT_SUCCESS_ICON.getImageFromRegistry();
}else if (componentStatus.equals(ComponentExecutionStatus.FAILED)){
compStatusImage = ImagePathConstant.COMPONENT_FAILED_ICON.getImageFromRegistry();
}
}
if (compStatusImage != null) {
graphics.drawImage(compStatusImage, new Point (8, rectangle.height - 22));
}
}
示例6: getCreateBendpointCommand
import org.eclipse.draw2d.geometry.Point; //導入依賴的package包/類
protected Command getCreateBendpointCommand(BendpointRequest request) {
CreateBendpointCommand com = new CreateBendpointCommand();
Point p = request.getLocation();
conn = getConnection();
conn.translateToRelative(p);
com.setLocation(p);
Point ref1 = conn.getSourceAnchor().getReferencePoint();
Point ref2 = conn.getTargetAnchor().getReferencePoint();
conn.translateToRelative(ref1);
conn.translateToRelative(ref2);
com.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2));
com.setConn((Connection) request.getSource().getModel());
com.setIndex(request.getIndex());
return com;
}
示例7: mouseHover
import org.eclipse.draw2d.geometry.Point; //導入依賴的package包/類
@Override
public void mouseHover(MouseEvent e) {
final java.awt.Point mouseLocation1 = MouseInfo.getPointerInfo().getLocation();
EditPart paletteInternalController = viewer.findObjectAt(new Point(
e.x, e.y));
if(paletteInternalController.getModel() instanceof CombinedTemplateCreationEntry){
setGenericComponent(paletteInternalController);
// Hide tooltip if already showing
hidePaletteToolTip();
showToolTipWithDelay(mouseLocation1);
}
}
示例8: getCreateCommand
import org.eclipse.draw2d.geometry.Point; //導入依賴的package包/類
@Override
protected Command getCreateCommand(CreateRequest request) {
Command ret = null;
if (request.getNewObjectType().equals(LogicalComputingPlatformNode.class) && (getHost().getModel() instanceof LogicalSystemNode)) {
LogicalComputingPlatformCreateCommand cmd = new LogicalComputingPlatformCreateCommand();
Node node = (Node) request.getNewObject();
node.setParent((Node) getHost().getModel());
Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
Point viewSize = vp.getViewLocation();
Point p = request.getLocation();
p.setX(p.x + viewSize.x);
p.setY(p.y + viewSize.y);
cmd.setNode((LogicalComputingPlatformNode) node);
cmd.setParent((LogicalSystemNode) node.getParent());
cmd.setLocation(new Rectangle(p.x, p.y, LogicalComputingPlatformNode.DEF_WIDTH, LogicalComputingPlatformNode.DEF_HEIGHT));
ret = cmd;
}
return ret;
}
示例9: getCreateCommand
import org.eclipse.draw2d.geometry.Point; //導入依賴的package包/類
@Override
protected Command getCreateCommand(CreateRequest request) {
Command ret = null;
if (request.getNewObjectType().equals(LogicalComputingNode.class) && (getHost().getModel() instanceof LogicalComputingPlatformNode)) {
LogicalComputingCreateCommand cmd = new LogicalComputingCreateCommand();
Node node = (Node) request.getNewObject();
node.setParent((Node) getHost().getModel());
Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
Point viewSize = vp.getViewLocation();
Point p = request.getLocation();
p.setX(p.x + viewSize.x);
p.setY(p.y + viewSize.y);
p = node.getAnchor(p, 1);
cmd.setNode((LogicalComputingNode) node);
cmd.setParent((LogicalComputingPlatformNode) node.getParent());
cmd.setLocation(new Rectangle(p.x, p.y, LogicalComputingNode.DEF_WIDTH, LogicalComputingNode.DEF_HEIGHT));
ret = cmd;
}
return ret;
}
示例10: paintFigure
import org.eclipse.draw2d.geometry.Point; //導入依賴的package包/類
@Override
protected void paintFigure(Graphics g) {
super.paintFigure(g);
final int LEG = 5;
Rectangle r = getBounds();
g.setLineWidth(1);
g.setForegroundColor(valid ? ColorConstants.black : PandionJConstants.Colors.ERROR);
g.drawLine(r.x, r.y, r.x, r.y+r.height-1);
g.drawLine(r.x, r.y, r.x+LEG, r.y);
g.drawLine(r.x, r.y+r.height-1, r.x+LEG, r.y+r.height-1);
g.drawLine(r.x+r.width-1, r.y, r.x+r.width-1, r.y+r.height);
g.drawLine(r.x+r.width-1, r.y, r.x+r.width-1-LEG, r.y);
g.drawLine(r.x+r.width-1, r.y+r.height-1, r.x+r.width-1-LEG, r.y+r.height-1);
if(!valid) {
g.setForegroundColor(PandionJConstants.Colors.ERROR);
String text = "Invalid matrix";
int textWidth = FigureUtilities.getTextWidth(text, g.getFont());
Point p = r.getLocation().translate(r.width/2 - textWidth/2, 5);
g.drawText(text, p);
}
}
示例11: getCreateCommand
import org.eclipse.draw2d.geometry.Point; //導入依賴的package包/類
@Override
protected Command getCreateCommand(CreateRequest request) {
Command ret = null;
if (request.getNewObjectType().equals(ComponentPropertyNode.class) && (getHost().getModel() instanceof ComponentNode)) {
ComponentPropertyNodeCreateCommand cmd = new ComponentPropertyNodeCreateCommand();
Node node = (Node) request.getNewObject();
node.setParent((Node) getHost().getModel());
Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
Point viewSize = vp.getViewLocation();
Point p = request.getLocation();
p.setX(p.x + viewSize.x);
p.setY(p.y + viewSize.y);
p = node.getAnchor(p, 1);
cmd.setNode((ComponentPropertyNode) node);
cmd.setParent((ComponentNode) node.getParent());
cmd.setLocation(new Rectangle(p.x, p.y, ComponentPropertyNode.DEF_WIDTH, ComponentPropertyNode.DEF_HEIGHT));
ret = cmd;
}
return ret;
}
示例12: getMoveBendpointCommand
import org.eclipse.draw2d.geometry.Point; //導入依賴的package包/類
protected Command getMoveBendpointCommand(BendpointRequest request) {
MoveBendpointCommand com = new MoveBendpointCommand();
Point p = request.getLocation();
conn = getConnection();
conn.translateToRelative(p);
com.setLocation(p);
Point ref1 = getConnection().getSourceAnchor().getReferencePoint();
Point ref2 = getConnection().getTargetAnchor().getReferencePoint();
conn.translateToRelative(ref1);
conn.translateToRelative(ref2);
com.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2));
com.setConn((Connection) request.getSource().getModel());
com.setIndex(request.getIndex());
return com;
}
示例13: getLocation
import org.eclipse.draw2d.geometry.Point; //導入依賴的package包/類
@Override
public Point getLocation(Point arg0) {
int xLocation =0, yLocation = 0;
if(PortAlignmentEnum.LEFT.value().equalsIgnoreCase(this.alignment)){
xLocation=getOwner().getBounds().getTopLeft().x-1;
yLocation=getOwner().getBounds().getTopLeft().y+4;
}else if(PortAlignmentEnum.RIGHT.value().equalsIgnoreCase(this.alignment)){
xLocation=getOwner().getBounds().getTopRight().x-1;
yLocation=getOwner().getBounds().getTopRight().y+4;
}else if(PortAlignmentEnum.BOTTOM.value().equalsIgnoreCase(this.alignment)){
xLocation=getOwner().getBounds().getBottomRight().x-20;
yLocation=getOwner().getBounds().getBottomRight().y-2;
}
Point point= new Point(xLocation, yLocation);
getOwner().getParent().translateToAbsolute(point);
return point;
}
示例14: refreshVisuals
import org.eclipse.draw2d.geometry.Point; //導入依賴的package包/類
@Override
protected void refreshVisuals() {
EdgeFigure figure = (EdgeFigure) getFigure();
GWEdge model = (GWEdge) getModel();
figure.setName(model.getName());
Connection connection = getConnectionFigure();
List<AbsoluteBendpoint> figureConstraint = new ArrayList<AbsoluteBendpoint>();
Iterator<Point> iter = ((GWLink) getModel()).getBendpointsIterator();
while(iter.hasNext()) {
Point p = iter.next();
figureConstraint.add(new AbsoluteBendpoint(p));
}
connection.setRoutingConstraint(figureConstraint);
figure.setTooltipText(this.getTooltipData());
figure.setBlockedOrGuarded(model.isBlocked(),model.getGuard().getSource());
figure.setActionScripted(model.getAction().getSource());
}
示例15: createFigure
import org.eclipse.draw2d.geometry.Point; //導入依賴的package包/類
@Override
protected IFigure createFigure() {
ComponentFigure componentFigure = ((ComponentEditPart) getParent()).getComponentFigure();
Component component = ((ComponentEditPart) getParent()).getCastedModel();
PortFigure port = null;
Color borderColor = CustomColorRegistry.INSTANCE.getColorFromRegistry( ELTColorConstants.DARK_GREY_RGB[0], ELTColorConstants.DARK_GREY_RGB[1], ELTColorConstants.DARK_GREY_RGB[2]);
Point portPoint = null;
int height = component.getSize().height-componentFigure.getComponentLabelMargin();
int width = component.getSize().width;
int margin = componentFigure.getComponentLabelMargin();
port = new PortFigure(borderColor, getCastedModel().getSequence(), getCastedModel().getNumberOfPortsOfThisType(),getCastedModel().getTerminal(),
getCastedModel().getLabelOfPort(), getCastedModel().getPortAlignment());
portPoint = getPortLocation(getCastedModel().getNumberOfPortsOfThisType(), getCastedModel().getPortType(),
getCastedModel().getSequence(), height, width, margin, getCastedModel().getPortAlignment());
Point tmpPoint = new Point(componentFigure.getLocation().x+portPoint.x , componentFigure.getLocation().y+portPoint.y);
port.setLocation(tmpPoint);
componentFigure.setAnchors(port.getAnchor());
return port;
}