?? path.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 + -