⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 orientation.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
			if (jMirrorY) index |= YMIRROR45;			return map45[index];		}		jAngle = jAngle % 3600;		if (jAngle < 0) jAngle += 3600;		int index = 0;		if (jMirrorX) index += 3600;		if (jMirrorY) index += 3600*2;		Integer key = new Integer(index + jAngle);		Orientation orient;		synchronized (map)		{			orient = map.get(key);			if (orient == null)			{				orient = new Orientation(jAngle, jMirrorX, jMirrorY, null);				map.put(key, orient);				if (orient.inverse != orient)				{					key = new Integer(index + 3600 - jAngle);					map.put(key, orient.inverse);				}			}		}		return orient;	}	/**	 * Get Orientation by the old C style parameters.	 * @param cAngle the angle of rotation (in tenth-degrees)	 * @param cTranspose if true, object is flipped over the major diagonal after rotation.	 * @return the Orientation.	 */	public static Orientation fromC(int cAngle, boolean cTranspose)	{		return fromJava(cTranspose ? cAngle % 3600 + 900 : cAngle, false, cTranspose);	}	/**	 * Get Orientation by the angle without mirrors.	 * @param angle the angle of rotation (in tenth-degrees)	 * @return the Orientation.	 */	public static Orientation fromAngle(int angle)	{		return fromJava(angle, false, false);	}    /**     * Return inverse Orientation to this Orientation.     * @return inverse Orientation.     */    public Orientation inverse() { return inverse; }        /**     * Return canonic Orientation to this Orientation.     * @return canonic Orientation.     */    public Orientation canonic() { return jMirrorX ? fromC(cAngle, cTranspose) : this; }    	/**	 * Concatenates this Orientation with other Orientation.	 * In matrix notation returns this * that.	 * @param that other Orienation.	 * @return concatenation of this and other Orientations.	 */	public Orientation concatenate(Orientation that)	{		boolean mirrorX = this.jMirrorX ^ that.jMirrorX;		boolean mirrorY = this.jMirrorY ^ that.jMirrorY;		int angle = that.jMirrorX^that.jMirrorY ? that.jAngle - this.jAngle : that.jAngle + this.jAngle;		return fromJava(angle, mirrorX, mirrorY);	}	/**	 * Method to return the old C style angle value.	 * @return the old C style angle value, in tenth-degrees.	 */	public int getCAngle() { return cAngle; }	/**	 * Method to return the old C style transpose factor.	 * @return the old C style transpose factor: true to flip over the major diagonal after rotation.	 */	public boolean isCTranspose() { return cTranspose; }	/**	 * Method to return the new Java style angle value.	 * @return the new Java style angle value, in tenth-degrees.	 */	public int getAngle() { return jAngle; }	/**	 * Method to return the new Java style Mirror X factor.	 * @return true to flip over the vertical axis (mirror in X).	 */	public boolean isXMirrored() { return jMirrorX; }	/**	 * Method to return the new Java style Mirror Y factor.	 * @return true to flip over the horizontal axis (mirror in Y).	 */	public boolean isYMirrored() { return jMirrorY; }	/**	 * Returns true if orientation is one of Manhattan orientations.	 * @return true if orientation is one of Manhattan orientations.	 */	public boolean isManhattan() { return manh != MNONE; }		/**	 * Method to return a transformation that rotates an object.	 * @return a transformation that rotates by this Orinetation.	 */    public AffineTransform pureRotate() { return (AffineTransform)trans.clone(); }    	/**	 * Method to return a transformation that rotates an object about a point.	 * @param c the center point about which to rotate.	 * @return a transformation that rotates about that point.	 */	public AffineTransform rotateAbout(Point2D c) {        return rotateAbout(c.getX(), c.getY());    }    	/**	 * Method to return a transformation that rotates an object about a point.	 * @param cX the center X coordinate about which to rotate.	 * @param cY the center Y coordinate about which to rotate.	 * @return a transformation that rotates about that point.	 */	public AffineTransform rotateAbout(double cX, double cY) {        return rotateAbout(cX, cY, -cX, -cY);    }    	/**	 * Method to return a transformation that translate an object then rotates     * and the again translates.	 * @param aX the center X coordinate to translate after rotation.	 * @param aY the center Y coordinate to translate afrer rotation.	 * @param bX the center X coordinate to translate before rotation.	 * @param bY the center Y coordinate to translate before rotation.	 * @return a transformation that rotates about that point.	 */    public AffineTransform rotateAbout(double aX, double aY, double bX, double bY) {        double m00 = trans.getScaleX();        double m01 = trans.getShearX();        double m10 = trans.getShearY();        double m11 = trans.getScaleY();        if (bX != 0 || bY != 0) {            aX = aX + m00*bX + m01*bY;            aY = aY + m11*bY + m10*bX;        }                return new AffineTransform(m00, m10, m01, m11, aX, aY);    }        /**     * Method to transform direction by the Orientation.     * @param angle the angle of initial direction in tenth-degrees.     * @return angle of transformed direction in tenth-degrees.     */    public int transformAngle(int angle) {        angle += this.cAngle;        if (cTranspose) angle = 2700 - angle;        angle %= 3600;        if (angle < 0) angle += 3600;        return angle;    }        /**     * Calculate bounds of rectangle transformed by this Orientation.     * @param xl lower x coordinate.     * @param yl lower y coordinate.     * @param xh higher x coordinate.     * @param yh higher y coordinate.     * @param cx additional x shift     * @param cy additional y shift.     * @param dst destination rectangle.     */    public void rectangleBounds(double xl, double yl, double xh, double yh, double cx, double cy, Rectangle2D dst) {        double dx = xh - xl;        double dy = yh - yl;        switch (manh) {            case MIDENT:                dst.setFrame(cx + xl, cy + yl, dx, dy);                return;            case MR:                dst.setFrame(cx - yh, cy + xl, dy, dx);                return;            case MRR:                dst.setFrame(cx - xh, cy - yh, dx, dy);                return;            case MRRR:                dst.setFrame(cx + yl, cy - xh, dy, dx);                return;            case MY:                dst.setFrame(cx + xl, cy - yh, dx, dy);                return;            case MYR:                dst.setFrame(cx - yh, cy - xh, dy, dx);                return;            case MYRR:                dst.setFrame(cx - xh, cy + yl, dx, dy);                return;            case MYRRR:                dst.setFrame(cx + yl, cy + xl, dy, dx);                return;        }        assert manh == MNONE;        double m00 = trans.getScaleX();        double m01 = trans.getShearX();        double m10 = trans.getShearY();        double m11 = trans.getScaleY();        dst.setFrame(cx + m00*(m00 >= 0 ? xl : xh) + m01*(m01 >= 0 ? yl : yh),                cy + m10*(m10 >= 0 ? xl : xh) + m11*(m11 >= 0 ? yl : yh),                Math.abs(m00)*dx + Math.abs(m01)*dy,                Math.abs(m10)*dx + Math.abs(m11)*dy);    }        /**	 * Returns string which represents this Orientation in JELIB format.	 * @return string in JELIB format.	 */	public String toJelibString() { return jString; }	/**	 * Returns text representation of this Orientation.	 * @return text representation of this Orintation.	 */	public String toString() { return toJelibString(); }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -