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

📄 calculate.java

📁 一个eclipse插件源代码。用于web开发
💻 JAVA
字号:
/*
 * $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/module/control/Calculate.java,v 1.1.1.1 2004/07/01 09:07:49 wang_j Exp $
 * $Revision: 1.1.1.1 $
 * $Date: 2004/07/01 09:07:49 $
 *
 * ====================================================================
 *
 * The NanJing HopeRun(IT-FOREST) Software License, Version 2.0.0
 *
 * Copyright 2003-2004 by NanJing HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and
 *                        IT Forest Corporation
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
 * You shall not disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into with
 * HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
 */

package com.webpump.ui.module.control;

import java.util.Vector;

import org.eclipse.swt.graphics.*;

/**
 * Class for calculate points of the task
 * 
 * @author shi_l
 * @version 2.0.0 2004-2-11
 */
public class Calculate {

	/** size of points*/
	final static int SIZE = 6;

	/** left direction*/
	final static int LEFT_DIRECTION = 0; // left direction

	/** right direction*/
	final static int RIGHT_DIRECTION = 1; // right

	/** top direction*/
	final static int TOP_DIRECTION = 2; // top

	/** bottom direction*/
	final static int BOTTOM_DIRECTION = 3; // bottom

	/**offset between task & page*/
	final static int OFFSET = 30; // line offset rect

	/** start point*/
	private static Point m_objStartPoint;

	/** end point*/
	private static Point m_objEndPoint;

	/** first insect point*/
	private static Point m_objInsectPoint1;

	/** second insect point*/
	private static Point m_objInsectPoint2;

	/** start rect*/
	private static Rectangle m_objStartRect;

	/** end rect*/
	private static Rectangle m_objEndRect;

	/** start direction*/
	private static int m_nStartDirection;

	/** end direction*/
	private static int m_nEndDirection;

	/** points*/
	private static Point[] m_objPoints;

	/** the amount of exist points*/
	private static int m_objPointsLen;
	/*********************************************************************/
	static {
		//初始化
		m_objPoints = new Point[SIZE];
		for (int i = 0; i < SIZE; i++) {
			m_objPoints[i] = new Point(0, 0);
		}
		m_objPointsLen = 0;
		m_objStartPoint = new Point(0, 0);
		m_objEndPoint = new Point(0, 0);
		m_objInsectPoint1 = new Point(0, 0);
		m_objInsectPoint2 = new Point(0, 0);
		m_objStartRect = new Rectangle(0, 0, 0, 0);
		m_objEndRect = new Rectangle(0, 0, 0, 0);
	}
	/*********************************************************************/

	/**
	 * set start point
	 * @param start
	 */
	public static void setStartPoint(Point start) {
		m_objStartPoint.x = start.x;
		m_objStartPoint.y = start.y;
	}

	/**
	 * set end point
	 * @param end
	 */
	public static void setEndPoint(Point end) {
		m_objEndPoint.x = end.x;
		m_objEndPoint.y = end.y;
	}

	/**
	 * set start rect
	 * @param start
	 */
	public static void setStartRect(Rectangle start) {
		m_objStartRect.x = start.x;
		m_objStartRect.y = start.y;
		m_objStartRect.width = start.width;
		m_objStartRect.height = start.height;
	}

	/**
	 * set end rect
	 * @param end
	 */
	public static void setEndRect(Rectangle end) {
		m_objEndRect.x = end.x;
		m_objEndRect.y = end.y;
		m_objEndRect.width = end.width;
		m_objEndRect.height = end.height;
	}

	/**
	 * set offset points
	 */
	private static void setOffsetPoints() {
		if (m_nStartDirection == LEFT_DIRECTION) {
			m_objStartPoint.x -= OFFSET;
		} else if (m_nStartDirection == RIGHT_DIRECTION) {
			m_objStartPoint.x += OFFSET;
		} else if (m_nStartDirection == TOP_DIRECTION) {
			m_objStartPoint.y -= OFFSET;
		} else if (m_nStartDirection == BOTTOM_DIRECTION) {
			m_objStartPoint.y += OFFSET;
		}
		if (m_nEndDirection == LEFT_DIRECTION) {
			m_objEndPoint.x -= OFFSET;
		} else if (m_nEndDirection == RIGHT_DIRECTION) {
			m_objEndPoint.x += OFFSET;
		} else if (m_nEndDirection == TOP_DIRECTION) {
			m_objEndPoint.y -= OFFSET;
		} else if (m_nEndDirection == BOTTOM_DIRECTION) {
			m_objEndPoint.y += OFFSET;
		}
	}

	/**
	 * reset
	 */
	private static void reset() {
		m_objPointsLen = 0;
	}

	/**
	 * add two points
	 * @param point1
	 * @param point2
	 */
	private static void addPoints(Point point1, Point point2) {
		//将两个点加在

⌨️ 快捷键说明

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