org.eclipse.draw2d.geometry.PrecisionRectangle Java Examples

The following examples show how to use org.eclipse.draw2d.geometry.PrecisionRectangle. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ROIFigure.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public void setROIGeoBounds(int x, int y, int w, int h){
	if(w <=0)
		w=1;

	if(h <=0)
		h=1;
	
	roiGeoBounds.setBounds(x, y, w, h);	
	roiDataBounds = getROIFromGeoBounds(new PrecisionRectangle(roiGeoBounds.preciseX() + getBounds().x,
			roiGeoBounds.preciseY() + getBounds().y, roiGeoBounds.preciseWidth(), roiGeoBounds.preciseHeight()));
	if(roiDataBounds.width <1 || roiDataBounds.height <1 ){
		if(roiDataBounds.width <1)
			roiDataBounds.width =1;
		if(roiDataBounds.height <1)
			roiDataBounds.height =1;
		roiGeoBounds = getGeoBoundsFromROI(roiDataBounds);
	}
	updateChildrenBounds();
}
 
Example #2
Source File: CellDragoicator.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void relocate( IFigure target )
{
	IFigure reference = getReferenceFigure( );
	Rectangle targetBounds = new PrecisionRectangle( getReferenceBox( ).getResized( -1,
			-1 ) );
	reference.translateToAbsolute( targetBounds );
	target.translateToRelative( targetBounds );
	targetBounds.resize( 1, 1 );

	Dimension targetSize = getTargetSize( targetBounds.getSize( ) );

	targetBounds.x += (int) ( targetBounds.width * relativeX ) - 1;
	targetBounds.y += (int) ( targetBounds.height * relativeY );
	if (targetBounds.x < 0)
	{
		targetBounds.x = 0;
	}
	if (targetBounds.y < 0)
	{
		targetBounds.y = 0;
	}
	targetBounds.setSize( targetSize );
	target.setBounds( targetBounds );
}
 
Example #3
Source File: ReportFlowLayoutEditPolicy.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Generates a draw2d constraint object derived from the specified child
 * EditPart using the provided Request. The returned constraint will be
 * translated to the application's model later using
 * {@link #translateToModelConstraint(Object)}.
 * 
 * @param request
 *            the ChangeBoundsRequest
 * @param child
 *            the child EditPart for which the constraint should be
 *            generated
 * @return the draw2d constraint
 */
protected Object getConstraintFor( ChangeBoundsRequest request,
		GraphicalEditPart child )
{
	IFigure figure = child.getFigure( );
	Rectangle rect = new PrecisionRectangle(figure.getBounds());
	figure.translateToAbsolute(rect);
	rect = request.getTransformedRectangle( rect );
	
	figure.translateToRelative(rect);
	rect.translate( getLayoutOrigin( ).getNegated( ) );
	if (figure instanceof IOutsideBorder)
	{
		Border border = ((IOutsideBorder)figure).getOutsideBorder( );
		if (border !=  null)
		{
			Insets insets = border.getInsets( figure );
			rect.shrink( insets.right, insets.bottom );
		}
	}

	return getConstraintFor( rect );
}
 
Example #4
Source File: CursorLayer.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void layout(IFigure parent) {
	final TimeBaseConverter timeViewDetails = RootFigure.getTimeViewDetails(parent);

	for (final Object child : getChildren()) {
		final ICursor cursor = (ICursor) getConstraint((IFigure) child);
		final Dimension preferredSize = ((IFigure) child).getPreferredSize();

		final Timing screenCoordinates = timeViewDetails.toDetailCoordinates(cursor.getTiming());
		final Rectangle screenBounds = new PrecisionRectangle(screenCoordinates.getTimestamp(), 0, preferredSize.width(), getBounds().height());

		screenBounds.translate(-preferredSize.width() / 2, 0);

		((IFigure) child).setBounds(screenBounds);
	}
}
 
Example #5
Source File: LaneFigure.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void layout(IFigure parent) {
	final TimeBaseConverter timeViewDetails = RootFigure.getRootFigure(parent).getTimeViewDetails();

	for (final Object figure : getChildren()) {
		final ITimelineEvent event = (ITimelineEvent) getConstraint((IFigure) figure);

		final Timing screenCoordinates = timeViewDetails.toDetailCoordinates(event.getTiming());
		final Rectangle screenBounds = new PrecisionRectangle(screenCoordinates.getTimestamp(), getBounds().y(), screenCoordinates.getDuration(),
				getBounds().height());

		if (screenBounds.width() == 0)
			screenBounds.setWidth(1);

		((IFigure) figure).setBounds(screenBounds);
	}
}
 
Example #6
Source File: BonitaUnspecifiedTypeCreationTool.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected void snapPoint(CreateRequest request) {
	Dimension delta =getDragMoveDelta();
	Point moveDelta = new Point(delta.preciseWidth(),delta.preciseHeight());

	if (helper != null && sourceRectangle != null && compoundSrcRect != null) {
		PrecisionRectangle baseRect = sourceRectangle.getPreciseCopy();
		PrecisionRectangle jointRect = compoundSrcRect.getPreciseCopy();
		baseRect.translate(moveDelta);
		jointRect.translate(moveDelta);
		PrecisionPoint preciseDelta = new PrecisionPoint(moveDelta);
		helper.snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[] {
				baseRect, jointRect }, preciseDelta);

		request.setLocation(preciseDelta);
	}

}
 
Example #7
Source File: OverviewEventLayer.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Rectangle getConstraint(IFigure figure) {
	final TimeBaseConverter timeConverter = RootFigure.getTimeViewDetails(figure);

	final EventFigure eventFigure = (EventFigure) super.getConstraint(figure);
	final ITimed event = eventFigure.getEvent();

	final Timing screenCoordinates = timeConverter.toOverviewScreenCoordinates(event.getTiming());
	final Rectangle overviewEventArea = new PrecisionRectangle(screenCoordinates.left(),
			OverviewFigure.VERTICAL_INDENT + ((fEventHeight + OverviewFigure.Y_PADDING) * RootFigure.getLaneIndex(eventFigure)),
			screenCoordinates.getDuration(), fEventHeight);

	if (overviewEventArea.width() < MINIMUM_WIDTH)
		overviewEventArea.setWidth(MINIMUM_WIDTH);

	return overviewEventArea;
}
 
Example #8
Source File: DraggableElementCreationTool.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected void snapPoint(CreateRequest request) {
    if (helper != null && figure != null) {
        final PrecisionRectangle baseRect = sourceRectangle.getPreciseCopy();
        final PrecisionRectangle jointRect = compoundSrcRect.getPreciseCopy();
        Point location = getLocation().getTranslated(-figure.getSize().width / 2, -figure.getSize().height / 2);
        final PrecisionPoint preciseDelta = new PrecisionPoint(location.preciseX(), location.preciseY());
        baseRect.translate(preciseDelta);
        jointRect.translate(preciseDelta);
        helper.snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[] {
                baseRect, jointRect }, preciseDelta);
        request.setLocation(preciseDelta);
    }

}
 
Example #9
Source File: CustomRectilinearRouter.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Rectilinear polyline is invalid if:
 * 1. First bend point is within the source
 * 2. Last bend point is within the target
 * 3. First bend point and source anchor are on different sides of the source shape
 * 4. Last bend point and target anchor are on different sides of the target shape
 * 
 * @param conn connection
 * @param line rectilinear polyline
 * @return <code>true</code> if the line is valid
 */
private boolean isValidRectilinearLine(Connection conn, PointList line) {
    if (!(conn.getSourceAnchor().getOwner() instanceof Connection)) {
        Rectangle source = new PrecisionRectangle(
                getAnchorableFigureBounds(conn.getSourceAnchor().getOwner()));
        conn.getSourceAnchor().getOwner().translateToAbsolute(source);
        conn.translateToRelative(source);
        if (source.contains(line.getPoint(1))) {
            return false;
        }
        int firstSegmentOrientation = line.getFirstPoint().x == line.getPoint(1).x ? PositionConstants.VERTICAL
                : PositionConstants.HORIZONTAL;
        if (getOutisePointOffRectanglePosition(line.getPoint(1), source) != getAnchorLocationBasedOnSegmentOrientation(
                line.getFirstPoint(), source, firstSegmentOrientation)) {
            return false;
        }
    }
    if (!(conn.getTargetAnchor().getOwner() instanceof Connection)) {
        Rectangle target = new PrecisionRectangle(
                getAnchorableFigureBounds(conn.getTargetAnchor().getOwner()));
        conn.getTargetAnchor().getOwner().translateToAbsolute(target);
        conn.translateToRelative(target);
        if (target.contains(line.getPoint(line.size() - 2))) {
            return false;
        }
        int lastSegmentOrientation = line.getLastPoint().x == line.getPoint(line.size() - 2).x
                ? PositionConstants.VERTICAL : PositionConstants.HORIZONTAL;
        if (getOutisePointOffRectanglePosition(line.getPoint(line.size() - 2),
                target) != getAnchorLocationBasedOnSegmentOrientation(line.getLastPoint(), target,
                        lastSegmentOrientation)) {
            return false;
        }
    }
    return true;
}
 
Example #10
Source File: ERDiagramAlignmentAction.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the alignment rectangle to which all selected parts should be
 * aligned.
 * 
 * @param request
 *            the alignment Request
 * @return the alignment rectangle
 */
protected Rectangle calculateAlignmentRectangle(Request request) {
	List editparts = getOperationSet(request);
	if (editparts == null || editparts.isEmpty())
		return null;
	GraphicalEditPart part = (GraphicalEditPart) editparts.get(editparts
			.size() - 1);
	Rectangle rect = new PrecisionRectangle(part.getFigure().getBounds());
	part.getFigure().translateToAbsolute(rect);
	return rect;
}
 
Example #11
Source File: ROIFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private Rectangle getROIFromGeoBounds(PrecisionRectangle roiBounds){
	PrecisionPoint lt = ((GraphArea)getParent()).getDataLocation(roiBounds.preciseX(), roiBounds.preciseY());
	PrecisionPoint rb = ((GraphArea)getParent()).getDataLocation(roiBounds.preciseX() + roiBounds.preciseWidth(),
			roiBounds.preciseY() + roiBounds.preciseHeight());
	return new Rectangle((int)Math.round(lt.preciseX()) + intensityGraphFigure.getCropLeft(), 
			(int)Math.round(lt.preciseY()) +intensityGraphFigure.getCropTop(),
			(int)Math.ceil(rb.preciseX() - lt.preciseX()), (int)Math.ceil(rb.preciseY() - lt.preciseY()));
}
 
Example #12
Source File: EditorRulerFigure.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @return
 */
public Rectangle getScaleLeftSpace( )
{
	PrecisionRectangle rect = new PrecisionRectangle( getLeftSpace( ) );
	rect.performScale( zoomManager.getZoom( ) );
	return rect;
}
 
Example #13
Source File: EditorRulerComposite.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected org.eclipse.draw2d.geometry.Rectangle getScaleValue(
		org.eclipse.draw2d.geometry.Rectangle value )
{
	PrecisionRectangle dim = new PrecisionRectangle( value );
	dim.performScale( getZoom( ) );
	return dim;
}
 
Example #14
Source File: ERDiagramAlignmentAction.java    From erflute with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the alignment rectangle to which all selected parts should be aligned.
 * @param request the alignment Request
 * @return the alignment rectangle
 */
protected Rectangle calculateAlignmentRectangle(Request request) {
    final List<?> editparts = getOperationSet(request);
    if (editparts == null || editparts.isEmpty())
        return null;
    final GraphicalEditPart part = (GraphicalEditPart) editparts.get(editparts.size() - 1);
    final Rectangle rect = new PrecisionRectangle(part.getFigure().getBounds());
    part.getFigure().translateToAbsolute(rect);
    return rect;
}
 
Example #15
Source File: ResizeTracker.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Ensures size constraints (by default minimum and maximum) are respected
 * by the given request. May be overwritten by clients to enforce additional
 * constraints.
 * 
 * @param changeBoundsRequest
 *            The request to validate
 * @since 3.7
 */
protected void enforceConstraintsForResize(
		ChangeBoundsRequest changeBoundsRequest) {
	// adjust request, so that minimum and maximum size constraints are
	// respected
	if (owner != null) {
		PrecisionRectangle originalConstraint = new PrecisionRectangle(
				getOriginalBounds());
		owner.getFigure().translateToAbsolute(originalConstraint);
		PrecisionRectangle manipulatedConstraint = new PrecisionRectangle(
				changeBoundsRequest
						.getTransformedRectangle(originalConstraint));
		owner.getFigure().translateToRelative(manipulatedConstraint);
		// validate constraint (maximum and minimum size are regarded to be
		// 'normalized', i.e. relative to this figure's bounds coordinates).
		manipulatedConstraint.setSize(Dimension.max(
				manipulatedConstraint.getSize(),
				getMinimumSizeFor(changeBoundsRequest)));
		manipulatedConstraint.setSize(Dimension.min(
				manipulatedConstraint.getSize(),
				getMaximumSizeFor(changeBoundsRequest)));
		// translate back to absolute
		owner.getFigure().translateToAbsolute(manipulatedConstraint);
		Dimension newSizeDelta = manipulatedConstraint.getSize()
				.getShrinked(originalConstraint.getSize());
		changeBoundsRequest.setSizeDelta(newSizeDelta);
	}
}
 
Example #16
Source File: LiveFeedbackResizableEditPolicy.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected void enforceConstraintForMove(ChangeBoundsRequest request) {
	Rectangle relativeBounds = getOriginalBounds();
	PrecisionRectangle manipulatedConstraint = new PrecisionRectangle(
			 request.getTransformedRectangle(relativeBounds));
	getHostFigure().translateToRelative(manipulatedConstraint);
	
	manipulatedConstraint.setX(Math.max(0, manipulatedConstraint.x));
	manipulatedConstraint.setY(Math.max(0, manipulatedConstraint.y));
	
	getHostFigure().translateToAbsolute(manipulatedConstraint);
	
	Dimension difference = manipulatedConstraint.getLocation().getDifference(originalBounds.getLocation());
	request.setMoveDelta(new Point(difference.width, difference.height));
}
 
Example #17
Source File: EnlargeContainerEditPolicy.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings({ "unchecked" })
private PrecisionRectangle calculateFeedbackBounds(ChangeBoundsRequest request, Rectangle feedbackBounds,
		IFigure containerFigure) {
	PrecisionRectangle result = new PrecisionRectangle(feedbackBounds.getCopy());
	List<IGraphicalEditPart> editParts = request.getEditParts();
	for (IGraphicalEditPart editPart : editParts) {
		PrecisionRectangle transformedRect = new PrecisionRectangle(editPart.getFigure().getBounds().getCopy());
		editPart.getFigure().translateToAbsolute(transformedRect);
		result.union((Rectangle) transformedRect);
	}
	PrecisionDimension preferredSize = new PrecisionDimension(containerFigure.getPreferredSize().getCopy());
	containerFigure.translateToAbsolute(preferredSize);

	if (result.preciseWidth() < preferredSize.preciseWidth() + SPACEING) {
		result.setPreciseWidth(preferredSize.preciseWidth() + SPACEING);
	}
	if (result.preciseHeight() < preferredSize.preciseHeight() + SPACEING) {
		result.setPreciseHeight(preferredSize.preciseHeight() + SPACEING);
	}
	if (result.x < feedbackBounds.x) {
		result.x = feedbackBounds.x;
	}
	if (result.y < feedbackBounds.y) {
		result.y = feedbackBounds.y;
	}
	return result;
}
 
Example #18
Source File: RectangleController.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public RectangleController ( final SymbolController controller, final Rectangle element, final ResourceManager manager )
{
    super ( controller, manager );
    final PrecisionRectangle rect = new PrecisionRectangle ();
    if ( element.getSize () != null )
    {
        rect.setPreciseSize ( element.getSize ().getWidth (), element.getSize ().getHeight () );
    }
    this.figure = new RectangleFigureExtension ( this );
    this.figure.setBounds ( rect );

    controller.addElement ( element, this );

    applyCommon ( element );
}
 
Example #19
Source File: ROIFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private PrecisionRectangle getGeoBoundsFromROI(Rectangle roiDataBounds){
	PrecisionPoint lt = ((GraphArea)getParent()).getGeoLocation(roiDataBounds.preciseX()-intensityGraphFigure.getCropLeft(), 
			roiDataBounds.preciseY()-intensityGraphFigure.getCropTop());
	PrecisionPoint rb = ((GraphArea)getParent()).getGeoLocation(
			roiDataBounds.preciseX() + roiDataBounds.preciseWidth() -intensityGraphFigure.getCropLeft(), 
			roiDataBounds.preciseY() + roiDataBounds.preciseHeight() -intensityGraphFigure.getCropTop());
	return new PrecisionRectangle(lt.preciseX()-getBounds().x, lt.preciseY()-getBounds().y, rb.preciseX() - lt.preciseX(), rb.preciseY() - lt.preciseY());			
}
 
Example #20
Source File: OverviewSelectionLayer.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Object getConstraint(IFigure figure) {
	final TimeBaseConverter timeConverter = RootFigure.getTimeViewDetails(figure);

	final Timing coordinates = timeConverter.toOverviewScreenCoordinates(timeConverter.getVisibleEventArea());
	final Rectangle bounds = new PrecisionRectangle(coordinates.left(), 0, coordinates.getDuration(), getBounds().height());
	if (bounds.width() < MINIMUM_WIDTH)
		bounds.setWidth(MINIMUM_WIDTH);

	return bounds;
}
 
Example #21
Source File: EllipseController.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public EllipseController ( final SymbolController controller, final org.eclipse.scada.vi.model.Ellipse element, final ResourceManager manager )
{
    super ( controller, manager );
    final PrecisionRectangle rect = new PrecisionRectangle ();
    if ( element.getSize () != null )
    {
        rect.setPreciseSize ( element.getSize ().getWidth (), element.getSize ().getHeight () );
    }
    this.figure = new Ellipse () {
        @Override
        public void addNotify ()
        {
            super.addNotify ();
            start ();
        }

        @Override
        public void removeNotify ()
        {
            stop ();
            super.removeNotify ();
        }
    };
    this.figure.setBounds ( rect );

    controller.addElement ( element, this );

    applyCommon ( element );
}
 
Example #22
Source File: EnlargeContainerEditPolicy.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Return a copy of the bounds from the cache
 * 
 * @param figure
 * @return
 */
private Rectangle getOriginalBounds(IFigure figure) {
	Rectangle originalContainerBounds = boundsCache.get(figure);
	if (originalContainerBounds == null) {
		originalContainerBounds = figure.getBounds().getCopy();
		boundsCache.put(figure, new PrecisionRectangle(originalContainerBounds));
	}
	return boundsCache.get(figure).getCopy();
}
 
Example #23
Source File: FigureContainerController.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public FigureContainerController ( final SymbolController controller, final FigureContainer element, final ResourceManager manager, final BasicViewElementFactory viewElementFactory ) throws Exception
{
    super ( controller, manager );

    this.figure = new Figure () {
        @Override
        public void addNotify ()
        {
            super.addNotify ();
            start ();
        }

        @Override
        public void removeNotify ()
        {
            stop ();
            super.removeNotify ();
        }
    };

    if ( element.getSize () != null )
    {
        final PrecisionRectangle rect = new PrecisionRectangle ();
        rect.setPreciseSize ( element.getSize ().getWidth (), element.getSize ().getHeight () );
        this.figure.setBounds ( rect );
    }

    controller.addElement ( element, this );

    this.figure.setLayoutManager ( new StackLayout () );
    this.figure.add ( viewElementFactory.create ( controller, element.getContent () ).getFigure () );

    applyCommon ( element );
}
 
Example #24
Source File: ERDiagramAlignmentAction.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the alignment rectangle to which all selected parts should be
 * aligned.
 * 
 * @param request
 *            the alignment Request
 * @return the alignment rectangle
 */
protected Rectangle calculateAlignmentRectangle(final Request request) {
    final List editparts = getOperationSet(request);
    if (editparts == null || editparts.isEmpty())
        return null;
    final GraphicalEditPart part = (GraphicalEditPart) editparts.get(editparts.size() - 1);
    final Rectangle rect = new PrecisionRectangle(part.getFigure().getBounds());
    part.getFigure().translateToAbsolute(rect);
    return rect;
}
 
Example #25
Source File: EditorRulerComposite.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private void doLayout( )
{
	if ( left == null && top == null )
	{
		Rectangle area = getClientArea( );
		if ( !editor.getBounds( ).equals( area ) )
			editor.setBounds( area );
		return;
	}

	int leftWidth, rightWidth, topHeight, bottomHeight;
	leftWidth = left == null ? 0 : left.getControl( )
			.computeSize( SWT.DEFAULT, SWT.DEFAULT ).x;
	rightWidth = 0;
	topHeight = top == null ? 0 : top.getControl( )
			.computeSize( SWT.DEFAULT, SWT.DEFAULT ).y;
	bottomHeight = 0;

	Point size = getSize( );
	Point editorSize = new Point( size.x - ( leftWidth + rightWidth ),
			size.y - ( topHeight + bottomHeight ) );
	if ( !editor.getSize( ).equals( editorSize ) )
		editor.setSize( editorSize );
	Point editorLocation = new Point( leftWidth, topHeight );
	if ( !editor.getLocation( ).equals( editorLocation ) )
		editor.setLocation( editorLocation );

	PrecisionRectangle dim = new PrecisionRectangle( getLayoutSize( ) );
	dim.performScale( getZoom( ) );
	if ( left != null )
	{
		Rectangle leftBounds = new Rectangle( 0,
				topHeight - 1,
				leftWidth,
				dim.height + dim.y );
		if ( !left.getControl( ).getBounds( ).equals( leftBounds ) )
			left.getControl( ).setBounds( leftBounds );
	}
	if ( top != null )
	{
		Rectangle topBounds = new Rectangle( leftWidth - 1, 0, dim.width
				+ dim.x, topHeight );
		if ( !top.getControl( ).getBounds( ).equals( topBounds ) )
			top.getControl( ).setBounds( topBounds );
	}
}
 
Example #26
Source File: FigureController.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
public void setSize ( final double width, final double height )
{
    final Rectangle b = getPropertyFigure ().getBounds ();

    getPropertyFigure ().setBounds ( new PrecisionRectangle ( b.preciseX (), b.preciseY (), width, height ) );
}
 
Example #27
Source File: FigureController.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
public void setWidth ( final double width )
{
    final Rectangle b = getPropertyFigure ().getBounds ();

    getPropertyFigure ().setBounds ( new PrecisionRectangle ( b.preciseX (), b.preciseY (), width, b.preciseHeight () ) );
}
 
Example #28
Source File: FigureController.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
public void setHeight ( final double height )
{
    final Rectangle b = getPropertyFigure ().getBounds ();

    getPropertyFigure ().setBounds ( new PrecisionRectangle ( b.preciseX (), b.preciseY (), b.preciseWidth (), height ) );
}
 
Example #29
Source File: LaneFigure.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
private Rectangle getConstraintAsRectangle(IFigure figure) {
	final ITimelineEvent event = (ITimelineEvent) getConstraint(figure);

	return new PrecisionRectangle(event.getStartTimestamp(), 0, event.getDuration(), 1);
}
 
Example #30
Source File: LiveFeedbackResizableEditPolicy.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
protected void updateOriginalBounds() {
	originalBounds = new PrecisionRectangle(getHostFigure().getBounds().getCopy());
	getHostFigure().translateToAbsolute(originalBounds);
}