当前位置: 首页>>代码示例>>Java>>正文


Java Polyline.translateToRelative方法代码示例

本文整理汇总了Java中org.eclipse.draw2d.Polyline.translateToRelative方法的典型用法代码示例。如果您正苦于以下问题:Java Polyline.translateToRelative方法的具体用法?Java Polyline.translateToRelative怎么用?Java Polyline.translateToRelative使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.draw2d.Polyline的用法示例。


在下文中一共展示了Polyline.translateToRelative方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setTargetFeedbackPoints

import org.eclipse.draw2d.Polyline; //导入方法依赖的package包/类
protected void setTargetFeedbackPoints( Point p1, Point p2 )
{
	Transposer transposer = new Transposer( );
	transposer.setEnabled( !isHorizontal( ) );

	Rectangle parentBox = transposer.t( getAbsoluteClientBounds( (GraphicalEditPart) getHost( ) ) );
	Polyline fb = getLineFeedback( );
	if ( p2.y >= parentBox.bottom( ) && parentBox.bottom( ) - p1.y < 10 )
	{
		p2.y = p1.y;

		List list = ( (GraphicalEditPart) getHost( ) ).getChildren( );
		int size = list.size( );
		if ( size == 0 )
		{
			p2.x = p1.x + Math.min( 30, parentBox.width );
		}
		else
		{
			GraphicalEditPart last = (GraphicalEditPart) list.get( size - 1 );
			Rectangle rect = getAbsoluteBounds( last );
			p2.x = p1.x + Math.min( rect.width - 8, parentBox.width );
		}
	}
	else if ( p2.y >= parentBox.bottom( ) )
	{
		p2.y = parentBox.bottom( );
	}
	fb.translateToRelative( p1 );

	fb.translateToRelative( p2 );

	fb.setPoint( p1, 0 );
	fb.setPoint( p2, 1 );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:36,代码来源:ReportFlowLayoutEditPolicy.java

示例2: 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);
    }

}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:63,代码来源:RelationBendpointEditPolicy.java

示例3: 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);
	}

}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:74,代码来源:RelationBendpointEditPolicy.java

示例4: 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);
    }
}
 
开发者ID:dbflute-session,项目名称:erflute,代码行数:59,代码来源:RelationBendpointEditPolicy.java

示例5: 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);
	}

}
 
开发者ID:justinkwony,项目名称:ermaster-nhit,代码行数:72,代码来源:RelationBendpointEditPolicy.java


注:本文中的org.eclipse.draw2d.Polyline.translateToRelative方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。