diff options
author | Niel Mishra | 2015-09-11 15:55:11 +0530 |
---|---|---|
committer | Niel Mishra | 2015-09-11 15:55:11 +0530 |
commit | 769fcf719320e5b9c740f455630aeb44b3deb575 (patch) | |
tree | ac219a58b81d3e1cfc8e3332a006ab2f874fd21b /script/primatives.js | |
parent | dbd3f0a9ea8dc6f655b4db33885ec4144db18805 (diff) | |
download | eSIM-webapp-769fcf719320e5b9c740f455630aeb44b3deb575.tar.gz eSIM-webapp-769fcf719320e5b9c740f455630aeb44b3deb575.tar.bz2 eSIM-webapp-769fcf719320e5b9c740f455630aeb44b3deb575.zip |
First Commit
Diffstat (limited to 'script/primatives.js')
-rwxr-xr-x | script/primatives.js | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/script/primatives.js b/script/primatives.js new file mode 100755 index 0000000..69a6465 --- /dev/null +++ b/script/primatives.js @@ -0,0 +1,79 @@ +Schematic.prototype.createtext = function(str,color,x,y){ + var svg; + + svg = document.createElementNS(this.svgNs, 'text'); + svg.setAttributeNS(null, 'x', x); + svg.setAttributeNS(null, 'y', y); + svg.setAttributeNS(null, 'font-size', this.fontsize); + svg.setAttributeNS(null, 'fill', color); + svg.setAttributeNS(null, 'stroke-width', '0px'); + + svg.appendChild(document.createTextNode(str)); + return svg; +} + + +Schematic.prototype.createtspan=function(str,dx,dy){ + var tspan = document.createElementNS(this.svgNs, 'tspan'); + tspan.setAttributeNS(null, 'dx', dx); + tspan.setAttributeNS(null, 'dy', dy); + tspan.appendChild(document.createTextNode(str)); + return tspan; +} + + +Schematic.prototype.createline = function(lineColor,lineWidth,left, top,right,bottom){ + var svg; + + + svg = document.createElementNS(this.svgNs, 'line'); + + svg.setAttributeNS(null, 'x1', left); + svg.setAttributeNS(null, 'y1', top); + svg.setAttributeNS(null, 'x2', right); + svg.setAttributeNS(null, 'y2', bottom ); + + if (lineColor.length == 0) + lineColor = 'none'; + svg.setAttributeNS(null, 'stroke', lineColor); + svg.setAttributeNS(null, 'stroke-width', lineWidth); + + return svg; + +} + +Schematic.prototype.createrect = function(color,opacity,x, y,width,height){ + + var svg = document.createElementNS(this.svgNs, 'rect'); + svg.setAttributeNS(null, 'x', x); + svg.setAttributeNS(null, 'y', y); + svg.setAttributeNS(null, 'width', width); + svg.setAttributeNS(null, 'height', height); + svg.setAttributeNS(null, 'fill-opacity', opacity); + svg.setAttributeNS(null, 'fill', color); + svg.setAttributeNS(null, 'stroke', color); + svg.setAttributeNS(null, 'stroke-width', '1'); + return svg; + +} + + +Schematic.prototype.createdot =function(lineColor,x,y,radius){ + + var svg; + + + svg = this.container.ownerDocument.createElementNS(this.svgNs, 'circle'); + svg.setAttributeNS(null, 'cx', x); + svg.setAttributeNS(null, 'cy', y); + svg.setAttributeNS(null, 'r', radius ); + + if (lineColor.length == 0) + lineColor = 'none'; + svg.setAttributeNS(null, 'stroke', lineColor); + svg.setAttributeNS(null, 'fill', lineColor); + + return svg; +} + + |