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

📄 path.java

📁 svg gwt 监控软件 大的 大 发了佛法ffffffffff发的司法
💻 JAVA
字号:
package com.mc.svg.shape.basicshape;

import java.awt.Color;
import java.awt.Point;

import org.w3c.dom.Document;

import com.mc.svg.GenColor;
import com.mc.svg.SVGCanvas;
import com.mc.svg.shape.AbstractShape;
import com.mc.svg.shape.supershape.Node;

public class Path extends AbstractShape {

	public Point bPoint = null;

	public Point ePoint = null;

	public Path(Document doc) {
		this.doc = doc;
		root = doc.createElementNS(SVGCanvas.svgNS, "path");
	}

	public Path(Node node1, Node node2) {
		this.doc = node1.getDocument();
		root = doc.createElementNS(SVGCanvas.svgNS, "path");
		Point point1 = new Point();

		point1.x = node1.getX();
		point1.y = node1.getY();

		setBeginPoint(point1);

		Point point2 = new Point();

		point2.x = node2.getX();
		point2.y = node2.getY();

		setEndPoint(point2);
		
		
		formD();
	}
	
	public void formD(){
		String str = "M "+ bPoint.x+", "+ bPoint.y;
		str += " L "+ ePoint.x + ", "+ ePoint.y + "Z";
		root.setAttribute("d",str);
	}

	public void setBeginPoint(Point point) {
		bPoint = point;
	}

	public void setEndPoint(Point point) {

		ePoint = point;

	}

	public void setLineColor(Color color) {
		String linecol = GenColor.genColor(color);
		root.setAttributeNS(null, "stroke", linecol);
	}

	public void setLineWidth(int width) {
		root.setAttributeNS(null, "stroke-width", width + "");
	}

}

⌨️ 快捷键说明

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