src/main/java/com/mxgraph/shape/mxStencilShape.java
protected void transformShape(Shape shape, double transX, double transY,
			double widthRatio, double heightRatio)
	{
		if (shape instanceof Rectangle2D)
		{
			Rectangle2D rect = (Rectangle2D) shape;
			if (transX != 0 || transY != 0)
			{
				rect.setFrame(rect.getX() + transX, rect.getY() + transY,
						rect.getWidth(), rect.getHeight());
			}

			if (widthRatio != 1 || heightRatio != 1)
			{
				rect.setFrame(rect.getX() * widthRatio, rect.getY()
						* heightRatio, rect.getWidth() * widthRatio,
						rect.getHeight() * heightRatio);
			}
		}
		else if (shape instanceof Line2D)
		{
			Line2D line = (Line2D) shape;
			if (transX != 0 || transY != 0)
			{
				line.setLine(line.getX1() + transX, line.getY1() + transY,
						line.getX2() + transX, line.getY2() + transY);
			}
			if (widthRatio != 1 || heightRatio != 1)
			{
				line.setLine(line.getX1() * widthRatio, line.getY1()
						* heightRatio, line.getX2() * widthRatio, line.getY2()
						* heightRatio);
			}
		}
		else if (shape instanceof GeneralPath)
		{
			GeneralPath path = (GeneralPath) shape;
			cachedTransform.setToScale(widthRatio, heightRatio);
			cachedTransform.translate(transX, transY);
			path.transform(cachedTransform);
		}
		else if (shape instanceof ExtendedGeneralPath)
		{
			ExtendedGeneralPath path = (ExtendedGeneralPath) shape;
			cachedTransform.setToScale(widthRatio, heightRatio);
			cachedTransform.translate(transX, transY);
			path.transform(cachedTransform);
		}
		else if (shape instanceof Ellipse2D)
		{
			Ellipse2D ellipse = (Ellipse2D) shape;
			if (transX != 0 || transY != 0)
			{
				ellipse.setFrame(ellipse.getX() + transX, ellipse.getY()
						+ transY, ellipse.getWidth(), ellipse.getHeight());
			}
			if (widthRatio != 1 || heightRatio != 1)
			{
				ellipse.setFrame(ellipse.getX() * widthRatio, ellipse.getY()
						* heightRatio, ellipse.getWidth() * widthRatio,
						ellipse.getHeight() * heightRatio);
			}
		}
	}
/**
	 * Scales the points composing this shape by the x and y ratios specified
	 * 
	 * @param shape
	 *            the shape to scale
	 * @param transX
	 *            the x translation
	 * @param transY
	 *            the y translation
	 * @param widthRatio
	 *            the x co-ordinate scale
	 * @param heightRatio
	 *            the y co-ordinate scale
	 */
Scales the points composing this shape by the x and y ratios specified


Scales the points composing this shape by the x and y ratios specified
protected void transformShape(Shape shape, double transX, double transY,
			double widthRatio, double heightRatio)
	{
		if (shape instanceof Rectangle2D)
		{
			Rectangle2D rect = (Rectangle2D) shape;
			if (transX != 0 || transY != 0)
			{
				rect.setFrame(rect.getX() + transX, rect.getY() + transY,
						rect.getWidth(), rect.getHeight());
			}
			if (widthRatio != 1 || heightRatio != 1)
			{
				rect.setFrame(rect.getX() * widthRatio, rect.getY()
						* heightRatio, rect.getWidth() * widthRatio,
						rect.getHeight() * heightRatio);
			}
		}
		else if (shape instanceof Line2D)
		{
			Line2D line = (Line2D) shape;
			if (transX != 0 || transY != 0)
			{
				line.setLine(line.getX1() + transX, line.getY1() + transY,
						line.getX2() + transX, line.getY2() + transY);
			}
			if (widthRatio != 1 || heightRatio != 1)
			{
				line.setLine(line.getX1() * widthRatio, line.getY1()
						* heightRatio, line.getX2() * widthRatio, line.getY2()
						* heightRatio);
			}
		}
		else if (shape instanceof GeneralPath)
		{
			GeneralPath path = (GeneralPath) shape;
			cachedTransform.setToScale(widthRatio, heightRatio);
			cachedTransform.translate(transX, transY);
			path.transform(cachedTransform);
		}
		else if (shape instanceof ExtendedGeneralPath)
		{
			ExtendedGeneralPath path = (ExtendedGeneralPath) shape;
			cachedTransform.setToScale(widthRatio, heightRatio);
			cachedTransform.translate(transX, transY);
			path.transform(cachedTransform);
		}
		else if (shape instanceof Ellipse2D)
		{
			Ellipse2D ellipse = (Ellipse2D) shape;
			if (transX != 0 || transY != 0)
			{
				ellipse.setFrame(ellipse.getX() + transX, ellipse.getY()
						+ transY, ellipse.getWidth(), ellipse.getHeight());
			}
			if (widthRatio != 1 || heightRatio != 1)
			{
				ellipse.setFrame(ellipse.getX() * widthRatio, ellipse.getY()
						* heightRatio, ellipse.getWidth() * widthRatio,
						ellipse.getHeight() * heightRatio);
			}
		}
	}
protected void transformShape ( Shape shape , double transX , double transY , double widthRatio , double heightRatio ) { if ( shape instanceof Rectangle2D ) { Rectangle2D rect = ( Rectangle2D ) shape ; if ( transX != 0 || transY != 0 ) { rect . setFrame ( rect . getX ( ) + transX , rect . getY ( ) + transY , rect . getWidth ( ) , rect . getHeight ( ) ) ; } if ( widthRatio != 1 || heightRatio != 1 ) { rect . setFrame ( rect . getX ( ) * widthRatio , rect . getY ( ) * heightRatio , rect . getWidth ( ) * widthRatio , rect . getHeight ( ) * heightRatio ) ; } } else if ( shape instanceof Line2D ) { Line2D line = ( Line2D ) shape ; if ( transX != 0 || transY != 0 ) { line . setLine ( line . getX1 ( ) + transX , line . getY1 ( ) + transY , line . getX2 ( ) + transX , line . getY2 ( ) + transY ) ; } if ( widthRatio != 1 || heightRatio != 1 ) { line . setLine ( line . getX1 ( ) * widthRatio , line . getY1 ( ) * heightRatio , line . getX2 ( ) * widthRatio , line . getY2 ( ) * heightRatio ) ; } } else if ( shape instanceof GeneralPath ) { GeneralPath path = ( GeneralPath ) shape ; cachedTransform . setToScale ( widthRatio , heightRatio ) ; cachedTransform . translate ( transX , transY ) ; path . transform ( cachedTransform ) ; } else if ( shape instanceof ExtendedGeneralPath ) { ExtendedGeneralPath path = ( ExtendedGeneralPath ) shape ; cachedTransform . setToScale ( widthRatio , heightRatio ) ; cachedTransform . translate ( transX , transY ) ; path . transform ( cachedTransform ) ; } else if ( shape instanceof Ellipse2D ) { Ellipse2D ellipse = ( Ellipse2D ) shape ; if ( transX != 0 || transY != 0 ) { ellipse . setFrame ( ellipse . getX ( ) + transX , ellipse . getY ( ) + transY , ellipse . getWidth ( ) , ellipse . getHeight ( ) ) ; } if ( widthRatio != 1 || heightRatio != 1 ) { ellipse . setFrame ( ellipse . getX ( ) * widthRatio , ellipse . getY ( ) * heightRatio , ellipse . getWidth ( ) * widthRatio , ellipse . getHeight ( ) * heightRatio ) ; } } }
Scales the points composing this shape by the x and y ratios specified
Scales the points composing this shape by the x and y ratios specified