- 浏览: 24408 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
neusoft_jerry:
同意楼下两位!
使用excanvas.js实现拓扑功能 -
cuisuqiang:
把用到的JS和页面传上去,不然看一堆代码,郁闷
使用excanvas.js实现拓扑功能 -
Silverside:
以后把写好的js文件上传不是更好吗?
如果需要特别说明,只需要 ...
使用excanvas.js实现拓扑功能 -
songfantasy:
请问可以保存吗?
使用jquery ui实现类似portlets的功能 -
songfantasy:
能否发一下源码657219956@qq.com
使用jquery ui实现类似portlets的功能
这周,抽空重构了拓扑程序的脚本。结构化强了,也方便继续扩展了。
还是使用了最新的excanvas.js的最新版和jquery1.4.2。不再使用jquery ui。
除了原来的拖拽功能,还增加了改变大小的功能(先只实现了row-resize功能),以后再实现其他功能。 下来,准备实现element的动态增加、删除功能,和label功能。
JS代码如下:
var jvConstants = { ELEMENT_ID_PREFIX : 'jvElement_', ELEMENT_ID_COUNT : 0, DEFAULT_VALID_COLOR:'#00FF00', DEFAULT_INVALID_COLOR:'#FF0000', HIGHLIGHT_STROKEWIDTH:3, CURSOR_MOVABLE_ELEMENT:'move', CURSOR_MOVABLE_EDGE:'move', CURSOR_CONNECT:'pointer', VALID_COLOR:'#00FF00', INVALID_COLOR:'#FF0000', STYLE_STROKECOLOR:'strokeColor', STYLE_STROKEWIDTH:'strokeWidth', SHAPE_RECTANGLE:'rectangle', SHAPE_ELLIPSE:'ellipse', ELEMENT_TYPE_EDGE:'edge', BACKGROUND_COLOR:'background-color', ACTION_MOVE : 'move', END_POINT_LEFTTOP : 'lt', END_POINT_LEFTMIDDLE : 'lm', END_POINT_LEFTBOTTOM : 'lb', END_POINT_MIDDLETOP : 'mt', END_POINT_MIDDLEBOTTOM : 'mb', END_POINT_RIGHTTOP : 'rt', END_POINT_RIGHTMIDDLE : 'rm', END_POINT_RIGHTBOTTOM : 'rb' }; function getMouseButton(eventObject) { var buttons = { 'left':false, 'middle':false, 'right':false }; if(eventObject.toString && eventObject.toString().indexOf('MouseEvent') != -1) { switch(eventObject.button) { case 0: buttons.left = true; break; case 1: buttons.middle = true; break; case 2: buttons.right = true; break; default: break; } } else if(eventObject.button) { switch(eventObject.button) { case 1: buttons.left = true; break; case 2: buttons.right = true; break; case 3: buttons.left = true; buttons.right = true; break; case 4: buttons.middle = true; break; case 5: buttons.left = true; buttons.middle = true; break; case 6: buttons.middle = true; buttons.right = true; break; case 7: buttons.left = true; buttons.middle = true; buttons.right = true; break; default: break; } } else { return false; } return buttons; }; function jsMap(){ this.clear(); }; jsMap.prototype.map=null; jsMap.prototype.clear=function(){ this.map = {}; }; jsMap.prototype.get=function(key){ var id=mxObjectIdentity.get(key); return this.map[id]; }; jsMap.prototype.put=function(key,value){ var id=mxObjectIdentity.get(key); var previous=this.map[id]; this.map[id]=value; return previous; }; jsMap.prototype.remove=function(key){ var id=mxObjectIdentity.get(key); var previous=this.map[id]; delete this.map[id]; return previous; }; jsMap.prototype.getKeys=function(){ var result=[]; for(key in this.map){ result.push(key); } return result; }; jsMap.prototype.getValues=function(){ var result=[]; for(key in this.map){ result.push(this.map[key]); } return result; }; function jvPoint(x,y){ this.x = (x!=null)?x:0; this.y = (y!=null)?y:0; }; jvPoint.prototype.x=null; jvPoint.prototype.y=null; jvPoint.prototype.equals=function(obj){ return obj.x==this.x&&obj.y==this.y; }; function jvEndPoint(x, y, type, cursor){ jvPoint.call(this, x, y); this.type = type; this.cursor = cursor; }; jvEndPoint.prototype=new jvPoint(); jvEndPoint.prototype.constructor=jvEndPoint; function jvRectangle(x, y, width, height){ jvPoint.call(this, x, y); this.width = (width != null) ? width : 0; this.height = (height != null) ? height : 0; }; jvRectangle.prototype=new jvPoint(); jvRectangle.prototype.constructor=jvRectangle; jvRectangle.prototype.width=null; jvRectangle.prototype.height=null; jvRectangle.prototype.getCenterX=function(){ return this.x+this.width/2; }; jvRectangle.prototype.getCenterY=function(){ return this.y+this.height/2; }; jvRectangle.prototype.getPoint=function(){ return new jvPoint(this.x,this.y); }; jvRectangle.prototype.equals=function(obj){ return obj.x==this.x&&obj.y==this.y&&obj.width==this.width&&obj.height==this.height; }; jvRectangle.prototype.grow=function(amount){ this.x-=amount; this.y-=amount; this.width+=2*amount; this.height+=2*amount; }; function jvStylesheet(){ this.styles = []; this.putDefaultElementStyle(this.createDefaultElementStyle()); this.putDefaultEdgeStyle(this.createDefaultEdgeStyle()); return this; }; jvStylesheet.prototype.createDefaultElementStyle = function(){ var style=new Object(); style[jvConstants.STYLE_SHAPE]=jvConstants.SHAPE_RECTANGLE; style[jvConstants.STYLE_FILLCOLOR]='#C3D9FF'; style[jvConstants.STYLE_STROKECOLOR]='#6482B9'; style[jvConstants.STYLE_FONTCOLOR]='#774400'; style[jvConstants.STYLE_STROKEWIDTH] = 2; return style; }; jvStylesheet.prototype.createDefaultEdgeStyle = function(){ var style=new Object(); style[jvConstants.STYLE_SHAPE]=jvConstants.SHAPE_CONNECTOR; style[jvConstants.STYLE_STROKECOLOR]='#6482B9'; style[jvConstants.STYLE_FONTCOLOR]='#446299'; style[jvConstants.STYLE_STROKEWIDTH] = 2; return style; }; jvStylesheet.prototype.putDefaultElementStyle=function(style){ this.putCellStyle('defaultElement',style); }; jvStylesheet.prototype.putDefaultEdgeStyle=function(style){ this.putCellStyle('defaultEdge',style); }; jvStylesheet.prototype.getDefaultElementStyle=function(){ return this.styles['defaultElement']; }; jvStylesheet.prototype.getDefaultEdgeStyle=function(){ return this.styles['defaultEdge']; }; jvStylesheet.prototype.putCellStyle=function(name,style){ this.styles[name] = style; }; function jvState(x, y, width, height, action){ jvRectangle.call(this, x, y, width, height); this.action = action; } jvState.prototype =new jvRectangle(); jvState.prototype.constructor = jvState; jvState.prototype.changed = false; function jvElement(canvas, type, x, y, width, height){ jvRectangle.call(this, x, y, width, height); this.canvas = canvas; this.type = type; }; jvElement.prototype =new jvRectangle(); jvElement.prototype.constructor = jvElement; jvElement.prototype.id = null; jvElement.prototype.shape = null; jvElement.prototype.frame = null; jvElement.prototype.endPoints = null; jvElement.prototype.source = null; jvElement.prototype.target = null; jvElement.prototype.edges = null; jvElement.prototype.edge=false; jvElement.prototype.lastState=null; jvElement.prototype.edge=false; jvElement.prototype.areaCoords = []; jvElement.prototype.area = null; jvElement.prototype.isEdge=function(){ return this.edge; }; jvElement.prototype.setStyle = function(styles, style){ var d = styles.getDefaultElementStyle(); jQuery.extend(this.style, d, style); }; jvElement.prototype.create = function(){ this.id = $.jvChart.getElementID(); this.container = this.canvas.parentElement; if (this.type == jvConstants.ELEMENT_TYPE_EDGE){ this.style = $.jvChart.getStylesheet().getDefaultEdgeStyle(); this.edge = true; }else{ this.edges = []; this.style = $.jvChart.getStylesheet().getDefaultElementStyle(); this.style[jvConstants.BACKGROUND_COLOR] = $(this.container).css(jvConstants.BACKGROUND_COLOR); } this.draw(); this.createArea(); this.bindMouseEvents(); }; jvElement.prototype.move = function(e){ if (this.height < 0){ var t = this.y + this.height; this.y += this.height; this.height = Math.abs(this.height); this.state.y = this.y; this.state.height = this.height; this.startY = e.clientY; if (this.state.action == jvConstants.END_POINT_MIDDLEBOTTOM){ this.state.action = jvConstants.END_POINT_MIDDLETOP; }else if (this.state.action == jvConstants.END_POINT_MIDDLETOP){ this.state.action = jvConstants.END_POINT_MIDDLEBOTTOM; } } this.updateFrame(); }; jvElement.prototype.updateFrame = function(){ $(this.frame).css('left', this.x).css('top', this.y) .css('width', this.width).css('height', this.height); }; jvElement.prototype.updateEndPoints = function(){ var c = this.container; if (this.endPoints){ $(this.endPoints).remove(); this.endPoints = null; } if (this.isEdge()){ }else{ var xr = this.x + this.width, xm = Math.round(this.x + this.width /2), yr = this.y + this.height, ym = Math.round(this.y + this.height /2); var e = []; e.push(new jvEndPoint(this.x, this.y, jvConstants.END_POINT_LEFTTOP, 'nw-resize')); e.push(new jvEndPoint(xm, this.y, jvConstants.END_POINT_MIDDLETOP, 'row-resize')); e.push(new jvEndPoint(xr, this.y, jvConstants.END_POINT_RIGHTTOP, 'ne-resize')); e.push(new jvEndPoint(this.x, ym, jvConstants.END_POINT_LEFTMIDDLE, 'col-resize')); e.push(new jvEndPoint(xr, ym, jvConstants.END_POINT_RIGHTMIDDLE, 'col-resize')); e.push(new jvEndPoint(this.x, yr, jvConstants.END_POINT_LEFTBOTTOM, 'sw-resize')); e.push(new jvEndPoint(xm, yr, jvConstants.END_POINT_MIDDLEBOTTOM, 'row-resize')); e.push(new jvEndPoint(xr, yr, jvConstants.END_POINT_RIGHTBOTTOM, 'se-resize')); var ep = this.endPoints = []; $(e).each(function(i){ var l = this.x - 3; var t = this.y - 3; ep.push($.jvChart.createElement('div', { action:this.type}, {position: 'absolute', 'z-index':1, 'background-color':'lime', left:l, top:t, width: '7px', height: '7px', overflow:'hidden', cursor:this.cursor}, c)); }); var $e = this; $(ep).each(function(i){ $(this).mousedown(function (e) { return $e.select(e, $(this).attr('action')); }).mouseup(function (e) { return $e.mouseup(); }); }); } }; jvElement.prototype.reDraw = function(){ if (this.shape){ $(this.shape).remove(); } this.draw(this); this.updateFrame(); this.updateEndPoints(); this.bindMouseEvents(); this.state = null; if (!this.isEdge()){ $(this.edges).each(function(i){ this.reDraw(); }); } }; jvElement.prototype.createArea = function(){ }; jvElement.prototype.createFrame = function(){ if (this.frame != null){return;} var c = this.container; if (c.selectedElement){ c.selectedElement.removeFrame(); } this.frame = $.jvChart.createElement('div', { id: c.id + '-frame' }, {position: 'absolute', 'z-index':-1, border:'dotted 2 lime', left:this.x, top:this.y, width: this.width, height: this.height}, c); $(this.frame).mouseup(function (e) { return true; }); this.updateEndPoints(); }; jvElement.prototype.removeFrame = function(){ $(this.frame).remove(); this.frame = null; $(this.endPoints).remove(); this.endPoints = null; this.state = null; }; jvElement.prototype.buildArea = function(){ var str = "<area shape=poly style='cursor:move; ' coords="; var length = $(this.areaCoords).length; $(this.areaCoords).each(function(i){ str += this.x + ',' + this.y; if (i != length - 1){ str += ','; } }); str +='>'; var area = document.createElement(str); this.container.imagemap.appendChild(area); this.area = area; }; jvElement.prototype.select = function(e, action){ if (this.container.selectedElement){ if (this.container.selectedElement.id != this.id){ this.container.selectedElement.unselect(); } } this.createFrame(); this.state = new jvState(this.x, this.y, this.width, this.height, action); this.startX = e.clientX; this.startY = e.clientY; this.container.selectedElement = this; document.onselectstart=new Function ("return false"); return false; }; jvElement.prototype.unselect = function(){ this.removeFrame(); }; jvElement.prototype.mouseup = function(){ if (this.state && !this.state.changed){ this.state.action = null; return false; } return true; }; jvElement.prototype.bindMouseEvents = function(){ if (this.idEdge){return;} var $e = this; $(this.shape).css({cursor:'move'}).mousedown(function (e) { return $e.select(e, jvConstants.ACTION_MOVE); }).mouseup(function (e) { return $e.mouseup(); }); }; function jvEllipseElement(canvas, x, y, width, height){ jvElement.call(this, canvas, jvConstants.SHAPE_ELLIPSE, x, y, width, height); this.create(); return this; }; jvEllipseElement.prototype = new jvElement(); jvEllipseElement.prototype.constructor = jvEllipseElement; jvEllipseElement.prototype.draw = function(){ var ctx = this.canvas.getContext('2d'); ctx.beginPath(); var hB = (this.width / 2) * .5522848, vB = (this.height / 2) * .5522848, eX = this.x + this.width, eY = this.y + this.height, mX = this.x + this.width / 2, mY = this.y + this.height / 2; ctx.moveTo(this.x, mY); ctx.bezierCurveTo(this.x, mY - vB, mX - hB, this.y, mX, this.y); ctx.bezierCurveTo(mX + hB, this.y, eX, mY - vB, eX, mY); ctx.bezierCurveTo(eX, mY + vB, mX + hB, eY, mX, eY); ctx.bezierCurveTo(mX - hB, eY, this.x, mY + vB, this.x, mY); ctx.closePath(); ctx.strokeStyle = this.style[jvConstants.STYLE_STROKECOLOR]; ctx.lineWidth = this.style[jvConstants.STYLE_STROKEWIDTH]; ctx.fillStyle = this.style[jvConstants.BACKGROUND_COLOR]; ctx.fill(); ctx.stroke(); this.shape = []; var shapes = this.canvas.getElementsByTagName("shape"); this.shape.push(shapes[shapes.length - 2]); this.shape.push(shapes[shapes.length - 1]); }; jvEllipseElement.prototype.createArea = function(){ if (!this.imagemap){return;} if (this.area){ $(this.area).remove(); this.areaCoords = []; } var a = 0.5 * Math.sqrt(this.height * this.height + this.width * this.width), b = 0.5 * this.height, e = Math.sqrt(1.0 - b * b / a / a), ox = 0.5 * (this.x + this.width), oy = 0.5 * (this.y + this.height), phi = 0, sinphi = Math.sin(phi), cosphi = Math.cos(phi); for (var i=0;i< 360; i+=15){ var sita = Math.PI / 180.0 * i , cn = Math.cos(sita), sn = Math.sin(sita), r = b / Math.sqrt( 1.0 - e * e * cn * cn), tx = r * cn , ty = r * sn, xx = tx * cosphi - ty * sinphi, yy = ty * cosphi + tx * sinphi; this.areaCoords.push(new jvPoint(Math.round(xx + ox), Math.round(yy + oy))); } this.buildArea(); }; function jvRectangleElement(canvas, x, y, width, height, radius){ jvElement.call(this, canvas, jvConstants.SHAPE_RECTANGLE, x, y, width, height); this.radius = radius; this.create(); return this; }; jvRectangleElement.prototype = new jvElement(); jvRectangleElement.prototype.constructor = jvRectangleElement; jvRectangleElement.prototype.draw = function(){ var ctx = this.canvas.getContext('2d'); ctx.beginPath(); if (!this.radius) { ctx.rect(this.x, this.y, this.width, this.height); } else { ctx.moveTo(this.x, this.y + this.radius); ctx.lineTo(this.x, this.y + this.height - this.radius); ctx.quadraticCurveTo(this.x, this.y + this.height, this.x + this.radius, this.y + this.height); ctx.lineTo(this.x + this.width - this.radius, this.y + this.height); ctx.quadraticCurveTo(this.x + this.width, this.y + this.height, this.x + this.width, this.y + this.height - this.radius); ctx.lineTo(this.x + this.width, this.y + this.radius); ctx.quadraticCurveTo(this.x + this.width, this.y , this.x + this.width - this.radius, this.y); ctx.lineTo(this.x + this.radius, this.y); ctx.quadraticCurveTo(this.x , this.y, this.x, this.y + this.radius); } ctx.closePath(); ctx.strokeStyle = this.style[jvConstants.STYLE_STROKECOLOR]; ctx.lineWidth = this.style[jvConstants.STYLE_STROKEWIDTH]; ctx.fillStyle = this.style[jvConstants.BACKGROUND_COLOR]; ctx.fill(); ctx.stroke(); this.shape = []; var shapes = this.canvas.getElementsByTagName("shape"); this.shape.push(shapes[shapes.length - 2]); this.shape.push(shapes[shapes.length - 1]); }; function jvEdgeElement(canvas, source, target){ jvElement.call(this, canvas, jvConstants.ELEMENT_TYPE_EDGE); this.source = source; this.target = target; this.edge = true; this.create(); return this; }; jvEdgeElement.prototype = new jvElement(); jvEdgeElement.prototype.constructor = jvEdgeElement; jvEdgeElement.prototype.draw = function(){ var ctx = this.canvas.getContext('2d'); var p = [{x: this.source.x + this.source.width / 2, y: this.source.y - 1}, {x: this.source.x + this.source.width / 2, y: this.source.y + this.source.height + 1}, {x: this.source.x - 1, y: this.source.y + this.source.height / 2}, {x: this.source.x + this.source.width + 1, y: this.source.y + this.source.height / 2}, {x: this.target.x + this.target.width / 2, y: this.target.y - 1}, {x: this.target.x + this.target.width / 2, y: this.target.y + this.target.height + 1}, {x: this.target.x - 1, y: this.target.y + this.target.height / 2}, {x: this.target.x + this.target.width + 1, y: this.target.y + this.target.height / 2}]; var d = {}, dis = []; for (var i = 0; i < 4; i++) { for (var j = 4; j < 8; j++) { var dx = Math.abs(p[i].x - p[j].x), dy = Math.abs(p[i].y - p[j].y); if ((i == j - 4) || (((i != 3 && j != 6) || p[i].x < p[j].x) && ((i != 2 && j != 7) || p[i].x > p[j].x) && ((i != 0 && j != 5) || p[i].y > p[j].y) && ((i != 1 && j != 4) || p[i].y < p[j].y))) { dis.push(dx + dy); d[dis[dis.length - 1]] = [i, j]; } } } if (dis.length == 0) { var res = [0, 4]; } else { var res = d[Math.min.apply(Math, dis)]; } var x1 = p[res[0]].x, y1 = p[res[0]].y, x4 = p[res[1]].x, y4 = p[res[1]].y/*, dx = Math.max(Math.abs(x1 - x4) / 2, 10), dy = Math.max(Math.abs(y1 - y4) / 2, 10), x2 = [x1, x1, x1 - dx, x1 + dx][res[0]].toFixed(3), y2 = [y1 - dy, y1 + dy, y1, y1][res[0]].toFixed(3), x3 = [0, 0, 0, 0, x4, x4, x4 - dx, x4 + dx][res[1]].toFixed(3), y3 = [0, 0, 0, 0, y1 + dy, y1 - dy, y4, y4][res[1]].toFixed(3)*/; this.x = x1; this.y = y1; this.width = x4; this.height = y4; ctx.beginPath(); ctx.strokeStyle = this.style[jvConstants.STYLE_STROKECOLOR]; ctx.lineWidth = this.style[jvConstants.STYLE_STROKEWIDTH]; ctx.moveTo(x1, y1); ctx.lineTo(x4, y4); ctx.closePath(); ctx.stroke(); this.shape = []; var shapes = this.canvas.getElementsByTagName("shape"); this.shape.push(shapes[shapes.length - 1]); }; $.jvChart = $.jvChart || {}; $.extend($.jvChart,{ createElement : function(tag, attribs, styles, parent, nopad) { var el = document.createElement(tag); if (attribs) $(el).attr(attribs); if (nopad) $(el).css({padding: 0, border: 'none', margin: 0}); if (styles) $(el).css(styles); if (parent) $(parent).append(el); return el; }, createCanvas : function(div){ var cvs = $.jvChart.createElement('canvas', { id: div.id + '-canvas', width: $(div).width(), height: $(div).height() }, {position: 'absolute'}, div); if ($.browser.msie) { G_vmlCanvasManager.initElement(cvs); cvs = document.getElementById(cvs.id); } return cvs; }, createSelect : function(div){ var sd = $.jvChart.createElement('div', { id: div.id + '-select', left : 0, top : 0, width: 1, height: 1 }, {position: 'absolute'}, div); return sd; }, getElementID : function(){ return jvConstants.ELEMENT_ID_PREFIX + jvConstants.ELEMENT_ID_COUNT ++; }, dragMove: function(div, e) { if(div.selectedElement) { var element = div.selectedElement; var x = e.clientX - element.startX; var y = e.clientY - element.startY; element.x = element.state.x + x; element.y = element.state.y + y; element.state.changed = true; element.move(e); } }, bottomResize : function(div, e) { if(div.selectedElement) { var element = div.selectedElement; var y = e.clientY - element.startY; element.height = element.state.height + y; element.state.changed = true; element.move(e); } }, topResize : function(div, e) { if(div.selectedElement) { var element = div.selectedElement; var y = e.clientY - element.startY; element.y = element.state.y + y; element.height = element.state.height - y; element.state.changed = true; element.move(e); } }, reDrawConnections : function (paper){ paper.edgePaper.ctx.clearRect(0, 0, paper.width, paper.height); $(paper.edgePaper.edges).each(function(i){ $.jvChart.drawConnection(paper.edgePaper, document.getElementById(paper.edgePaper.edges[i][0]), document.getElementById(paper.edgePaper.edges[i][1]), 'rgb(0,0,0)', 2); }); }, reDrawElements : function (paper){ $('.ui-draggable', $(paper.canvas)).remove(); $(paper.elements).each(function(i){ var e = paper.elements[i]; if (e.type == 'ellipse'){ $.jvChart.drawEllipse(paper, e.id, e.x, e.y, e.rx, e.ry, e.color, e.width); }else if(e.type == 'rectangle'){ $.jvChart.drawRect(paper, e.id, e.x, e.y, e.w, e.h, e.r, e.color, e.width); } }); } }); (function($) { $.fn.jvChart = function() { $.extend($.jvChart,{getCvsId : function(){ return getCvsId();}}); $.extend($.jvChart,{getStylesheet : function(){ return new jvStylesheet();}}); return this.each( function() { this.elements = []; this.canvas = $.jvChart.createCanvas(this); this.selectedElement = false; //createImageMap(this); $(this).css({overflow:'hidden', position:'relative'}); $(this).mousemove(function (e) { var element = this.selectedElement; if(element && element.state ){ var action = element.state.action; if (action == jvConstants.ACTION_MOVE){ $.jvChart.dragMove(this, e); }else if (action == jvConstants.END_POINT_MIDDLEBOTTOM){ $.jvChart.bottomResize(this, e); }else if (action == jvConstants.END_POINT_MIDDLETOP){ $.jvChart.topResize(this, e); } } return false; }).mouseup(function (e) { var element = this.selectedElement; if (element){ if (element.state && element.state.changed){ element.reDraw(); }else{ element.removeFrame(); this.selectedElement = false; document.onselectstart=new Function ("return true"); } return false; } return true; }); var $d = this; }); }; $.fn.extend({ circle : function (x, y, r, color, width, fill, shadow, image) { return $.jvChart.drawCircle($(this).attr('paper'), x || 0, y || 0, r || 0, color, width, fill, shadow, image); }, insertEllipse : function (x, y, rx, ry) { var element = new jvEllipseElement($(this).attr('canvas'), x, y, rx, ry); $(this).attr('elements').push(element); return element; }, insertRectangle : function (x, y, w, h, r) { var element = new jvRectangleElement($(this).attr('canvas'), x, y, w, h, r); $(this).attr('elements').push(element); return element; }, insertEdge : function(source, target){ var element = new jvEdgeElement($(this).attr('canvas'), source, target); source.edges.push(element); target.edges.push(element); //$(this).attr('elements').push(element); return element; }, reDrawCanvas : function(){ var elements = $(this).attr('elements'); $(elements).each( function(i) { this.reDraw(); this.unselect(); }); } }); })(jQuery);
调用的代码如下:
$(document).ready(function(){ $("#container").jvChart(300, 200); var v1 = $("#container").insertEllipse(10, 120, 80, 40); var v2 = $("#container").insertRectangle(100, 20, 80, 40, 10); var v4 = $("#container").insertEllipse(200, 100, 50, 50); var v3 = $("#container").insertRectangle(190, 180, 60, 40, 2); $("#container").insertEdge(v1, v2); $("#container").insertEdge(v2, v3); $("#container").insertEdge(v2, v4);/**/ });
相关推荐
为实现井下受灾区域的无线网络覆盖和应急通信,研究应急网络的拓扑重构和数据传输相关问题。首先,提出基于Wi-Fi Direct的应急网络重构方案,并将应急数据流分为上行、网内和下行数据流三类。针对上行数据流,提出基于...
网络重构是配网运行及优化的重要功能之一,随着智能电网建设的进展,其重要性越发显现。基于随机优化技术(如粒子群方法等)的网络重构算法中,为保证重构解满足拓扑的放射性约束,往往采用图的遍历方法进行确定,当...
运用该模型对太阳黑子年平均序列进行小波分解、重构、预测和合成,得到了序列总的预测效果。同时,将新模型与传统BP神经网络模型的预测效果进行了比较,分析了两者出现差异的本质原因。整体反映了将复杂问题简单化...
线路的线状分布不同于变电设备集中,实施全线且...此外,中继点的选择还应使网络具备冗余备份功能,以防某一节点出现故障时,能通过远程操作,进行网络拓扑重构,抢救“信息孤岛”,恢复系统正常。即智能动态网络重构。
利用多代理技术,管理动态重构管控主机、数据采集与监控(SCADA)主机、电力系统拓扑校验、变电站五防闭锁规则库生成软件等功能组件,构建多代理系统,完成电力系统拓扑校验和闭锁逻辑生成等任务的交互策略与协调流程,...
摘要:主要研究边界网关协议(BGP)网络拓扑动态重构及网络稳定性。通过路由软件Zebra实现一个具有部分路由器功能的监测代理,并将其连接到网络中一台BGP边界路由器,通过它们之间的BGP协议交互,监测代理可捕获到整个...
采用类封装技术对植株生长单元及器官类进行定义,建立植株拓扑结构与器官形态变化的规则化描述模型,通过信息融合与重构处理构建植株生长的虚拟模型。实验表明该方法在虚拟植株生长方面具有一定的可行性和有效性,为...
首先利用等价关系对知识点集进行分类,构造知识点集的功能拓扑空间;通过真集建立知识点集和功能拓扑空间之间的联系;给出关于功能拓扑空间的基的相关结论,阐述了知识网、拓扑空间和基在本质上的对应关系。在明确这种...
在第一和二次测验的基础上, 要求进一步重构项目代码,以实现下列功能: (1)利用切分窗口技术,将主框架窗口切分为三分窗口(左右一列,右列再切分为上下两窗格); (2)原来的绘制对象界面存放在右上窗格视图,...
在第一和二次测验的基础上, 要求进一步重构项目代码,以实现下列功能: (1)利用切分窗口技术,将主框架窗口切分为三分窗口(左右一列,右列再切分为上下两窗格); (2)原来的绘制对象界面存放在右上窗格视图,...
主要研究边界网关协议(BGP)网络拓扑动态重构及网络稳定性。通过路由软件Zebra实现一个具有部分路由器功能的监测代理,并将其连接到网络中一台BGP边界路由器,通过它们之间的BGP协议交互,监测代理可捕获到整个网络...
查看! :collision: 介绍仿生(生物逻辑Ñetwork我ntegration用C onvolutions)是一个扩展图形... 然后,BIONIC通过更新其权重以学习捕获相关拓扑信息的基因特征,从而最小化此重构与输入网络之间的差异(即,重构错
一是再现产品从二维到三维的设计过程$即基于截面特征的反求建模路线要求$首先解决点云切片、二维特征元提取、约束施加以及截面曲线全局约束优化$然后通过拉伸&旋转等手段重构曲面模型’二是解决功能特征曲面(分 ...
我们的结果代表了低维类似物的自然椭圆形升程以及推测的4d全纯块的场理论推导,可以通过胶合来恢复具有多种拓扑的紧凑空间的分区功能。 我们还分析了自然可以施加在手性多重峰上的不同边界条件,结果证明它们是...
CMDB建设思路的重构 资源模型设计原则:以服务为中心 IT对象的属性/关系梳理方法 IT对象的全面管理能力体系框架 以应用为中心的全面管理能力体系框架 面向应用的IT资源模型框架 面向应用的模型资源框架 以应用为中心...
通过本系统的II段近后备保护,并结合馈线出口断路器的保护、母线保护、变压器保护,实现了电网、变电站和馈线各类保护的协同配合,同时本系统还具备重合闸、解列、重构等功能,完善了智能配电网的自愈体系,提高了...
在系统实际运行过程中,各个节点的上网和下网是随时可能发生的,特别是操作员站,这样,网络重构会经常进行,而这种操作绝对不能影响系统的正常运行,因此,系统网络应该具有很强在线网络重构功能。
关联度量通过重构算法映射回原始形状,因此突出显示了物理(空间)位置的证据,可以最好地解释两组之间的差异。 通过详细的仿真,我们根据算法的输入来评估算法的功能。 最后,作为管道的应用,我们在一个数据集上...
本文针对航天航空等领域的综合电子系统在小型化,一体化设计及信息综合利用等方面的需求,提出一种可动态重构的高速串行通信总线(UM-BUS),采用N(≤32)通道并发传输,通信速率可达6.4Gbps,采用总线型拓扑结构...