public static bool IsCollidedPointVLine(SPoint Point_, SVLine VLine_, SPoint Dir_, SCollisionInfo CollisionInfo_) { if (Dir_.X == 0.0) { return(false); } if (Dir_.X < 0.0 && Point_.X < VLine_.X) { return(false); } if (Dir_.X > 0.0 && Point_.X > VLine_.X) { return(false); } var ContactY = (Dir_.Y / Dir_.X) * (VLine_.X - Point_.X) + Point_.Y; CollisionInfo_.Time = (VLine_.X - Point_.X) / Dir_.X; if (CollisionInfo_.Time < 0.0) { return(false); } CollisionInfo_.Point.X = VLine_.X; CollisionInfo_.Point.Y = ContactY; CollisionInfo_.Normal.X = -Dir_.X; CollisionInfo_.Normal.Y = 0.0f; return(true); }
/// <summary> /// 构造函数初始化 /// </summary> public SVObjTreeView() { this.Indent = 20; this.ItemHeight = 20; this.Font = new Font(this.Font.FontFamily, 11.0f); ///建立名称与控件的对应关系 _nameDict = new Dictionary <String, Function1>(); _nameDict.Add("SVButton", (cc, c) => { if (!cc.Nodes.Contains(_btnNode)) { cc.Nodes.Add(_btnNode); } SVButton button = (SVButton)c; //String text = String.Format("按钮-(ID:{0})", button.Attrib.ID); String text = String.Format("ID:{0}", button.Attrib.ID); ObjTreeNode node = new ObjTreeNode(); node.Text = text; node.objControl = c; _btnNode.Nodes.Add(node); _btnNode.Text = String.Format("按钮(计数:{0})", _btnNode.Nodes.Count); }); _nameDict.Add("SVLabel", (cc, c) => { if (!cc.Nodes.Contains(_textNode)) { cc.Nodes.Add(_textNode); } SVLabel button = (SVLabel)c; //String text = String.Format("文本-(ID:{0})", button.Attrib.ID); String text = String.Format("ID:{0}", button.Attrib.ID); ObjTreeNode node = new ObjTreeNode(); node.Text = text; node.objControl = c; _textNode.Nodes.Add(node); _textNode.Text = String.Format("文本(计数:{0})", _textNode.Nodes.Count); }); _nameDict.Add("SVAnalog", (cc, c) => { if (!cc.Nodes.Contains(_analogNode)) { cc.Nodes.Add(_analogNode); } SVAnalog button = (SVAnalog)c; //String text = String.Format("模拟量-(ID:{0})", button.Attrib.ID); String text = String.Format("ID:{0}", button.Attrib.ID); ObjTreeNode node = new ObjTreeNode(); node.Text = text; node.objControl = c; _analogNode.Nodes.Add(node); _analogNode.Text = String.Format("模拟量(计数:{0})", _analogNode.Nodes.Count); }); _nameDict.Add("SVBinary", (cc, c) => { if (!cc.Nodes.Contains(_binaryNode)) { cc.Nodes.Add(_binaryNode); } SVBinary button = (SVBinary)c; //String text = String.Format("开关量-(ID:{0})", button.Attrib.ID); String text = String.Format("ID:{0}", button.Attrib.ID); ObjTreeNode node = new ObjTreeNode(); node.Text = text; node.objControl = c; _binaryNode.Nodes.Add(node); _binaryNode.Text = String.Format("开关量(计数:{0})", _binaryNode.Nodes.Count); }); _nameDict.Add("SVCurve", (cc, c) => { if (!cc.Nodes.Contains(_curveNode)) { cc.Nodes.Add(_curveNode); } SVCurve button = (SVCurve)c; //String text = String.Format("趋势图-(ID:{0})", button.Attrib.ID); String text = String.Format("ID:{0}", button.Attrib.ID); ObjTreeNode node = new ObjTreeNode(); node.Text = text; node.objControl = c; _curveNode.Nodes.Add(node); _curveNode.Text = String.Format("趋势图(计数:{0})", _curveNode.Nodes.Count); }); _nameDict.Add("SVIcon", (cc, c) => { if (!cc.Nodes.Contains(_iconNode)) { cc.Nodes.Add(_iconNode); } SVIcon button = (SVIcon)c; //String text = String.Format("静态图-(ID:{0})", button.Attrib.ID); String text = String.Format("ID:{0}", button.Attrib.ID); ObjTreeNode node = new ObjTreeNode(); node.Text = text; node.objControl = c; _iconNode.Nodes.Add(node); _iconNode.Text = String.Format("静态图(计数:{0})", _iconNode.Nodes.Count); }); _nameDict.Add("SVLine", (cc, c) => { if (!cc.Nodes.Contains(_lineNode)) { cc.Nodes.Add(_lineNode); } SVLine button = (SVLine)c; //String text = String.Format("直线-(ID:{0})", button.Attrib.ID); String text = String.Format("ID:{0}", button.Attrib.ID); ObjTreeNode node = new ObjTreeNode(); node.Text = text; node.objControl = c; _lineNode.Nodes.Add(node); _lineNode.Text = String.Format("直线(计数:{0})", _lineNode.Nodes.Count); }); _nameDict.Add("SVGif", (cc, c) => { if (!cc.Nodes.Contains(_gifNode)) { cc.Nodes.Add(_gifNode); } SVGif button = (SVGif)c; //String text = String.Format("动态图-(ID:{0})", button.Attrib.ID); String text = String.Format("ID:{0}", button.Attrib.ID); ObjTreeNode node = new ObjTreeNode(); node.Text = text; node.objControl = c; _gifNode.Nodes.Add(node); _gifNode.Text = String.Format("动态图(计数:{0})", _gifNode.Nodes.Count); }); _nameDict.Add("SVHeartbeat", (cc, c) => { if (!cc.Nodes.Contains(_heartNode)) { cc.Nodes.Add(_heartNode); } SVHeartbeat button = (SVHeartbeat)c; //String text = String.Format("心跳控件-(ID:{0})", button.Attrib.ID); String text = String.Format("ID:{0}", button.Attrib.ID); ObjTreeNode node = new ObjTreeNode(); node.Text = text; node.objControl = c; _heartNode.Nodes.Add(node); _heartNode.Text = String.Format("心跳控件(计数:{0})", _heartNode.Nodes.Count); }); this.AfterSelect += new TreeViewEventHandler(SVObjTreeView_AfterSelect); this.NodeMouseClick += new TreeNodeMouseClickEventHandler(SVObjTreeView_NodeMouseClick); }
public SVSegment(SVLine Super_, Single Bottom_, Single Top_) : base(Super_) { Bottom = Bottom_; Top = Top_; }
public void Set(SVLine Obj_) { X = Obj_.X; }
public SVLine(SVLine Obj_) { X = Obj_.X; }