ST.Plot.NodeTypes定义和提供树节点的形状类型
来源:互联网 发布:php应用 编辑:程序博客网 时间:2024/06/03 10:04
/* Class: ST.Plot.NodeTypes This class contains a list of <Graph.Node> built-in types. Node types implemented are 'none', 'circle', 'rectangle', 'ellipse' and 'square'. You can add your custom node types, customizing your visualization to the extreme. Example: (start code js) ST.Plot.NodeTypes.implement({ 'mySpecialType': { 'render': function(node, canvas) { //print your custom node to canvas }, //optional 'contains': function(node, pos) { //return true if pos is inside the node or false otherwise } } }); (end code)*/$jit.ST.Plot.NodeTypes = new Class({ 'none': { 'render': $.empty, 'contains': $.lambda(false) }, 'circle': { 'render': function(node, canvas) { var dim = node.getData('dim'), pos = this.getAlignedPos(node.pos.getc(true), dim, dim), dim2 = dim/2; this.nodeHelper.circle.render('fill', {x:pos.x+dim2, y:pos.y+dim2}, dim2, canvas); }, 'contains': function(node, pos) { var dim = node.getData('dim'), npos = this.getAlignedPos(node.pos.getc(true), dim, dim), dim2 = dim/2; return this.nodeHelper.circle.contains({x:npos.x+dim2, y:npos.y+dim2}, pos, dim2); } }, 'square': { 'render': function(node, canvas) { var dim = node.getData('dim'), dim2 = dim/2, pos = this.getAlignedPos(node.pos.getc(true), dim, dim); this.nodeHelper.square.render('fill', {x:pos.x+dim2, y:pos.y+dim2}, dim2, canvas); }, 'contains': function(node, pos) { var dim = node.getData('dim'), npos = this.getAlignedPos(node.pos.getc(true), dim, dim), dim2 = dim/2; return this.nodeHelper.square.contains({x:npos.x+dim2, y:npos.y+dim2}, pos, dim2); } }, 'ellipse': { 'render': function(node, canvas) { var width = node.getData('width'), height = node.getData('height'), pos = this.getAlignedPos(node.pos.getc(true), width, height); this.nodeHelper.ellipse.render('fill', {x:pos.x+width/2, y:pos.y+height/2}, width, height, canvas); }, 'contains': function(node, pos) { var width = node.getData('width'), height = node.getData('height'), npos = this.getAlignedPos(node.pos.getc(true), width, height); return this.nodeHelper.ellipse.contains({x:npos.x+width/2, y:npos.y+height/2}, pos, width, height); } }, 'rectangle': { 'render': function(node, canvas) { var width = node.getData('width'), height = node.getData('height'), pos = this.getAlignedPos(node.pos.getc(true), width, height); this.nodeHelper.rectangle.render('fill', {x:pos.x+width/2, y:pos.y+height/2}, width, height, canvas); }, 'contains': function(node, pos) { var width = node.getData('width'), height = node.getData('height'), npos = this.getAlignedPos(node.pos.getc(true), width, height); return this.nodeHelper.rectangle.contains({x:npos.x+width/2, y:npos.y+height/2}, pos, width, height); } }});
阅读全文
0 0
- ST.Plot.NodeTypes定义和提供树节点的形状类型
- ST.Plot.EdgeTypes定义和提供连接线的类型
- 树节点类型定义
- MATLAB画图-plot-线形、颜色、数据点形状的选择
- 形状和图形-类型结构
- 二叉树节点的定义和构造二叉树
- 二叉树节点的定义
- 节点的定义、属性和方法
- 定义C#鼠标指针的形状 Cursor
- andriod 继承view定义自己的形状
- canvas.js定义和提供canvas的基本操作
- 《getting started with p5.js》(中文版) 第三章 画:定义和画简单的形状
- Java 提供两种不同的类型:引用类型和原始类型(或内置类型)
- 强制类型转换和隐式类型转换|自定义类型转换语句__int64 d = *(__int64 *)&st的说明
- 一个比较强大的提供各种形状的ImageView
- 利用ST提供的USB例程实现USB IAP功能
- 利用ST提供的USB例程实现USB IAP功能
- 利用ST提供的USB例程实现USB IAP功能
- 运维之Linux基础知识(三)
- Linux内核0.11——内核体系结构
- jqrey表单提交及回显
- 获取文件路径
- spark-sql like查询
- ST.Plot.NodeTypes定义和提供树节点的形状类型
- Java Runtime
- MDC--FORM--Update
- POJ1185(状压dp)
- PAT 1026. Table Tennis (30)
- np.newaxis——np.ndarray增加维数
- CCNA小总结
- centos 升级gcc
- C++ Primer Plus第三章课后编程答案