diff onlypaths/js/svgrenderer.js @ 46:26c2b3ad21c7 laserkard

[svn r47] saving progresswww.cinemassacre.com/new/?page_id=30
author rlm
date Sun, 31 Jan 2010 12:33:33 -0500
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/onlypaths/js/svgrenderer.js	Sun Jan 31 12:33:33 2010 -0500
     1.3 @@ -0,0 +1,4246 @@
     1.4 +/*----------------------------------------------------------------------------
     1.5 + SVGRENDERER 1.0
     1.6 + SVG Renderer For RichDraw
     1.7 + -----------------------------------------------------------------------------
     1.8 + Created by Mark Finkle (mark.finkle@gmail.com)
     1.9 + Implementation of SVG based renderer.
    1.10 + -----------------------------------------------------------------------------
    1.11 +*/
    1.12 +function AbstractRenderer() {
    1.13 +
    1.14 +};
    1.15 +
    1.16 +AbstractRenderer.prototype.init = function(elem) {};
    1.17 +
    1.18 +
    1.19 +
    1.20 +
    1.21 +function SVGRenderer() {
    1.22 +	this.base = AbstractRenderer;
    1.23 +	this.svgRoot = null;
    1.24 +}
    1.25 +
    1.26 +
    1.27 +SVGRenderer.prototype = new AbstractRenderer;
    1.28 +
    1.29 +
    1.30 +SVGRenderer.prototype.bounds = function(shape) { 
    1.31 +   
    1.32 + var box = shape.getBBox();
    1.33 +
    1.34 + return { x:box.x, y:box.y, width:box.width, height: box.height }; 
    1.35 +
    1.36 +};
    1.37 +
    1.38 +SVGRenderer.prototype.init = function(elem) {
    1.39 +  this.container = elem;
    1.40 +
    1.41 +  this.container.style.MozUserSelect = 'none';
    1.42 +    
    1.43 +  var svgNamespace = 'http://www.w3.org/2000/svg'; 
    1.44 +  
    1.45 +  this.svgRoot = this.container.ownerDocument.createElementNS(svgNamespace, "svg");
    1.46 +  this.svgRoot.setAttributeNS(null,'viewBox', zoominit);
    1.47 +  this.svgRoot.setAttributeNS(null,'preserveAspectRatio','none');
    1.48 +  this.svgRoot.setAttributeNS(null,'space','preserve');
    1.49 +  this.container.appendChild(this.svgRoot);
    1.50 +}
    1.51 +
    1.52 +SVGRenderer.prototype.view = function(left,top,width,height,viewBox,bgcolor) {
    1.53 +  var svgNamespace = 'http://www.w3.org/2000/svg'; 
    1.54 +  var tokens = viewBox.split(' ');       
    1.55 +  var margin=100; 
    1.56 +  var wFront=parseInt(document.getElementById('FRONT').style.width)
    1.57 +  var hFront=parseInt(document.getElementById('FRONT').style.height)
    1.58 +  var tC=0 + ' ' + 0 + ' ' + wFront + ' ' + hFront;
    1.59 +  tokensCanvas= tC.split(' '); 
    1.60 +  var w=parseFloat(tokens[2]);
    1.61 +  var h=parseFloat(tokens[3]); 
    1.62 +  var wImage = w - parseFloat(tokens[0]);  
    1.63 +  var hImage = h - parseFloat(tokens[1]);
    1.64 +  var wCanvas = wFront;
    1.65 +  var hCanvas = hFront;
    1.66 +  proporImage = hImage / wImage; 
    1.67 +  proporCanvas = hCanvas / wCanvas; 
    1.68 +
    1.69 +  document.title= initialFile +'     '+wImage+' x '+hImage;
    1.70 +
    1.71 +
    1.72 +  if(bgcolor != '')
    1.73 +   {
    1.74 +    this.container.style.backgroundColor=bgcolor;
    1.75 +   } else{
    1.76 +    this.container.style.backgroundColor="#ffffff";
    1.77 +   }
    1.78 +if(viewMode=='preview')
    1.79 + {
    1.80 +  if(proporCanvas==proporImage)
    1.81 +   {
    1.82 +      this.container.style.width =wFront+'px';
    1.83 +      this.container.style.height =hFront+'px';
    1.84 +      this.container.style.left =0+'px' 
    1.85 +      this.container.style.top =0+'px' 
    1.86 +
    1.87 +   }
    1.88 +  if(proporCanvas<proporImage)
    1.89 +   {    
    1.90 +      var proportion= wFront/hFront;  
    1.91 +      //var image_proportion= width/height;
    1.92 +      var image_proportion= w/h;
    1.93 +      var W=hFront*image_proportion; 
    1.94 +      var leftover=(wFront-W)/2;
    1.95 +      
    1.96 +      this.container.style.width =W+'px';
    1.97 +      this.container.style.height =hFront+'px';
    1.98 +      this.container.style.left =leftover+'px' 
    1.99 +      this.container.style.top =0+'px' 
   1.100 +      //alert('Horizontal '+wFront+','+hFront+' '+image_proportion+' '+W+' '+leftover+' ____'+ this.container.style.width)
   1.101 + 
   1.102 +    } 
   1.103 +  if(proporCanvas>proporImage)
   1.104 +   {    
   1.105 +      var proportion= hFront/wFront;  
   1.106 +      //var image_proportion= width/height;
   1.107 +      var image_proportion= h/w;
   1.108 +      var H=wFront*image_proportion; 
   1.109 +      var leftover=(hFront-H)/2;
   1.110 +      
   1.111 +      this.container.style.width =wFront+'px';
   1.112 +      this.container.style.height =H+'px';
   1.113 +      this.container.style.left =0+'px' 
   1.114 +      this.container.style.top =leftover+'px' 
   1.115 +    }   
   1.116 + 
   1.117 +    this.svgRoot.setAttributeNS(null,'x', left);
   1.118 +    this.svgRoot.setAttributeNS(null,'y', top); 
   1.119 +    this.svgRoot.setAttributeNS(null,'width', parseInt(this.container.style.width));
   1.120 +    this.svgRoot.setAttributeNS(null,'height', parseInt(this.container.style.height)); 
   1.121 + 
   1.122 +    this.svgRoot.setAttributeNS(null,'viewBox', viewBox);
   1.123 +   
   1.124 +  } 
   1.125 +if(viewMode=='canvas')
   1.126 + {
   1.127 +   this.container.style.left = 0 + 'px';   
   1.128 +   this.container.style.top = 0 + 'px';                                 
   1.129 +   this.container.style.width = wFront + 'px';
   1.130 +   this.container.style.height = hFront + 'px';
   1.131 +   
   1.132 +   //  margins 10%    
   1.133 +   var percent=10;
   1.134 +   var percentX = wImage / percent; 
   1.135 +   var percentY = hImage / percent; 
   1.136 +   var cornerNEx = parseFloat(tokens[0])-percentX; 
   1.137 +   var cornerNEy = parseFloat(tokens[1])-percentY;
   1.138 +   var percentRectW=wImage + percentX*2;
   1.139 +   var percentRectH=hImage + percentY*2; 
   1.140 + 
   1.141 +   document.title= initialFile +'     '+wImage+' x '+hImage;
   1.142 +   // ajust proporImage to proporCanvas
   1.143 +  if(proporCanvas==proporImage)
   1.144 +   {  
   1.145 +      cornerNEx = parseFloat(tokens[0])-percentX
   1.146 +      cornerNEy = parseFloat(tokens[1])-percentY  
   1.147 +      var wi=percentRectW;
   1.148 +      var he=percentRectH;//hImage+percentY+addHimage; 
   1.149 +      zoominit=viewBox;
   1.150 +      zoominit1 = cornerNEx+' '+cornerNEy+' '+wi+' '+he;
   1.151 +      tokensZoom=zoominit1.split(' ');  
   1.152 +   }
   1.153 +
   1.154 +  if(proporCanvas<proporImage)
   1.155 +   {    
   1.156 +        
   1.157 +        // add to hImage
   1.158 +        var newWimage = percentRectW * ((wCanvas * percentRectH) / (hCanvas * percentRectW))  ;//newRectH *
   1.159 +        var diffImages=newWimage-w;
   1.160 +        cornerNEx = parseFloat(tokens[0]) - (diffImages / 2);
   1.161 +        var wi=newWimage;
   1.162 +        var he=percentRectH;//hImage+percentY+addHimage; 
   1.163 +        zoominit=viewBox;
   1.164 +        zoominit1 = cornerNEx+' '+cornerNEy+' '+wi+' '+he;
   1.165 +        tokensZoom=zoominit1.split(' '); 
   1.166 +         //alert(newRectW+' '+newRectH+' // '+newHimage+' // '+zoominit1+' // '+hCanvas * newRectW +' '+ wCanvas * newRectH)
   1.167 +        //alert(addHimage+' // '+zoominit1)                   
   1.168 +        //160 160 700 300
   1.169 +    }
   1.170 +  if(proporCanvas>proporImage)
   1.171 +   {    
   1.172 +        // add to hImage
   1.173 +        var newHimage = percentRectH * ((hCanvas * percentRectW) / (wCanvas * percentRectH))  ;//newRectH *
   1.174 +        var diffImages=newHimage-h;
   1.175 +        cornerNEy = parseFloat(tokens[1]) - (diffImages / 2);
   1.176 +        var wi=percentRectW;
   1.177 +        var he=newHimage;//hImage+percentY+addHimage; 
   1.178 +        zoominit=viewBox;
   1.179 +        zoominit1 = cornerNEx+' '+cornerNEy+' '+wi+' '+he;
   1.180 +        tokensZoom=zoominit1.split(' '); 
   1.181 +   } 
   1.182 + /* this.svgRoot.setAttributeNS(null,'x', cornerNEx);
   1.183 +  this.svgRoot.setAttributeNS(null,'y', cornerNEy); 
   1.184 +  this.svgRoot.setAttributeNS(null,'width', wi);   
   1.185 +  this.svgRoot.setAttributeNS(null,'height',he); 
   1.186 + */
   1.187 +  this.svgRoot.setAttributeNS(null,'x', 0);
   1.188 +  this.svgRoot.setAttributeNS(null,'y', 0); 
   1.189 +  this.svgRoot.setAttributeNS(null,'width', wFront);   
   1.190 +  this.svgRoot.setAttributeNS(null,'height',hFront); 
   1.191 +  this.svgRoot.setAttributeNS(null,'viewBox', zoominit1);  
   1.192 +  
   1.193 +
   1.194 +  }
   1.195 +}
   1.196 +
   1.197 +SVGRenderer.prototype.zoomFrame = function(zoom){
   1.198 +   this.svgRoot.setAttributeNS(null,'viewBox', zoom);
   1.199 +}
   1.200 +
   1.201 +SVGRenderer.prototype.rectDoc = function(viewBox) {  
   1.202 +    var tokens = viewBox.split(' ');
   1.203 +  var wFront=parseInt(document.getElementById('FRONT').style.width)
   1.204 +  var hFront=parseInt(document.getElementById('FRONT').style.height)
   1.205 +  var tC=0 + ' ' + 0 + ' ' + wFront + ' ' + hFront;
   1.206 +  tokensCanvas= tC.split(' '); 
   1.207 +    var Ey = parseFloat(tokensCanvas[3]) ; // (end) height canvas. Corner up-right
   1.208 +    var Hz = parseFloat(tokens[3]) ; // height zoom
   1.209 +    this.editor.unit = this.editor.initialUnit * (Hz/Ey) ; // 0 to 1
   1.210 +
   1.211 +  var svgNamespace = 'http://www.w3.org/2000/svg'; 
   1.212 +        
   1.213 +  var shape = document.getElementById('rectDoc');
   1.214 +  if (shape) {
   1.215 +    this.remove(shape);
   1.216 +  } 
   1.217 +  var rect=this.container.ownerDocument.createElementNS(svgNamespace, 'rect');
   1.218 +  rect.setAttributeNS(null, 'id', 'rectDoc');
   1.219 +  rect.setAttributeNS(null, 'x', tokens[0] + 'px');
   1.220 +  rect.setAttributeNS(null, 'y', tokens[1] + 'px');
   1.221 +  rect.setAttributeNS(null, 'width', tokens[2]+ 'px');
   1.222 +  rect.setAttributeNS(null, 'height', tokens[3] + 'px');  
   1.223 +  rect.setAttributeNS(null, 'fill', 'none');
   1.224 +  rect.setAttributeNS(null, 'stroke', '#000000');
   1.225 +  rect.setAttributeNS(null, 'stroke-width', this.editor.unit*2+'px');
   1.226 + // this.svgRoot.appendChild(rect) 
   1.227 + 
   1.228 +  this.svgRoot.insertBefore( rect, this.svgRoot.firstChild );
   1.229 +}  
   1.230 + 
   1.231 +SVGRenderer.prototype.rectCanvas = function(docx,docy,docw,doch,viewBox) {   
   1.232 + var svgNamespace = 'http://www.w3.org/2000/svg'; 
   1.233 +    var tokens = zoominit1.split(' ');    
   1.234 +  var shape = document.getElementById('rectCanvas');
   1.235 +  if (shape) {
   1.236 +    this.remove(shape);
   1.237 +  }     
   1.238 +  var rect=this.container.ownerDocument.createElementNS(svgNamespace, 'rect');
   1.239 +  rect.setAttributeNS(null, 'id', 'rectBackground');
   1.240 +  rect.setAttributeNS(null, 'x', tokens[0] + 'px');
   1.241 +  rect.setAttributeNS(null, 'y', tokens[1] + 'px');
   1.242 +  rect.setAttributeNS(null, 'width', tokens[2] + 'px');
   1.243 +  rect.setAttributeNS(null, 'height', tokens[3] + 'px');  
   1.244 +  rect.setAttributeNS(null, 'fill', '#666666');
   1.245 +  rect.setAttributeNS(null, 'stroke', 'none');
   1.246 +  //this.svgRoot.appendChild(rect)     
   1.247 +   this.svgRoot.insertBefore( rect, this.svgRoot.firstChild );
   1.248 +
   1.249 +  //this.index('rectBackground',0);
   1.250 +  
   1.251 + /*  var shape = document.getElementById('rectOverCanvas');
   1.252 +  if (shape) {
   1.253 +    this.remove(shape);
   1.254 +  } 
   1.255 +  var rect=this.container.ownerDocument.createElementNS(svgNamespace, 'rect');
   1.256 +  rect.setAttributeNS(null, 'id', 'rectOverCanvas');
   1.257 +  rect.setAttributeNS(null, 'x', docx + 'px');
   1.258 +  rect.setAttributeNS(null, 'y', docy + 'px');
   1.259 +  rect.setAttributeNS(null, 'width', docw + 'px');
   1.260 +  rect.setAttributeNS(null, 'height', doch + 'px');  
   1.261 +  rect.setAttributeNS(null, 'fill', 'none');
   1.262 +  rect.setAttributeNS(null, 'stroke', '#000000');
   1.263 +  rect.setAttributeNS(null, 'stroke-width', 1+'px');
   1.264 + // this.svgRoot.appendChild(rect)  
   1.265 +  this.svgRoot.insertBefore( rect, this.svgRoot.lastChild );
   1.266 +  */
   1.267 +}
   1.268 +
   1.269 +SVGRenderer.prototype.removeAll = function() 
   1.270 +{  
   1.271 + while( this.svgRoot.hasChildNodes () )
   1.272 + {
   1.273 +   this.svgRoot.removeChild( this.svgRoot.firstChild );
   1.274 + }
   1.275 +}
   1.276 +
   1.277 +SVGRenderer.prototype.create = function(shape, fillColor, lineColor, fillOpac, lineOpac, lineWidth, left, top, width, height, textMessaje, textSize, textFamily, imageHref, points, transform, parent, viewBox) {
   1.278 +  var svgNamespace = 'http://www.w3.org/2000/svg'; 
   1.279 +  var xlinkNS="http://www.w3.org/1999/xlink"; 
   1.280 + 
   1.281 +  var svg;  
   1.282 +  
   1.283 +  if (shape == 'rect') {
   1.284 +    svg = this.container.ownerDocument.createElementNS(svgNamespace, 'rect');
   1.285 +    svg.setAttributeNS(null, 'x', left + 'px');
   1.286 +    svg.setAttributeNS(null, 'y', top + 'px');
   1.287 +    svg.setAttributeNS(null, 'width', width + 'px');
   1.288 +    svg.setAttributeNS(null, 'height', height + 'px');  
   1.289 +    svg.setAttributeNS(null, 'rx', 0+'px');
   1.290 +    svg.setAttributeNS(null, 'ry', 0+'px');
   1.291 +
   1.292 +    //svg.setAttributeNS(null,'transform', "translate(0,0)");
   1.293 +    //svg.setAttributeNS(null,'transform', "translate('+left+','+top+')");   
   1.294 +    svg.style.position = 'absolute';
   1.295 +  }
   1.296 +  else if (shape == 'ellipse' || shape == 'circle') {
   1.297 +    
   1.298 +    svg = this.container.ownerDocument.createElementNS(svgNamespace, 'ellipse');
   1.299 +    svg.setAttributeNS(null, 'cx', (left + width / 2) + 'px');
   1.300 +    svg.setAttributeNS(null, 'cy', (top + height / 2) + 'px');
   1.301 +    if(shape == 'circle'){
   1.302 +     svg.setAttributeNS(null, 'rx', (width / 2) + 'px');
   1.303 +     svg.setAttributeNS(null, 'ry', (width / 2) + 'px');   
   1.304 +    }else{
   1.305 +     svg.setAttributeNS(null, 'rx', (width / 2) + 'px');
   1.306 +     svg.setAttributeNS(null, 'ry', (height / 2) + 'px');   
   1.307 +    
   1.308 +    }
   1.309 +   //svg.setAttributeNS(null,'transform', "translate('+left+','+top+')");  
   1.310 +    svg.style.position = 'absolute';
   1.311 +  }
   1.312 +  else if (shape == 'roundrect') {
   1.313 +    svg = this.container.ownerDocument.createElementNS(svgNamespace, 'rect');
   1.314 +    svg.setAttributeNS(null, 'x', left + 'px');
   1.315 +    svg.setAttributeNS(null, 'y', top + 'px');  
   1.316 +    if(textSize!=0 || textSize!=''){ var rounded=textSize; }else{var rounded=18;}
   1.317 +    svg.setAttributeNS(null, 'rx', rounded+'px');
   1.318 +    svg.setAttributeNS(null, 'ry', rounded+'px');
   1.319 +    svg.setAttributeNS(null, 'width', width + 'px');
   1.320 +    svg.setAttributeNS(null, 'height', height + 'px');   
   1.321 +   //svg.setAttributeNS(null,'transform', "translate('+left+','+top+')");  
   1.322 +    svg.style.position = 'absolute';
   1.323 +  }
   1.324 +  else if (shape == 'line') {
   1.325 +    svg = this.container.ownerDocument.createElementNS(svgNamespace, 'line');
   1.326 +    svg.setAttributeNS(null, 'x1', left + 'px');
   1.327 +    svg.setAttributeNS(null, 'y1', top + 'px');
   1.328 +    svg.setAttributeNS(null, 'x2', left + width + 'px');
   1.329 +    svg.setAttributeNS(null, 'y2', top + height + 'px');  
   1.330 +    //svg.setAttributeNS(null,'transform', "translate('+left+','+top+')");  
   1.331 +    svg.style.position = 'absolute';
   1.332 +  } 
   1.333 +  else if (shape == 'polyline' || shape == 'polygon') {
   1.334 +    var xcenterpoly=xpArray;
   1.335 +    var ycenterpoly=ypArray;
   1.336 +    var thispath=''+xpArray[1]+','+ypArray[1];
   1.337 +    svg = this.container.ownerDocument.createElementNS(svgNamespace, shape);  
   1.338 +    svg.setAttributeNS(null, 'points', points);
   1.339 +    svg.style.position = 'absolute';
   1.340 +  }
   1.341 +  else if (shape == 'path')
   1.342 +    {
   1.343 +    var k = (Math.sqrt(2)-1)*4/3;
   1.344 +    var circle="M 0,1 L 0.552,1 1,0.552  1,0  1,-0.552  0.552,-1 0,-1 -0.552,-1 -1,-0.552 -1,0  -1,0.552  -0.552,1  0,1z"  // 4th
   1.345 +    svg = this.container.ownerDocument.createElementNS(svgNamespace, 'path');   
   1.346 +    //svg.setAttributeNS(null, 'd', 'M '+thispath+' C'+thispath);
   1.347 +    svg.setAttributeNS(null, 'd', points);  	
   1.348 +    //svg.setAttributeNS(null,'transform', "translate(-80,-80)"); 
   1.349 +    svg.style.position = 'absolute';  
   1.350 +    } 
   1.351 +     else if (shape == 'controlpath')
   1.352 +    {
   1.353 +    var point='M '+left+','+top+' L '+(left+1)+','+(top+1)+'z'  // 4th
   1.354 +    svg = this.container.ownerDocument.createElementNS(svgNamespace, 'path');   
   1.355 +    //svg.setAttributeNS(null, 'd', 'M '+thispath+' C'+thispath);
   1.356 +    svg.setAttributeNS(null, 'd', point);  	
   1.357 +    svg.setAttributeNS(null,'transform', "translate(0,0)"); 
   1.358 +    svg.style.position = 'absolute';  
   1.359 +    } 
   1.360 +  else if (shape == 'text') 
   1.361 +   {
   1.362 +    var data = this.container.ownerDocument.createTextNode(textMessaje);
   1.363 +    svg = this.container.ownerDocument.createElementNS(svgNamespace, 'text');
   1.364 +    svg.setAttributeNS(null, 'x', parseFloat(left) + 'px');
   1.365 +    svg.setAttributeNS(null, 'y', parseFloat(top) + 'px');
   1.366 +    svg.setAttributeNS(null, 'font-family', textFamily );
   1.367 +    svg.setAttributeNS(null, 'font-size', parseFloat(textSize)); 
   1.368 +    svg.style.position = 'absolute';  
   1.369 +    svg.appendChild(data);   
   1.370 +   } 
   1.371 +    else if (shape == 'clipPath') 
   1.372 +   {
   1.373 +    svg = this.container.ownerDocument.createElementNS(svgNamespace, 'clipPath');
   1.374 +   }    
   1.375 +    else if (shape == 'filter') 
   1.376 +   {
   1.377 +    svg = this.container.ownerDocument.createElementNS(svgNamespace, 'filter');
   1.378 +   }  
   1.379 +    else if (shape == 'feGaussianBlur') 
   1.380 +   {
   1.381 +    svg = this.container.ownerDocument.createElementNS(svgNamespace, 'filter');
   1.382 +    svg.setAttributeNS(null, 'in','SourceGraphic');
   1.383 +    svg.setAttributeNS(null, 'stdDeviation',parseFloat(left));
   1.384 +   }  
   1.385 +    else if (shape == 'linearGradient') 
   1.386 +   {
   1.387 +    svg = this.container.ownerDocument.createElementNS(svgNamespace, 'linearGradient');
   1.388 +    svg.setAttributeNS(null, 'x1', left);
   1.389 +    svg.setAttributeNS(null, 'y1', top);
   1.390 +    svg.setAttributeNS(null, 'x2', width); 
   1.391 +    svg.setAttributeNS(null, 'y2', height);  
   1.392 +    svg.setAttributeNS(null, 'gradientUnits',textMessaje);//"userSpaceOnUse" 
   1.393 +    svg.setAttributeNS(xlinkNS,'href', imageHref);
   1.394 +  
   1.395 + }  
   1.396 + else if (shape == 'radialGradient') {
   1.397 +    svg = this.container.ownerDocument.createElementNS(svgNamespace, 'radialGradient');
   1.398 +    svg.setAttributeNS(null, 'gradientUnits',textMessaje);//"userSpaceOnUse" 
   1.399 +    svg.setAttributeNS(null, 'cx', left);
   1.400 +    svg.setAttributeNS(null, 'cy', top );
   1.401 +    svg.setAttributeNS(null, 'fx', width);
   1.402 +    svg.setAttributeNS(null, 'fy', height);  
   1.403 +    svg.setAttributeNS(null, 'r', lineWidth);     
   1.404 +    svg.setAttributeNS(xlinkNS,'href', imageHref);
   1.405 + }   
   1.406 + else if (shape == 'stop') {
   1.407 +    svg = this.container.ownerDocument.createElementNS(svgNamespace, 'stop');
   1.408 +    svg.setAttributeNS(null, 'stop-color', fillColor);
   1.409 +    svg.setAttributeNS(null, 'stop-opacity', fillOpac);
   1.410 +    svg.setAttributeNS(null, 'offset', lineOpac);  
   1.411 + } 
   1.412 +  else if (shape == 'defs') {
   1.413 +    svg = this.container.ownerDocument.createElementNS(svgNamespace, 'defs');
   1.414 +    //svg.setAttributeNS(null, 'id', 'defs');
   1.415 + } 
   1.416 +  else if (shape == 'group') {
   1.417 +    svg = this.container.ownerDocument.createElementNS(svgNamespace, 'g');
   1.418 +    svg.setAttributeNS(null, 'x', left + 'px');
   1.419 +    svg.setAttributeNS(null, 'y', top + 'px');
   1.420 +    svg.setAttributeNS(null, 'width', width + 'px');
   1.421 +    svg.setAttributeNS(null, 'height', height + 'px');  
   1.422 +    svg.setAttributeNS(null, 'fill-opacity', parseFloat(fillOpac));  
   1.423 +    svg.setAttributeNS(null, 'fill', fillColor);
   1.424 + //} 
   1.425 +
   1.426 +  //else if (shape == 'linearGradient') {
   1.427 +    //return false
   1.428 + } 
   1.429 + else if (shape == 'pattern') {
   1.430 +    svg = this.container.ownerDocument.createElementNS(svgNamespace, 'pattern');
   1.431 +    svg.setAttributeNS(null, 'x', left);
   1.432 +    svg.setAttributeNS(null, 'y', top);
   1.433 +    svg.setAttributeNS(null, 'width', width );
   1.434 +    svg.setAttributeNS(null, 'height', height);  
   1.435 +    svg.setAttributeNS(null, 'viewBox', viewBox);  
   1.436 +    svg.setAttributeNS(null, 'patternUnits', 'userSpaceOnUse');
   1.437 + 
   1.438 + } 
   1.439 +  else if (shape == 'use') { 
   1.440 +    var svg = this.container.ownerDocument.createElementNS(svgNamespace, 'use');
   1.441 +    svg.setAttributeNS(xlinkNS,'xlink:href', imageHref);
   1.442 + } 
   1.443 + else if (shape == 'image') { 
   1.444 +   /* svg = this.container.ownerDocument.createElementNS(svgNamespace, 'g');
   1.445 +    svg.setAttributeNS(null, 'x', left + 'px');
   1.446 +    svg.setAttributeNS(null, 'y', top + 'px');
   1.447 +    svg.setAttributeNS(null, 'width', width + 'px');
   1.448 +    svg.setAttributeNS(null, 'height', height + 'px');  
   1.449 +    */
   1.450 +    var svg = this.container.ownerDocument.createElementNS(svgNamespace, 'image');
   1.451 +    svg.setAttributeNS(xlinkNS,'href', imageHref);
   1.452 +    svg.setAttributeNS(null, 'x', left  + 'px');
   1.453 +    svg.setAttributeNS(null, 'y', top + 'px');
   1.454 +    svg.setAttributeNS(null, 'width', width + 'px');
   1.455 +    svg.setAttributeNS(null, 'height', height + 'px');  
   1.456 +    svg.setAttributeNS(null, 'opacity', parseFloat(fillOpac));
   1.457 +    svg.setAttributeNS(null, 'preserveAspectRatio','none');//xMinYMin slice  
   1.458 +    //svg.setAttributeNS(null, 'viewbox', left+' '+top+' '+width+' '+height); 
   1.459 +    //Ext.get(this.container).removeAllListeners(isvg)   
   1.460 +    //svg.appendChild(isvg);
   1.461 +    /* 
   1.462 +    var rsvg = this.container.ownerDocument.createElementNS(svgNamespace, 'rect');
   1.463 +    rsvg.setAttributeNS(null, 'x', left + 'px');
   1.464 +    rsvg.setAttributeNS(null, 'y', top + 'px');
   1.465 +    rsvg.setAttributeNS(null, 'width', width + 'px');
   1.466 +    rsvg.setAttributeNS(null, 'height', height + 'px');  
   1.467 +    rsvg.style.fill = fillColor;  
   1.468 +    rsvg.style.stroke = lineColor;  
   1.469 +    rsvg.style.strokeWidth = lineWidth; 
   1.470 +    rsvg.setAttributeNS(null, 'opacity', '0.1');
   1.471 +    rsvg.style.strokOpacity = lineOpac;
   1.472 +    // Ext.get(this.container).removeAllListeners(rsvg)
   1.473 +     svg.appendChild(rsvg);   
   1.474 +
   1.475 +     */
   1.476 +    //svg.setAttributeNS(null, 'color-rendering', fillColor);   
   1.477 +    //svg.setAttributeNS(null, 'display', 'inherit'); 
   1.478 +    
   1.479 +      //alert(fillOpac+'lkjlkj'); 
   1.480 +    //svg.setAttributeNS(null, 'fill-opacity', parseFloat(fillOpac));
   1.481 +
   1.482 +    /* if (fillColor.length == 0){fillColor = 'none';}
   1.483 +    if (lineColor.length == 0){lineColor = 'none';}
   1.484 +    svg.style.fill = fillColor;  
   1.485 +    svg.style.stroke = lineColor;  
   1.486 +    svg.style.strokeWidth = lineWidth; 
   1.487 +    svg.style.fillOpacity = fillOpac;
   1.488 +    svg.style.strokOpacity = lineOpac;
   1.489 +     svg.style.setAttributeNS(null, 'fill', fillColor);
   1.490 +          svg.style.setAttributeNS(null, 'stroke', lineColor);
   1.491 +          svg.style.setAttributeNS(null, 'stroke-width', lineWidth);
   1.492 +          svg.style.setAttributeNS(null, 'fill-opacity', fillOpac);  
   1.493 +          svg.style.setAttributeNS(null, 'stroke-opacity',lineOpac);
   1.494 +    
   1.495 +   */
   1.496 + } 
   1.497 + 
   1.498 + if(shape == 'zoom') 
   1.499 +  {
   1.500 +        
   1.501 +  }else
   1.502 +  {                                          
   1.503 +       if(transform!='')
   1.504 +        {
   1.505 +         svg.setAttributeNS(null, 'transform', transform);      
   1.506 +        }
   1.507 +        
   1.508 +             var render=true;
   1.509 +        if(shape.indexOf('image')>=0){render=false;}
   1.510 +        //if(shape.indexOf('group')>=0){render=false;}
   1.511 +        if(shape.indexOf('linearGradient')>=0){render=false;}
   1.512 +        if(shape.indexOf('radialGradient')>=0){render=false;}
   1.513 +        if(shape.indexOf('stop')>=0){render=false;}  
   1.514 +        if(shape.indexOf('def')>=0){render=false;}
   1.515 +        if(shape.indexOf('filter')>=0){render=false;}
   1.516 +        if(shape.indexOf('feGaussianBlur')>=0){render=false;}
   1.517 +       
   1.518 +        
   1.519 +          
   1.520 +        //|| shape != 'group'
   1.521 +       //if(shape != 'image'  || shape != 'stop' || shape != 'def')
   1.522 +        if(render==true) 
   1.523 +        { 
   1.524 +                                                               
   1.525 +           //var set = this.container.ownerDocument.createElementNS(svgNamespace, "style");
   1.526 +            
   1.527 +           if (lineColor.length == 0){lineColor = 'none';} 
   1.528 +           if (fillColor.length == 0){fillColor = 'none';} 
   1.529 +           //if (lineWidth == NaN || lineWidth == 0 ){lineColor = '#000000';} 
   1.530 +           
   1.531 +
   1.532 +          // set.setAttributeNS(null, 'stroke', lineColor);
   1.533 +          //set.setAttributeNS(null, 'stroke-width', lineWidth);
   1.534 +          //set.setAttributeNS(null, 'fill-opacity', fillOpac);  
   1.535 +          //set.setAttributeNS(null, 'stroke-opacity',lineOpac);
   1.536 +            //svg.appendChild(set);
   1.537 +           //svg.setAttributeNS(null, "style","fill:"+ fillColor+";stroke:"+lineColor+";strokeWidth:"+lineWidth+";fill-opacity:"+fillOpac+";stroke-opacity:"+lineOpac);  
   1.538 +           //   
   1.539 +           (fillColor!=''|| fillColor!=null )?svg.setAttributeNS(null, 'fill', fillColor):svg.setAttributeNS(null, 'fill', '#000000');
   1.540 +          
   1.541 +          //svg.setAttributeNS(null, 'filter', filter);
   1.542 +          svg.setAttributeNS(null, 'stroke', lineColor);
   1.543 +          svg.setAttributeNS(null, 'stroke-width', parseFloat(lineWidth));
   1.544 +          svg.setAttributeNS(null, 'fill-opacity', parseFloat(fillOpac));  
   1.545 +          svg.setAttributeNS(null, 'stroke-opacity',parseFloat(lineOpac));
   1.546 +          svg.setAttributeNS(null, 'stroke-linejoin','round')         
   1.547 +      
   1.548 +          /*     
   1.549 +          <a xlink:href="http://www.w3.org">
   1.550 +                <ellipse cx="2.5" cy="1.5" rx="2" ry="1"  fill="red" />
   1.551 +          </a>
   1.552 +          svg.style.stroke = lineColor;  
   1.553 +           svg.style.strokeWidth = lineWidth; 
   1.554 +           svg.style.fillOpacity = fillOpac;
   1.555 +           svg.style.strokOpacity = lineOpac;   
   1.556 +          if (fillColor.length == 0){fillColor = 'none';}
   1.557 +          
   1.558 +          if (lineColor.length == 0){lineColor = 'none';}
   1.559 +          */
   1.560 +         }   
   1.561 +         
   1.562 +         
   1.563 +     if(parent==''){
   1.564 +       this.svgRoot.appendChild(svg);
   1.565 +     }else{  
   1.566 +       if(document.getElementById(parent)){   
   1.567 +         var parentShape = document.getElementById(parent);
   1.568 +         parentShape.appendChild(svg);
   1.569 +        } 
   1.570 +     }   
   1.571 +
   1.572 +
   1.573 +          return svg;   
   1.574 +             
   1.575 +   }        
   1.576 +  
   1.577 +};   
   1.578 +
   1.579 +
   1.580 +
   1.581 +SVGRenderer.prototype.zoomFrame = function(zoom){
   1.582 +   this.svgRoot.setAttributeNS(null,'viewBox', zoom);
   1.583 +
   1.584 + 
   1.585 +}
   1.586 +SVGRenderer.prototype.zoom = function(clicx,clicy){ 
   1.587 +/* 
   1.588 +function(direction, amount) { 
   1.589 +var viewBox = this.rootNode.getAttribute('viewBox');
   1.590 +    var viewVals = viewBox.split(' ');
   1.591 +    if (amount == null) {
   1.592 +        amount = SVGElement.panFactor;
   1.593 +    }
   1.594 +    switch (direction) {
   1.595 +        case 'left':
   1.596 +            amount = 0 - amount;
   1.597 +            // intentionally fall through
   1.598 +        case 'right':
   1.599 +            var currentPosition = parseFloat(viewVals[0]);
   1.600 +            currentPosition += amount;
   1.601 +            viewVals[0] = currentPosition;
   1.602 +            break;
   1.603 +        case 'up':
   1.604 +            amount = 0 - amount;
   1.605 +            // intentionally fall through
   1.606 +        case 'down':
   1.607 +            var currentPosition = parseFloat(viewVals[1]);
   1.608 +            currentPosition += amount;
   1.609 +            viewVals[1] = currentPosition;
   1.610 +            break;
   1.611 +        case 'origin':
   1.612 +            // reset everything to initial values
   1.613 +            viewVals[0] = 0;
   1.614 +            viewVals[1] = 0;
   1.615 +            this.rootNode.currentScale = 1;
   1.616 +            this.rootNode.currentTranslate.x = 0;
   1.617 +            this.rootNode.currentTranslate.y = 0;
   1.618 +            break;
   1.619 +    }
   1.620 +    this.rootNode.setAttribute('viewBox', viewVals.join(' '));        
   1.621 + */
   1.622 + 
   1.623 +      
   1.624 +      
   1.625 +      //canvasWidth
   1.626 +      //canvasheight
   1.627 +   if(zoommode=='frame')
   1.628 +    {   
   1.629 +       var viewBox = this.svgRoot.getAttributeNS(null,'viewBox'); 
   1.630 +     
   1.631 +       //alert(viewBox);
   1.632 +      
   1.633 +       var viewBox = zoominit;  
   1.634 +       var viewVals = viewBox.split(' ');
   1.635 +       
   1.636 +       zoomx = parseFloat(viewVals[0]); 
   1.637 +       zoomy = parseFloat(viewVals[1]);  
   1.638 +       zoomw = parseFloat(viewVals[2]); 
   1.639 +       zoomh = parseFloat(viewVals[3]);    
   1.640 +       proporDiagonal=1;
   1.641 +    }
   1.642 +     else
   1.643 +    {   
   1.644 +       
   1.645 +       var viewBox = this.svgRoot.getAttributeNS(null,'viewBox'); 
   1.646 +      
   1.647 +       var viewVals = viewBox.split(' ');
   1.648 +       var prevX = parseFloat(viewVals[0]); 
   1.649 +       var prevY = parseFloat(viewVals[1]);  
   1.650 +       var prevW = parseFloat(viewVals[2]); 
   1.651 +       var prevH = parseFloat(viewVals[3]); 
   1.652 +       var prevWidth=prevW-prevX;  
   1.653 +       var prevHeight=prevH-prevY;   
   1.654 +        
   1.655 +    }
   1.656 +   
   1.657 +      if(zoommode=='more')
   1.658 +       {             
   1.659 +        fieldViewx=prevW*0.95; 
   1.660 +        fieldViewy=prevH*0.95;  
   1.661 +        diagonalFrame=dist2p(0,0,fieldViewx,fieldViewy);
   1.662 +        //diagonalAngle=getAngle(fieldViewx,fieldViewy);                                  
   1.663 +        zoomx=(diagonalMidx+(diagonalFrame/2)*Math.cos(diagonalAngle+Math.PI));//-(fieldViewx/8);//-(canvasW/2)docx-fieldViewx;
   1.664 +        zoomy=(diagonalMidy+(diagonalFrame/2)*Math.sin(diagonalAngle+Math.PI));//-(fieldViewy/8);//-(canvasH/2);//docy-fieldViewy;
   1.665 +       zoomw=prevW*0.95;
   1.666 +       zoomh=prevH*0.95;    
   1.667 +                            
   1.668 +     
   1.669 +        proporDiagonal=diagonalFrame/diagonalinit; 
   1.670 +        //alert(proporDiagonal);
   1.671 +       }
   1.672 +      if(zoommode=='minus') 
   1.673 +       {
   1.674 +        fieldViewx=prevW*1.05; 
   1.675 +        fieldViewy=prevH*1.05;  
   1.676 +        diagonalFrame=dist2p(0,0,fieldViewx,fieldViewy);
   1.677 +       //diagonalAngle=getAngle(fieldViewx,fieldViewy);                                  
   1.678 +        zoomx=(diagonalMidx+(diagonalFrame/2)*Math.cos(diagonalAngle+Math.PI));//-(fieldViewx/8);//-(canvasW/2)docx-fieldViewx;
   1.679 +        zoomy=(diagonalMidy+(diagonalFrame/2)*Math.sin(diagonalAngle+Math.PI));//-(fieldViewy/8);//-(canvasH/2);//docy-fieldViewy;
   1.680 +        zoomw=prevW*1.05;
   1.681 +        zoomh=prevH*1.05; 
   1.682 +        proporDiagonal=diagonalFrame/diagonalinit;  
   1.683 +
   1.684 +       } 
   1.685 +      if(zoommode=='window')
   1.686 +       {             
   1.687 +          
   1.688 +        zoomx=c.mouseDownX;
   1.689 +        zoomy=c.mouseDownY; 
   1.690 +        var dF=dist2p(c.mouseDownX,c.mouseDownY,clicx,clicy);
   1.691 +        //var mid=pmd2pb(c.clicX,c.clicX,clicx,clicy,0.5)
   1.692 +        zoomw=dF*proporDoc;//(mid[1]+(dF/2)*Math.cos(diagonalAngle+Math.PI));
   1.693 +        zoomh=dF;//(mid[2]+(dF/2)*Math.sin(diagonalAngle+Math.PI));
   1.694 +    
   1.695 +        
   1.696 +       }      
   1.697 +       var direction=0;
   1.698 +      if(zoommode=='hand') 
   1.699 +       {        
   1.700 +        direction=ang2v(clicx,clicy,centerZoomx,centerZoomy);
   1.701 +        var distance=dist2p(clicx,clicy,centerZoomx,centerZoomy);
   1.702 +        var left = prevX+distance*Math.cos(direction); 
   1.703 +        var top = prevY+distance*Math.sin(direction); 
   1.704 +        makeWorkSite(prevH,left,top); 
   1.705 +       }
   1.706 +       direction=direction*180/Math.PI;
   1.707 +        //this.svgRoot.currentScale = zoomscale+0.1;
   1.708 +        //this.svgRoot.currentTranslate.x = 0;
   1.709 +        //this.svgRoot.currentTranslate.y = 0; 
   1.710 +        //var resultPosx=clicx-((prevscalex-posx)/2);//-Math.abs(posx+clicx)
   1.711 +        //var resultPosy=clicy-((prevscalex-posy)/2);//-Math.abs(posy+clicy)
   1.712 +        //var resultPosx=-Math.abs(posx+clicx);
   1.713 +        //var resultPosy=-Math.abs(posy+clicy);        
   1.714 +
   1.715 +  this.svgRoot.setAttributeNS(null,'viewBox', (zoomx)+' '+(zoomy)+' '+zoomw+' '+zoomh+'');
   1.716 +  var viewBox = this.svgRoot.getAttributeNS(null,'viewBox'); 
   1.717 +  //$('status').innerHTML=' '+viewBox; 
   1.718 +  //alert(direction+'__'+prevZoomCenterx+' '+prevZoomCentery+' '+centerZoomx+' '+centerZoomy);
   1.719 +}  
   1.720 +
   1.721 +//this.mode, this.fillColor, this.lineColor, this.fillOpac, this.lineOpac, this.lineWidth, this.mouseDownX, this.mouseDownY, 1, 1,'',''
   1.722 +SVGRenderer.prototype.datacreate = function(fillColor, lineColor, fillOpac, lineOpac, lineWidth, left, top, width, height, textMessaje, textSize, textFamily, imageHref, transform) {
   1.723 +  var svgNamespace = 'http://www.w3.org/2000/svg';
   1.724 +  var svg;
   1.725 +  svg = this.container.ownerDocument.createElementNS(svgNamespace, 'path');   
   1.726 +  svg.setAttributeNS(null, 'd', data);  	
   1.727 +  svg.setAttributeNS(null,'transform', "translate(0,0)"); 
   1.728 +  svg.style.position = 'absolute';  
   1.729 +  if (fillColor.length == 0){fillColor = 'none';}
   1.730 +  svg.setAttributeNS(null, 'fill', fillColor);
   1.731 +  if (lineColor.length == 0){lineColor = 'none';}
   1.732 +  svg.setAttributeNS(null, 'stroke', lineColor);
   1.733 +  svg.setAttributeNS(null, 'stroke-width', lineWidth); 
   1.734 +  this.svgRoot.appendChild(svg);
   1.735 +  return svg;
   1.736 +};
   1.737 +
   1.738 +SVGRenderer.prototype.querySelected = function(shape,centerx,centery,width,height)
   1.739 +{ 
   1.740 + var result = true;
   1.741 +  var shapes='names: g, image, rect, path, ellipse, circle, text, line, ';
   1.742 +
   1.743 + //if(shape.getBBox && shape) 
   1.744 +  if( shapes.indexOf(' '+shape.tagName+',')>0)
   1.745 +  {
   1.746 + 
   1.747 +  var box = shape.getBBox();
   1.748 + }else
   1.749 + {
   1.750 +  return false;
   1.751 + }
   1.752 + var p1x = box.x;
   1.753 +  if(Math.abs(p1x-centerx)>width){result = false}
   1.754 + 
   1.755 + var p1y = box.y;
   1.756 + if(Math.abs(p1y-centery)>height){result = false}
   1.757 + 
   1.758 + var p2x = box.x+box.width;
   1.759 + if(Math.abs(p2x-centerx)>width){result = false}
   1.760 +
   1.761 + var p2y = box.y;
   1.762 + if(Math.abs(p2y-centery)>height){result = false}
   1.763 + 
   1.764 + var p3x = box.x+box.width;
   1.765 + if(Math.abs(p3x-centerx)>width){result = false}
   1.766 +
   1.767 + var p3y = box.y+box.height;                    
   1.768 + if(Math.abs(p3y-centery)>height){result = false}
   1.769 +  
   1.770 + var p4x = box.x;
   1.771 +if(Math.abs(p4x-centerx)>width){result = false}
   1.772 + 
   1.773 + var p4y = box.y+box.height;
   1.774 + if(Math.abs(p4y-centery)>height){result = false}
   1.775 + 
   1.776 + if(result)
   1.777 +  {
   1.778 +    return { 'in':result, 'cornersx': p1x+','+p2x+','+p3x+','+p4x+',' ,'cornersy': p1y+','+p2y+','+p3y+','+p4y+',' };
   1.779 +  }
   1.780 +   else
   1.781 +  { 
   1.782 +     return { 'in':result } 
   1.783 +  }
   1.784 +//center.distanceFrom(point1);
   1.785 + 
   1.786 +
   1.787 +}
   1.788 +
   1.789 +SVGRenderer.prototype.searchBoxes = function()
   1.790 +{  
   1.791 + var base = this.svgRoot;
   1.792 +
   1.793 + var  NumNodes = base.childNodes.length;
   1.794 + var chain= '';
   1.795 + for(i = 0;i < NumNodes;i++)
   1.796 +  {       
   1.797 +     if (base.childNodes[i].getBBox)
   1.798 +      {
   1.799 +        chain+=base.childNodes[i].id + ';'
   1.800 +      }
   1.801 +  }
   1.802 +  chain+=''
   1.803 +  return chain;
   1.804 +
   1.805 +}  
   1.806 +
   1.807 +SVGRenderer.prototype.DrawBorder= function(numNode, targetElement )
   1.808 +{   
   1.809 +  var shapes='names: g, image, rect, path, ellipse, circle, text, line, ';
   1.810 +
   1.811 + //if(shape.getBBox && shape) 
   1.812 +  if( shapes.indexOf(' '+targetElement.tagName+',')>0)
   1.813 +  {
   1.814 +   var bbox = targetElement.getBBox();
   1.815 +   var svgns = 'http://www.w3.org/2000/svg';
   1.816 +
   1.817 +   var outline = this.container.ownerDocument.createElementNS(svgns, 'rect');
   1.818 +   outline.setAttributeNS( null, 'x', bbox.x - 2 );
   1.819 +   outline.setAttributeNS( null, 'y', bbox.y - 2 );
   1.820 +   outline.setAttributeNS( null, 'width',  bbox.width + 4 );
   1.821 +   outline.setAttributeNS( null, 'height', bbox.height + 4 );
   1.822 +   outline.setAttributeNS( null, 'stroke', '#ff00ff' );
   1.823 +   outline.setAttributeNS( null, 'fill', 'none' );
   1.824 +   outline.setAttributeNS( null, 'id', 'shapeBoxed'+numNode );
   1.825 +
   1.826 +   targetElement.parentNode.insertBefore( outline, targetElement );
   1.827 +   return 'shapeBoxed'+numNode; 
   1.828 +  } 
   1.829 +   else 
   1.830 +  {
   1.831 +   return false
   1.832 +  }
   1.833 +}
   1.834 +
   1.835 +SVGRenderer.prototype.index = function(shape,order) {  
   1.836 + 
   1.837 +     if(order==-1)
   1.838 +      {
   1.839 +        this.svgRoot.appendChild( shape );
   1.840 +      }
   1.841 +      if(order==0){
   1.842 +     
   1.843 +         this.svgRoot.insertBefore( shape, shape.parentNode.firstChild );
   1.844 +      } 
   1.845 + 
   1.846 +   if(order==1 || order==2)
   1.847 +    {
   1.848 +         var id=shape.getAttributeNS(null, 'id');
   1.849 +        //alert(id);
   1.850 +        
   1.851 +        
   1.852 +        var numNodes=this.svgRoot.childNodes.length;
   1.853 +        //alert(numNodes);
   1.854 +          
   1.855 +        var num=0;
   1.856 +        for(var i = 1; i < numNodes; i++)
   1.857 +         {                                                   
   1.858 +           
   1.859 +           var etiq=this.svgRoot.childNodes[i].getAttributeNS(null, 'id');
   1.860 +           if (etiq==id)
   1.861 +            { 
   1.862 +                num=i; 
   1.863 +               
   1.864 +            }                                                    
   1.865 +          } 
   1.866 +          //alert(num);    
   1.867 +          if(order==1) 
   1.868 +           {   
   1.869 +              if((num-1)>=-1)
   1.870 +               {  
   1.871 +                this.svgRoot.insertBefore( shape, this.svgRoot.childNodes[num-1]);
   1.872 +               } 
   1.873 +           }
   1.874 +          if(order==2){ 
   1.875 +               if((num+1)<numNodes)
   1.876 +               {
   1.877 +                  this.svgRoot.insertBefore( shape, this.svgRoot.childNodes[num+2]);
   1.878 +               }
   1.879 +          } 
   1.880 +          
   1.881 +    } 
   1.882 +    
   1.883 +    
   1.884 +   /*var contshapes =  shape.parentNode.childNodes.length;       
   1.885 +   var elem1 = shape;//this.svgRoot.childNodes[1]; 
   1.886 +   var elem2 = shape.parentNode.childNodes[parseInt(contshapes-9)];
   1.887 +    var tmp = elem1.cloneNode( true );
   1.888 +    shape.parentNode.replaceChild( tmp, elem2 );
   1.889 +    shape.parentNode.replaceChild( elem2, elem1 ); 
   1.890 +    */
   1.891 +    //alert(elem2+' '+ elem1 ) 
   1.892 +    //return  elem2;
   1.893 +    
   1.894 +}
   1.895 +SVGRenderer.prototype.remove = function(shape) {
   1.896 +  //shape.parentNode.removeChild(shape);
   1.897 +  this.svgRoot.removeChild(shape);
   1.898 +}
   1.899 +
   1.900 +
   1.901 +SVGRenderer.prototype.copy = function(shape) 
   1.902 + {
   1.903 +   var svg;
   1.904 +   svg =shape.cloneNode(false); 
   1.905 +     if(shape.tagName=="text"){  
   1.906 +        var text=shape.textContent ; 
   1.907 +        svg.textContent=text;     
   1.908 +     } 
   1.909 +    //svg.setAttributeNS(null, 'fill', "#aa00aa");
   1.910 +   return svg;
   1.911 + };
   1.912 +
   1.913 +
   1.914 +SVGRenderer.prototype.paste = function(clipboard,left,top) 
   1.915 + {
   1.916 +   //var svg;
   1.917 +   //svg =shape;
   1.918 +   //clipboard.setAttributeNS(null, 'fill', "#0000aa");
   1.919 +   //clipboard.setAttributeNS(null,'transform', "translate("+left+","+top+")"); 
   1.920 +   this.svgRoot.appendChild(clipboard);
   1.921 +  return clipboard;
   1.922 + };
   1.923 +
   1.924 +
   1.925 +SVGRenderer.prototype.duplicate = function(shape) 
   1.926 + {
   1.927 +   var svg;
   1.928 +   svg =shape.cloneNode(false);
   1.929 +   //svg.setAttributeNS(null, 'fill', "#aa00aa");
   1.930 +   this.svgRoot.appendChild(svg);
   1.931 +  return svg;
   1.932 + };
   1.933 +
   1.934 +SVGRenderer.prototype.undo = function() 
   1.935 + {
   1.936 +  this.svgRoot.removeChild( this.svgRoot.lastChild );
   1.937 + };
   1.938 + 
   1.939 + /* 
   1.940 + function zSwap(parent, elem1, elem2)
   1.941 +{
   1.942 +   var tmp = elem1.cloneNode( true );
   1.943 +   parent.replaceChild( tmp, elem2 );
   1.944 +   parent.replaceChild( elem2, elem1 );
   1.945 +}
   1.946 +
   1.947 +SVGRenderer.prototype.moveToTop( svgNode )
   1.948 +{
   1.949 +   this.svgRoot.appendChild( svgNode );
   1.950 +}
   1.951 +
   1.952 +
   1.953 +SVGRenderer.prototype.moveToBottom( svgNode )
   1.954 +{
   1.955 +   this.svgRoot.insertBefore( svgNode, svgNode.parentNode.firstChild );
   1.956 +}
   1.957 +
   1.958 +*/
   1.959 +
   1.960 +
   1.961 +
   1.962 +
   1.963 +     
   1.964 +var xshe=0; //bad
   1.965 +var yshe=0;  
   1.966 +var isArc=false;
   1.967 +var contArc=0;    
   1.968 +
   1.969 +SVGRenderer.prototype.move = function(shape, left, top, fromX,fromY) {  
   1.970 + //typeTransform='Translate';   
   1.971 + 
   1.972 + var box = shape.getBBox(); 
   1.973 + var angle=0;
   1.974 + var dist=0;  
   1.975 + var rotated=false;
   1.976 +
   1.977 +  if (shape.hasAttributeNS(null,'transform')) {  
   1.978 +    var tran=shape.getAttributeNS(null, 'transform'); 
   1.979 +    var rot=''; 
   1.980 +    var scl=''; 
   1.981 +    var angle=0;
   1.982 +    if(tran.indexOf('rotate')!=-1)
   1.983 +     { 
   1.984 +      if(tran.indexOf('scale')!=-1)
   1.985 +      {
   1.986 +       var chain2=tran.split('),');
   1.987 +       rot= GetString(chain2[0], 'rotate(', ',');
   1.988 +       angle=parseFloat(rot);
   1.989 +       scl= GetString(tran, 'scale(', ')');
   1.990 +      }else{
   1.991 +       var chain2=tran.split(',');  
   1.992 +       var rot0=chain2[0].split('rotate(');
   1.993 +       rot='good';
   1.994 +       angle=parseFloat(rot0[1]);
   1.995 +       scl='';                  
   1.996 +       
   1.997 +      }
   1.998 +     }else{
   1.999 +      if(tran.indexOf('scale')!=-1)
  1.1000 +       {
  1.1001 +        scl= GetString(tran, 'scale(', ')'); 
  1.1002 +        angle=0; 
  1.1003 +       }else{   
  1.1004 +         //
  1.1005 +       }
  1.1006 +     }
  1.1007 +    
  1.1008 +    //var h=shape.getAttributeNS(null, SVG_TRANSFORM_ROTATE ); 
  1.1009 +   
  1.1010 +    var centerx=box.x+(box.width/2);
  1.1011 +    var centery=box.y+(box.height/2);        
  1.1012 +    var cadRot='';                              
  1.1013 +    var cadScale=''; 
  1.1014 +    var union='';
  1.1015 +    if(angle!=0)
  1.1016 +     {   
  1.1017 +      cadRot='rotate('+(angle)+', '+centerx+', '+centery+')';
  1.1018 +     }
  1.1019 +    if(scl.length>2)
  1.1020 +     {
  1.1021 +      if(rot.length>2){ union=',';}
  1.1022 +      cadScale='scale('+scl+')';
  1.1023 +      if(scl.indexOf('-')!=-1)
  1.1024 +       {  
  1.1025 +          var dist= dist2p(left,top,box.x,box.y);
  1.1026 +           
  1.1027 +          left=left;  
  1.1028 +        }  
  1.1029 +       if(scl.indexOf(',-')!=-1 || scl.indexOf(', -')!=-1 )
  1.1030 +         {
  1.1031 +             //top=eval('-'+top);  
  1.1032 +            var dist= dist2p(left,top,box.x,box.y);
  1.1033 +            top=top; 
  1.1034 +        }
  1.1035 +        
  1.1036 +      }
  1.1037 +    //shape.setAttributeNS(null,'transform', 'rotate('+(angle)+', '+centerx+', '+centery+')'); 
  1.1038 +    shape.setAttributeNS(null,'transform', cadRot+union+cadScale);  
  1.1039 +   
  1.1040 +    //var angleRad=angle*Math.PI/180; 
  1.1041 +   
  1.1042 +   
  1.1043 +      
  1.1044 +   //dist=dist2p(x,y,left, top) ;
  1.1045 +   rotated=true;
  1.1046 +   
  1.1047 + }
  1.1048 +  //left=left-box.x;   
  1.1049 +  //top=top-box.y;  
  1.1050 +  //left = centerx-left;
  1.1051 +  //top = centery-top;  
  1.1052 +
  1.1053 +  contmove++;
  1.1054 +
  1.1055 +  if (shape.tagName == 'rect'){ 
  1.1056 +  /* var dudy= shape.parentNode;  
  1.1057 +   if(dudy.tagName=='g'){
  1.1058 +      document.forms[0].code.value= 'this g ============ '; 
  1.1059 +           shape.setAttributeNS(null, 'x', left);
  1.1060 +           shape.setAttributeNS(null, 'y', top); 
  1.1061 + 
  1.1062 +           dudy.setAttributeNS(null, 'x', left);
  1.1063 +           dudy.setAttributeNS(null, 'y', top); 
  1.1064 +           dudy.childNodes[0].setAttributeNS(null, 'x', left);
  1.1065 +           dudy.childNodes[0].setAttributeNS(null, 'y', top);
  1.1066 +           
  1.1067 +    }else{
  1.1068 +     //document.forms[0].code.value= box.x+' '+box.y+' formX  Y'+ fromX+'_'+fromY+'  left '+left+'_'+top+'==============';     
  1.1069 +     //document.forms[0].code.value+= tran+' rot '+ angle+'_'+x+'_'+y+' dist '+dist;   
  1.1070 +     if(rotated){
  1.1071 +          //shape.setAttributeNS(null, 'x', box.x*Math.cos(angleRad)) ;
  1.1072 +         //shape.setAttributeNS(null, 'y', box.y*Math.sin(angleRad)) ;  
  1.1073 +           shape.setAttributeNS(null, 'x', left);
  1.1074 +           shape.setAttributeNS(null, 'y', top); 
  1.1075 +  
  1.1076 +
  1.1077 +     }else{ 
  1.1078 +     */
  1.1079 +      shape.setAttributeNS(null, 'x', left);
  1.1080 +      shape.setAttributeNS(null, 'y', top); 
  1.1081 +     //}
  1.1082 +    //$('option_rect_trx').value= left;  
  1.1083 +    //$('option_rect_try').value= top;    
  1.1084 +       // var h=shape.getAttributeNS(null, 'height');   
  1.1085 +       //var w=shape.getAttributeNS(null, 'width'); 
  1.1086 +       //document.forms[0].code.value= h+' '+w;
  1.1087 +   //}    
  1.1088 +  } 
  1.1089 +  if (shape.tagName == 'g')
  1.1090 +   { 
  1.1091 +   //this.editor.log(shape.tagName+' ==============');  
  1.1092 +   
  1.1093 +    shape.setAttributeNS(null, 'x', left);
  1.1094 +    shape.setAttributeNS(null, 'y', top);
  1.1095 +    shape.childNodes[0].setAttributeNS(null, 'x', left + 'px');
  1.1096 +    shape.childNodes[0].setAttributeNS(null, 'y', top + 'px');
  1.1097 +    shape.childNodes[1].setAttributeNS(null, 'x', left + 'px');
  1.1098 +    shape.childNodes[1].setAttributeNS(null, 'y', top + 'px');
  1.1099 +    
  1.1100 +   }
  1.1101 +  if (shape.tagName == 'image'){
  1.1102 +    shape.setAttributeNS(null, 'x',left + 'px');
  1.1103 +    shape.setAttributeNS(null, 'y', top  + 'px');
  1.1104 +    //$('option_img_trx').value= left;  
  1.1105 +    //$('option_img_try').value= top;
  1.1106 +     var h=shape.getAttributeNS(null, 'height');   
  1.1107 +     var w=shape.getAttributeNS(null, 'width'); 
  1.1108 +    // this.editor.log( h+' '+w);
  1.1109 +  }
  1.1110 +  if (shape.tagName == 'text'){  
  1.1111 +   var size=parseFloat(shape.getAttributeNS(null, 'font-size')); 
  1.1112 +   //$('code').value=size;
  1.1113 +    shape.setAttributeNS(null, 'x',  left + 'px');
  1.1114 +    shape.setAttributeNS(null, 'y',  parseFloat(top+size) + 'px');
  1.1115 +    //$('option_text_trx').value= left;  
  1.1116 +    //$('option_text_try').value= top;
  1.1117 +
  1.1118 +  }
  1.1119 +  if (shape.tagName == 'line'){ 
  1.1120 +    var deltaX = shape.getBBox().width;
  1.1121 +    var deltaY = shape.getBBox().height;
  1.1122 +    shape.setAttributeNS(null, 'x1', left + 'px');
  1.1123 +    shape.setAttributeNS(null, 'y1', top + 'px');
  1.1124 +
  1.1125 +    shape.setAttributeNS(null, 'x2', left + deltaX + 'px');
  1.1126 +    shape.setAttributeNS(null, 'y2', top + deltaY + 'px');   
  1.1127 +    //$('option_line_trx').value= left;  
  1.1128 +    //$('option_line_try').value= top;
  1.1129 +
  1.1130 +  }   
  1.1131 +  if (shape.tagName == 'ellipse'){  
  1.1132 +    var putx=left + (shape.getBBox().width / 2)    
  1.1133 +    var puty= top + (shape.getBBox().height / 2)
  1.1134 +    shape.setAttributeNS(null, 'cx', putx + 'px');
  1.1135 +    shape.setAttributeNS(null, 'cy', puty + 'px');
  1.1136 +    //$('option_ellipse_trx').value= putx;  
  1.1137 +    //$('option_ellipse_try').value= puty;
  1.1138 +
  1.1139 +  }
  1.1140 +  if (shape.tagName == 'path' || shape.tagName == 'polyline' ) {
  1.1141 +
  1.1142 +   if(contmove==1){ 
  1.1143 +      xshe=left;
  1.1144 +      yshe=top; 
  1.1145 +   }    
  1.1146 + var path=shape.getAttributeNS(null, 'd');
  1.1147 + path=path.replace(/, /g, ','); 
  1.1148 + path=path.replace(/ ,/g, ',');
  1.1149 + var ps =path.split(" ")
  1.1150 + var pcc = "";
  1.1151 + var point =ps[0].split(","); 
  1.1152 +
  1.1153 +
  1.1154 + var num0= parseFloat(point[0].substring(1));
  1.1155 + var num1= parseFloat(point[1]); 
  1.1156 + 
  1.1157 + var ang= ang2v(box.x,box.y,left,top) ;
  1.1158 + var angle = Math.round((ang/Math.PI* 2)* 360);
  1.1159 + var angx = Math.cos(ang); 
  1.1160 + var angy = Math.sin(ang);          
  1.1161 + var dist= dist2p(left,top,box.x,box.y);
  1.1162 + var xinc=dist*angx;
  1.1163 + var yinc=dist*angy;   
  1.1164 +    var re = /^[-]?\d*\.?\d*$/;
  1.1165 + for(var i = 0; i < ps.length; i++)
  1.1166 +  { 
  1.1167 +   if(ps[i].indexOf(',')>0){  
  1.1168 +     
  1.1169 +      var point =ps[i].split(","); 
  1.1170 +       var char1=point[0].substring(0,1); 
  1.1171 +       if(char1=='A' || char1=='a'){isArc=true; contArc=0;}
  1.1172 +       if(isArc==true){contArc++}
  1.1173 +       if(contArc==4){contArc=0; isArc=false}
  1.1174 +       
  1.1175 +       //if (isNaN(valnum)) 
  1.1176 +      if (!char1.match(re))        
  1.1177 +       { 
  1.1178 +           var num0= parseFloat(point[0].substring(1));
  1.1179 +           var text=char1;
  1.1180 +       }else{ 
  1.1181 +         if(isArc==true && contArc==2  )
  1.1182 +          {
  1.1183 +            var num0= point[0];
  1.1184 +          }else{  
  1.1185 +            var num0= parseFloat(point[0]);
  1.1186 +          }  
  1.1187 +         var text='';
  1.1188 +
  1.1189 +       }
  1.1190 + 
  1.1191 +       
  1.1192 +       if(isArc==true && contArc==2)
  1.1193 +        {   
  1.1194 +           point[1]= point[1].toString() ;
  1.1195 +        }
  1.1196 +        else
  1.1197 +        {    
  1.1198 +         
  1.1199 +          num0+=xinc;    
  1.1200 +          point[1]= parseFloat(point[1]);
  1.1201 +          point[1]+=yinc;
  1.1202 +
  1.1203 +        }  
  1.1204 +        var cx=num0; 
  1.1205 +         
  1.1206 +        var cy=point[1]; 
  1.1207 +        pcc+=text+cx+','+cy+' ';
  1.1208 +   }else{
  1.1209 +      pcc+=ps[i]+' ';
  1.1210 +   }
  1.1211 +  }
  1.1212 +  
  1.1213 +  shape.setAttributeNS(null,'d', pcc);
  1.1214 +
  1.1215 + }                                                                                                                            
  1.1216 +                                                                                                                           
  1.1217 +  
  1.1218 +//$('status').innerHTML=typeTransform+': '+left+' '+top;
  1.1219 +//$('option_select_trx').value= left;  
  1.1220 +//$('option_select_try').value= top;  
  1.1221 +
  1.1222 +
  1.1223 +
  1.1224 +};
  1.1225 +
  1.1226 +
  1.1227 +
  1.1228 +SVGRenderer.prototype.track = function(shape) {
  1.1229 +  // TODO
  1.1230 +};
  1.1231 +
  1.1232 +
  1.1233 +SVGRenderer.prototype.clic = function(shape) {
  1.1234 +         var end='';
  1.1235 +	if(data_path_close==true){end='z';}
  1.1236 +        var maxcont=setPoints.length;
  1.1237 +        var thispath='M'+setPoints[0]+' ';  
  1.1238 +        $('someinfo').value=maxcont;
  1.1239 +      
  1.1240 +        for(var conta=1;conta< maxcont;conta++){        
  1.1241 +          thispath+='L'+setPoints[conta]+' ';
  1.1242 +        }
  1.1243 +              //var pointshape=shape.getAttributeNS(null,"d");
  1.1244 +         	//shape.setAttributeNS(null,'d',thispath+end);
  1.1245 +         	var path=thispath+end;
  1.1246 +       
  1.1247 +         	shape.setAttributeNS(null,'d',path);
  1.1248 +                $('control_codebase').value=path;
  1.1249 + 
  1.1250 +}
  1.1251 +
  1.1252 +
  1.1253 +SVGRenderer.prototype.resize = function(shape, fromX, fromY, toX, toY) {
  1.1254 +   var deltaX = toX - fromX;
  1.1255 +  var deltaY = toY - fromY;  
  1.1256 +  
  1.1257 +     /*      if (lineColor.length == 0){lineColor = 'none';} 
  1.1258 +           if (fillColor.length == 0){fillColor = 'none';}
  1.1259 +           shape.style.fill = fillColor;  
  1.1260 +           shape.style.stroke = lineColor;  
  1.1261 +           shape.style.strokeWidth = lineWidth; 
  1.1262 +           shape.style.fillOpacity = fillOpac;
  1.1263 +           shape.style.strokOpacity = lineOpac;        
  1.1264 +      */     
  1.1265 +  if (shape.tagName == 'rect' ) 
  1.1266 +   { 
  1.1267 +    
  1.1268 + 
  1.1269 +      if (deltaX < 0) {
  1.1270 +         shape.setAttributeNS(null, 'x', toX + 'px');
  1.1271 +         shape.setAttributeNS(null, 'width', -deltaX + 'px');
  1.1272 +       }
  1.1273 +        else
  1.1274 +       {
  1.1275 +         shape.setAttributeNS(null, 'width', deltaX + 'px');
  1.1276 +       }
  1.1277 +  
  1.1278 +      if (deltaY < 0) 
  1.1279 +       {
  1.1280 +        shape.setAttributeNS(null, 'y', toY + 'px');
  1.1281 +        shape.setAttributeNS(null, 'height', -deltaY + 'px');
  1.1282 +       }
  1.1283 +        else 
  1.1284 +       {
  1.1285 +        shape.setAttributeNS(null, 'height', deltaY + 'px');
  1.1286 +       }
  1.1287 +      /*shape.style.fill = fillColor;  
  1.1288 +      shape.style.stroke = lineColor;  
  1.1289 +      shape.style.strokeWidth = lineWidth; 
  1.1290 +      shape.style.fillOpacity = fillOpac;
  1.1291 +      shape.style.strokOpacity = lineOpac;         
  1.1292 +      */
  1.1293 +      
  1.1294 +    }
  1.1295 +    
  1.1296 +  /*  if ( shape.tagName == 'simage' ) 
  1.1297 +    {   
  1.1298 +        var img=shape.firstChild;//nodeName;//nodparseFloatue;//nodes.item(0);
  1.1299 +        //alert(img);
  1.1300 +      if (deltaX < 0) {
  1.1301 +         shape.setAttributeNS(null, 'x', parseFloat(toX) + 'px');
  1.1302 +         shape.setAttributeNS(null, 'width', parseFloat(-deltaX) + 'px');
  1.1303 +         
  1.1304 +       }
  1.1305 +        else
  1.1306 +       {
  1.1307 +         shape.setAttributeNS(null, 'width', parseFloat(deltaX) + 'px');
  1.1308 +       }
  1.1309 +  
  1.1310 +      if (deltaY < 0) 
  1.1311 +       {
  1.1312 +        shape.setAttributeNS(null, 'y', parseFloat(toY) + 'px');
  1.1313 +        shape.setAttributeNS(null, 'height', parseFloat(-deltaY) + 'px');
  1.1314 +       }
  1.1315 +        else 
  1.1316 +       {
  1.1317 +        shape.setAttributeNS(null, 'height', parseFloat(deltaY) + 'px');
  1.1318 +       }  
  1.1319 +       var h=shape.getAttributeNS(null, 'height');   
  1.1320 +       var w=shape.getAttributeNS(null, 'width'); 
  1.1321 +       document.forms[0].code.value= h+' '+w;    
  1.1322 +       
  1.1323 +       
  1.1324 +       
  1.1325 +    }*/ 
  1.1326 +   if (shape.tagName == 'g' || shape.tagName == 'image') 
  1.1327 +    {
  1.1328 +          
  1.1329 +
  1.1330 +       if (deltaX < 0) 
  1.1331 +        {  
  1.1332 +          shape.setAttributeNS(null, 'x', parseFloat(toX) + 'px' );
  1.1333 +          shape.setAttributeNS(null, 'width', parseFloat(-deltaX)  + 'px');
  1.1334 +
  1.1335 +
  1.1336 +        }
  1.1337 +         else
  1.1338 +        {
  1.1339 +          shape.setAttributeNS(null, 'width', parseFloat(deltaX)  + 'px');
  1.1340 +         }
  1.1341 +  
  1.1342 +       if (deltaY < 0) 
  1.1343 +        {
  1.1344 +         shape.setAttributeNS(null, 'y', parseFloat(toY)  + 'px');
  1.1345 +         shape.setAttributeNS(null, 'height', parseFloat(-deltaY) + 'px' );
  1.1346 +        }
  1.1347 +         else 
  1.1348 +        {
  1.1349 +         shape.setAttributeNS(null, 'height', parseFloat(deltaY) + 'px');
  1.1350 + 
  1.1351 +        }
  1.1352 +     
  1.1353 +   } 
  1.1354 +  if (shape.tagName == 'ellipse') {
  1.1355 +            if (deltaX < 0) {
  1.1356 +              shape.setAttributeNS(null, 'cx', (fromX + deltaX / 2) + 'px');
  1.1357 +              shape.setAttributeNS(null, 'rx', (-deltaX / 2) + 'px');
  1.1358 +            }
  1.1359 +            else {
  1.1360 +              shape.setAttributeNS(null, 'cx', (fromX + deltaX / 2) + 'px');
  1.1361 +              shape.setAttributeNS(null, 'rx', (deltaX / 2) + 'px');
  1.1362 +            }
  1.1363 +          
  1.1364 +            if (deltaY < 0) {
  1.1365 +              shape.setAttributeNS(null, 'cy', (fromY + deltaY / 2) + 'px');
  1.1366 +              shape.setAttributeNS(null, 'ry', (-deltaY / 2) + 'px');
  1.1367 +            }
  1.1368 +            else {
  1.1369 +              shape.setAttributeNS(null, 'cy', (fromY + deltaY / 2) + 'px');
  1.1370 +              shape.setAttributeNS(null, 'ry', (deltaY / 2) + 'px');
  1.1371 +            }
  1.1372 +  }
  1.1373 +  if (shape.tagName == 'line') {
  1.1374 +          shape.setAttributeNS(null, 'x2', toX);
  1.1375 +          shape.setAttributeNS(null, 'y2', toY);
  1.1376 +  } 
  1.1377 +  if (shape.tagName == 'polyline') {    
  1.1378 +        
  1.1379 +       xpArray.push(toX);
  1.1380 +          ypArray.push(toY);  
  1.1381 +                   var thispath=''+xpArray[1]+','+ypArray[1];  
  1.1382 + 		    var thispath1=''; 
  1.1383 +		    var thispath2='';
  1.1384 +                  var maxcont=xpArray.length;
  1.1385 +      
  1.1386 +        for(var conta=2;conta< maxcont;conta++){        
  1.1387 +          thispath1+=' '+xpArray[conta]+' '+ypArray[conta];
  1.1388 +          thispath2+=' '+xpArray[conta]+', '+ypArray[conta];  
  1.1389 +	
  1.1390 +        }
  1.1391 +
  1.1392 +       
  1.1393 +		shape.setAttributeNS(null,'points',thispath+thispath1);
  1.1394 +	
  1.1395 +	
  1.1396 +    }    
  1.1397 +    
  1.1398 +  if (shape.tagName == 'path') {
  1.1399 +        
  1.1400 +    if (selectmode == 'controlpath')
  1.1401 +     {   
  1.1402 +                var end='';
  1.1403 +	if(data_path_close==true){end='z';}
  1.1404 +
  1.1405 +        var thispath='M'+setPoints[0]+' ';  
  1.1406 +        var maxcont=setPoints.length;
  1.1407 +      
  1.1408 +        for(var conta=1;conta< maxcont;conta++){        
  1.1409 +          thispath+='L'+setPoints[conta]+' ';
  1.1410 +          
  1.1411 +	
  1.1412 +        }                               
  1.1413 +        var path=thispath+'L'+toX+','+toY+end;
  1.1414 +          //var pointshape=shape.getAttributeNS(null,"d");
  1.1415 +         	shape.setAttributeNS(null,'d',path);
  1.1416 +               document.forms[0].control_codebase.value=path;
  1.1417 +     }
  1.1418 +      else
  1.1419 +     { 
  1.1420 +  
  1.1421 +	  xpArray.push(toX);
  1.1422 +          ypArray.push(toY);  
  1.1423 +  
  1.1424 +                    var thispath=''+xpArray[1]+','+ypArray[1];  
  1.1425 + 		    var thispath1=''; 
  1.1426 +		    var thispath2='';
  1.1427 +                  var maxcont=xpArray.length;
  1.1428 +      
  1.1429 +        for(var conta=2;conta< maxcont;conta++){        
  1.1430 +          //thispath1+=' '+xpArray[conta]+' '+ypArray[conta];
  1.1431 +          thispath2+=' '+xpArray[conta]+','+ypArray[conta];  
  1.1432 +	  //if((conta+2)%3==0){thispath2+=' C';}
  1.1433 +        }
  1.1434 +        var end='';
  1.1435 +	if(data_path_close==true){end='z';}
  1.1436 +		shape.setAttributeNS(null,'d','M '+thispath+ ' L'+thispath2+end);
  1.1437 +       
  1.1438 +       
  1.1439 +          
  1.1440 +      /*      
  1.1441 +  
  1.1442 +           var pointshape=shape.getAttributeNS(null,"points");
  1.1443 +          var thispoint=' '+toX+' '+toY;  
  1.1444 +             $('status').innerHTML =pointshape; 
  1.1445 +        shape.setAttributeNS(null,'points',pointshape+thispoint)
  1.1446 +        shape.setAttributeNS(null, 'stroke-width', "25");  
  1.1447 +        shape.setAttributeNS(null, 'fill', "#FFFF00");
  1.1448 +    
  1.1449 +    //shape.points.push(toX);
  1.1450 +    //shape.points.push(toY);
  1.1451 +    //shape.setAttribute("points",pointshape+);      
  1.1452 +         // var maxcont=xpArray.length-1;
  1.1453 +          var thispath=''+xpArray[1]+','+ypArray[1];  
  1.1454 +       var maxcont=xpArray.length;
  1.1455 +       //alert(maxcont);
  1.1456 +        for(var conta=2;conta< maxcont;conta++){        
  1.1457 +          thispath+=','+xpArray[conta]+','+ypArray[conta]; 
  1.1458 +        }
  1.1459 +        //alert(shape.points[1]);
  1.1460 +    //shape.setAttribute("points",thispath);       
  1.1461 +    //points.Value = thispath;       
  1.1462 +      var thispath=''+xpArray[1]+','+ypArray[1];  
  1.1463 +       var maxcont=xpArray.length;
  1.1464 +       //alert(maxcont);
  1.1465 +        for(var conta=1;conta< maxcont;conta++){        
  1.1466 +          thispath+=','+xpArray[conta]+','+ypArray[conta];
  1.1467 +        }
  1.1468 +        
  1.1469 +        shape.points.Value = thispath;
  1.1470 +        */  
  1.1471 +          
  1.1472 +          
  1.1473 +     
  1.1474 +  
  1.1475 +        /*
  1.1476 + 
  1.1477 +          
  1.1478 +       //this.renderer.move(this.selected, this.selectedBounds.x + deltaX, this.selectedBounds.y + deltaY); 
  1.1479 +       // shape.setAttributeNS(null,'transform', "translate("+(toX)+","+(toy)+")");
  1.1480 +
  1.1481 +        
  1.1482 +       
  1.1483 +         var thispath=''+xpArray[0]+','+ypArray[0]; 
  1.1484 +       var maxcont=xpArray.length;
  1.1485 +        //shape.setAttributeNS(null,'transform', "translate("+toX+","+toY+")");
  1.1486 +        for(var conta=1;conta< maxcont;conta++){        
  1.1487 +          thispath+=','+xpArray[conta]+','+ypArray[conta];
  1.1488 +        }
  1.1489 +           
  1.1490 +        shape.setAttributeNS(null, 'x', toX);
  1.1491 +        shape.setAttributeNS(null, 'y', toY);
  1.1492 +     shape.setAttributeNS(null, 'points', thispath);
  1.1493 +      */
  1.1494 +    }  
  1.1495 +  } 
  1.1496 +  if (shape == 'text') {}  
  1.1497 +    
  1.1498 +}; 
  1.1499 +SVGRenderer.prototype.tocurve = function()  
  1.1500 +{
  1.1501 +  var points=$('control_codebase').value.split('L');
  1.1502 +     var chain='';
  1.1503 +     chain+=points[0]+'C';
  1.1504 +     var numpoints=points.length-1;
  1.1505 +     for(var a=1;a<numpoints;a++)
  1.1506 +      {
  1.1507 +       if(a%3==0)
  1.1508 +        { 
  1.1509 +         chain+=points[a]+'C';
  1.1510 +        }
  1.1511 +         else
  1.1512 +        {
  1.1513 +         chain+=points[a];       
  1.1514 +        } 
  1.1515 +      } 
  1.1516 +      if(numpoints%3==0){
  1.1517 +        chain+=points[numpoints]+'';
  1.1518 +      } 
  1.1519 +      if(numpoints%3==2){
  1.1520 +        chain+=points[numpoints-1]+'';
  1.1521 +        chain+=points[numpoints]+'';
  1.1522 +      } 
  1.1523 +      if(numpoints%3==1){ 
  1.1524 +        chain+=points[numpoints-1]+'';
  1.1525 +        chain+=points[numpoints-1]+'';
  1.1526 +        chain+=points[numpoints]+'';
  1.1527 +      } 
  1.1528 +      if(numpoints%3==3){ 
  1.1529 +        chain+=points[numpoints-1]+'';
  1.1530 +        chain+=points[numpoints-1]+'';
  1.1531 +        chain+=points[numpoints-1]+'';
  1.1532 +        chain+=points[numpoints]+'';
  1.1533 +      } 
  1.1534 +
  1.1535 +      $('someinfo').value=numpoints+ ' '+ numpoints%3;
  1.1536 +      $('control_codebase').value=chain; 
  1.1537 +      setShape(); 
  1.1538 + }; 
  1.1539 + 
  1.1540 +
  1.1541 +SVGRenderer.prototype.info = function(shape)
  1.1542 +{   
  1.1543 +var shInfo = {}; 
  1.1544 +//shInfo.id =null; 
  1.1545 +//if(shInfo.id !=null){ 
  1.1546 +if(shape.id != "tracker") 
  1.1547 +{  
  1.1548 +if(shape.getAttribute('id')==null){
  1.1549 +   var nid='shape:' + createUUID(); 
  1.1550 +   shape.setAttributeNS(null, 'id',  nid);
  1.1551 +   //shInfo.id = shape.id.substr(6); 
  1.1552 + 
  1.1553 + } 
  1.1554 + shInfo.id =shape.getAttribute('id');  
  1.1555 + shInfo.type = shape.tagName;
  1.1556 + 
  1.1557 +  if(shape.tagName=='svg')
  1.1558 +  { 
  1.1559 +    shInfo.type ='doc'
  1.1560 +    shInfo.left = parseFloat(shape.getAttribute('x'));
  1.1561 +    shInfo.top = parseFloat(shape.getAttribute('y'));   
  1.1562 +    shInfo.width = parseFloat(shape.getAttribute('width'));
  1.1563 +    shInfo.height = parseFloat(shape.getAttribute('height'));   
  1.1564 +    shInfo.viewBox = shape.getAttribute('viewBox');  
  1.1565 +    shInfo.bgcolor=this.container.style.backgroundColor;  
  1.1566 +    
  1.1567 +    return shInfo; 
  1.1568 +  }
  1.1569 +  else
  1.1570 +  {
  1.1571 +    
  1.1572 +  } 
  1.1573 +
  1.1574 + 
  1.1575 + 
  1.1576 + if (shape.hasAttributeNS(null,'transform')) { 
  1.1577 +     shInfo.transform = shape.getAttribute('transform');
  1.1578 +  }else{
  1.1579 +     shInfo.transform ='';
  1.1580 +  }   
  1.1581 + 
  1.1582 + if (shape.tagName =='defs') 
  1.1583 +   { 
  1.1584 +    //alert('dfasd'); 
  1.1585 +    if(shape.getAttribute('id')==null || shape.getAttribute('id')=='')
  1.1586 +     {  
  1.1587 +      
  1.1588 +      //var nid='shape:' + createUUID(); 
  1.1589 +      shape.setAttributeNS(null, 'id',  'defs');
  1.1590 +      shInfo.id=shape.getAttribute('id');
  1.1591 +     }
  1.1592 +     shInfo.id=shape.getAttribute('id');
  1.1593 +   }
  1.1594 + if (shape.tagName == 'feGaussianBlur') 
  1.1595 +  {
  1.1596 +    shInfo.left = shape.getAttribute('stdDeviation');
  1.1597 +  } 
  1.1598 +
  1.1599 +  if(shape.tagName == "text"){   
  1.1600 + 
  1.1601 +   shInfo.textFamily = shape.getAttribute('font-family')
  1.1602 +   shInfo.textSize = parseInt(shape.getAttribute('font-size'))
  1.1603 +   shInfo.top = parseFloat(shape.getAttribute('y'))
  1.1604 +   shInfo.left = parseFloat(shape.getAttribute('x'))
  1.1605 +   shInfo.text = shape.textContent 
  1.1606 +   shInfo.lineWidth = parseFloat(shape.getAttribute('stroke-width'))
  1.1607 +
  1.1608 +   //shInfo.text = shape.nodparseFloatue;
  1.1609 +   }
  1.1610 + var rendering=true;     
  1.1611 + if(shape.tagName =='image'){rendering=false;}
  1.1612 + if(shape.tagName =='defs'){rendering=false;}
  1.1613 + if(shape.tagName =='svg'){rendering=false;}
  1.1614 + if(shape.tagName =='stop'){rendering=false;} 
  1.1615 + 
  1.1616 + if(shape.tagName =='filter'){rendering=false;}
  1.1617 + if(shape.tagName =='feGaussianBlur'){rendering=false;}
  1.1618 +
  1.1619 + 
  1.1620 + if(rendering==true)
  1.1621 +  {
  1.1622 +    shInfo.fillColor = shape.getAttribute('fill');
  1.1623 +    if((shape.getAttribute('fill')=='' || shape.getAttribute('fill')==null) && shape.parentNode.getAttribute('id')!='svg'){
  1.1624 +    
  1.1625 +      shInfo.fillColor = shape.parentNode.getAttribute('fill');
  1.1626 +          var mystyle= shape.parentNode.getAttribute('style'); 
  1.1627 +      if(mystyle!= null && mystyle.indexOf('<![CDATA[')>=0)
  1.1628 +       {
  1.1629 +      
  1.1630 +       }
  1.1631 +        else
  1.1632 +       {
  1.1633 +        if(mystyle!= null){
  1.1634 +          //var estilo=shape.getAttribute('style');
  1.1635 +           var data;  
  1.1636 +   
  1.1637 +          var estilo=generateJSON(mystyle);
  1.1638 +          eval("data="+estilo);
  1.1639 +          //var data=eval('"'+estilo+'"'); 
  1.1640 +          //var data=estilo.evalJSON(); 
  1.1641 +    
  1.1642 +          (data["font-size"])?shInfo.textSize=data["font-size"]:shInfo.textSize; 
  1.1643 +          (data["font-family"])?shInfo.textFamily=data["font-family"]:shInfo.textFamily; 
  1.1644 +      
  1.1645 +          (data.fill)?shInfo.fillColor=data.fill:shInfo.fillColor; 
  1.1646 +          (data.stroke)?shInfo.lineColor=data.stroke:shInfo.lineColor;
  1.1647 +          (data.transform)?shInfo.transform=data.transform:shInfo.transform;
  1.1648 +          (data["fill-opacity"])?shInfo.fillOpac=data["fill-opacity"]:shInfo.fillOpac; 
  1.1649 + 
  1.1650 +        }
  1.1651 +       
  1.1652 +       }
  1.1653 +    }
  1.1654 +    shInfo.filter = shape.getAttribute('filter')  
  1.1655 +    shInfo.lineColor = shape.getAttribute('stroke')  
  1.1656 +    shInfo.fillOpac = parseFloat(shape.getAttribute('fill-opacity'))
  1.1657 +    shInfo.lineOpac = parseFloat(shape.getAttribute('stroke-opacity'))
  1.1658 +    shInfo.lineWidth = parseFloat(shape.getAttribute('stroke-width'))
  1.1659 +    
  1.1660 +    var mystyle= shape.getAttribute('style'); 
  1.1661 +    
  1.1662 +    if(mystyle!= null && mystyle.indexOf('<![CDATA[')>=0)
  1.1663 +     {
  1.1664 +      
  1.1665 +     }
  1.1666 +      else
  1.1667 +     {
  1.1668 +      // shInfo.style=shape.getAttribute('style');
  1.1669 +     
  1.1670 +    if(mystyle!= null){
  1.1671 +      //var estilo=shape.getAttribute('style');
  1.1672 +      var data;  
  1.1673 +   
  1.1674 +      var estilo=generateJSON(mystyle);
  1.1675 +      eval("data="+estilo);
  1.1676 +      //var data=eval('"'+estilo+'"'); 
  1.1677 +      //var data=estilo.evalJSON(); 
  1.1678 +    
  1.1679 +      (data["font-size"])?shInfo.textSize=data["font-size"]:shInfo.textSize; 
  1.1680 +      (data["font-family"])?shInfo.textFamily=data["font-family"]:shInfo.textFamily; 
  1.1681 +      
  1.1682 +      (data.fill)?shInfo.fillColor=data.fill:shInfo.fillColor; 
  1.1683 +      (data.stroke)?shInfo.lineColor=data.stroke:shInfo.lineColor;
  1.1684 +      (data.transform)?shInfo.transform=data.transform:shInfo.transform;
  1.1685 +      (data["fill-opacity"])?shInfo.fillOpac=data["fill-opacity"]:shInfo.fillOpac; 
  1.1686 +      //(data.color)?shInfo.lineColor=data.color:shInfo.lineColor;
  1.1687 +      
  1.1688 +       //shInfo.fillColor=data.fill;
  1.1689 +      //document.getElementById("someinfo").value +=data.fill+' ';//estilo ;//data['fill']+' ';//
  1.1690 +    }
  1.1691 +   }
  1.1692 +  }  
  1.1693 + 
  1.1694 + 
  1.1695 + if (shape.tagName == 'rect') 
  1.1696 +   {
  1.1697 +   if(shape.getAttribute('rx') || shape.getAttribute('ry')){
  1.1698 +   shInfo.type = "rect";
  1.1699 +   shInfo.rx = parseFloat(shape.getAttribute('rx'))
  1.1700 +   shInfo.ry = parseFloat(shape.getAttribute('rx'))
  1.1701 +   }
  1.1702 +    shInfo.left = parseFloat(shape.getAttribute( 'x'));
  1.1703 +    shInfo.top = parseFloat(shape.getAttribute( 'y'));
  1.1704 +    shInfo.width = parseFloat(shape.getAttribute('width'));
  1.1705 +    shInfo.height = parseFloat(shape.getAttribute('height'));  
  1.1706 +   }
  1.1707 +  else if (shape.tagName == 'ellipse' || shape.tagName == 'circle') 
  1.1708 +   {     
  1.1709 +    if(shape.tagName == 'circle'){
  1.1710 +      shInfo.width = parseFloat(shape.getAttribute('r'))*2; 
  1.1711 +      shInfo.height = parseFloat(shape.getAttribute('r'))*2; 
  1.1712 +     }else{
  1.1713 +      shInfo.width = parseFloat(shape.getAttribute('rx'))*2;
  1.1714 +      shInfo.height = parseFloat(shape.getAttribute('ry'))*2;   
  1.1715 +     }
  1.1716 +    
  1.1717 +    shInfo.left =    parseFloat(shape.getAttribute('cx')) - (shInfo.width/2);
  1.1718 +    shInfo.top =  parseFloat(shape.getAttribute('cy')) - (shInfo.height/2)  ;
  1.1719 +   }
  1.1720 +   else if(shape.tagName == 'linearGradient') { 
  1.1721 +    shInfo.text =shape.getAttribute('gradientUnits');//"userSpaceOnUse" 
  1.1722 +    shInfo.left = shape.getAttribute('x1');
  1.1723 +    shInfo.top = shape.getAttribute('y1');
  1.1724 +    shInfo.width = shape.getAttribute('x2');
  1.1725 +    shInfo.height = shape.getAttribute('y2');
  1.1726 +    shInfo.href = shape.getAttribute('xlink:href');  
  1.1727 +   } 
  1.1728 +   else if(shape.tagName == 'radialGradient') {  
  1.1729 +    shInfo.text =shape.getAttribute('gradientUnits');//"userSpaceOnUse" 
  1.1730 +    shInfo.left = shape.getAttribute('cx');
  1.1731 +    shInfo.top = shape.getAttribute('cy');
  1.1732 +    shInfo.width = shape.getAttribute('fx');
  1.1733 +    shInfo.height = shape.getAttribute('fy');  
  1.1734 +    shInfo.lineWidth = shape.getAttribute('r');
  1.1735 +    shInfo.href = shape.getAttribute('xlink:href');  
  1.1736 +   }   
  1.1737 +    else if(shape.tagName == 'stop') 
  1.1738 +   {
  1.1739 +    shInfo.fillColor = shape.getAttribute('stop-color');
  1.1740 +    shInfo.fillOpac = shape.getAttribute('stop-opacity');
  1.1741 +    shInfo.lineOpac = shape.getAttribute('offset');
  1.1742 +    var mystyle= shape.getAttribute('style');
  1.1743 +    if(mystyle!= null && mystyle.indexOf('<![CDATA[')>=0)
  1.1744 +     {
  1.1745 +      
  1.1746 +     }
  1.1747 +      else
  1.1748 +     {
  1.1749 +      if(mystyle!= null)
  1.1750 +       {
  1.1751 +        var data;  
  1.1752 +        var estilo=generateJSON(mystyle);
  1.1753 +        eval("data="+estilo);
  1.1754 +        (data["stop-color"])?shInfo.fillColor=data["stop-color"]:shInfo.fillColor;
  1.1755 +        (data["stop-opacity"])?shInfo.fillOpac=data["stop-opacity"]:shInfo.fillOpac;
  1.1756 +        //document.getElementById("someinfo").value +=data["stop-color"]+' '; 
  1.1757 +       } 
  1.1758 +     }
  1.1759 +   }
  1.1760 +  else if (shape.tagName == 'line') 
  1.1761 +   {
  1.1762 +    shInfo.left = parseFloat(shape.getAttribute('x1'));
  1.1763 +    shInfo.top = parseFloat(shape.getAttribute('y1'));
  1.1764 +    shInfo.width = parseFloat(shape.getAttribute('x2')) -shInfo.left;
  1.1765 +    shInfo.height = parseFloat(shape.getAttribute('y2')) -shInfo.top;
  1.1766 +   } 
  1.1767 +  else if (shape.tagName == 'polyline' || shape.tagName == 'polygon') 
  1.1768 +   {
  1.1769 +    shInfo.points = shape.getAttribute('points');
  1.1770 +   } 
  1.1771 + 
  1.1772 +  else if (shape.tagName == 'g') 
  1.1773 +   { 
  1.1774 +    shInfo.type = "group";
  1.1775 +    shInfo.left = parseFloat(shape.getAttribute( 'x'));
  1.1776 +    shInfo.top = parseFloat(shape.getAttribute( 'y'));
  1.1777 +    shInfo.width = parseFloat(shape.getAttribute('width'));
  1.1778 +    shInfo.height = parseFloat(shape.getAttribute('height'));  
  1.1779 +    shInfo.fillColor = shape.getAttribute('fill');
  1.1780 +    if(shape.getAttribute('id')==null || shape.getAttribute('id')=='')
  1.1781 +      {
  1.1782 +       var nid='shape:' + createUUID(); 
  1.1783 +       shape.setAttributeNS(null, 'id',  nid);
  1.1784 +       shInfo.id=shape.getAttribute('id');
  1.1785 +      } 
  1.1786 +     
  1.1787 +   }   
  1.1788 +  else if (shape.tagName == 'path')
  1.1789 +   {
  1.1790 +    shInfo.points = shape.getAttribute('d');     
  1.1791 +    //shInfo.transform = shape.getAttribute('transform'); 
  1.1792 + 
  1.1793 +    //alert(shInfo.transform);
  1.1794 +    //document.forms[0].codebase.value=shape.getAttribute('d'); 
  1.1795 +   
  1.1796 +   } 
  1.1797 +   else if (shape.tagName == 'pattern') 
  1.1798 +   { 
  1.1799 +    
  1.1800 +    shInfo.left = parseFloat(shape.getAttribute( 'x'));
  1.1801 +    shInfo.top = parseFloat(shape.getAttribute( 'y'));
  1.1802 +    shInfo.width = parseFloat(shape.getAttribute('width'));
  1.1803 +    shInfo.height = parseFloat(shape.getAttribute('height'));  
  1.1804 +    shInfo.viewBox = shape.getAttribute('viewBox');
  1.1805 +   
  1.1806 +    if(shape.getAttribute('id')==null || shape.getAttribute('id')=='')
  1.1807 +      {
  1.1808 +       var nid='shape:' + createUUID(); 
  1.1809 +       shape.setAttributeNS(null, 'id',  nid);
  1.1810 +       shInfo.id=shape.getAttribute('id');
  1.1811 +      } 
  1.1812 +
  1.1813 +   }    
  1.1814 +  else if (shape.tagName == 'image')
  1.1815 +   {                                     
  1.1816 +    
  1.1817 +    shInfo.left = parseFloat(shape.getAttribute( 'x'));
  1.1818 +    shInfo.top = parseFloat(shape.getAttribute( 'y'));
  1.1819 +    shInfo.width = parseFloat(shape.getAttribute('width'));
  1.1820 +    shInfo.height = parseFloat(shape.getAttribute('height'));   
  1.1821 +    shInfo.fillOpac = parseFloat(shape.getAttribute('opacity'));   
  1.1822 +    shInfo.href = shape.getAttribute('href');  
  1.1823 +     
  1.1824 +  }                                               
  1.1825 +  else if (shape.tagName == 'use')
  1.1826 +   {                                     
  1.1827 +    
  1.1828 +    shInfo.href = shape.getAttribute('xlink:href');  
  1.1829 +     
  1.1830 +  }             
  1.1831 +  if(shape.parentNode.tagName != 'svg'){
  1.1832 +    //shInfo.width = parseFloat(shape.getAttribute('width'));
  1.1833 +    //shInfo.height = parseFloat(shape.getAttribute('height'));   
  1.1834 +    //shInfo.viewBox = shape.getAttribute('viewBox');   
  1.1835 +    shInfo.parent=shape.parentNode.getAttribute('id');
  1.1836 +
  1.1837 +  }               
  1.1838 +    
  1.1839 +    return shInfo;  
  1.1840 +  }else{
  1.1841 +   //do nothing if its the tracker
  1.1842 +   }
  1.1843 +  
  1.1844 +   	
  1.1845 +   	
  1.1846 +};
  1.1847 + 
  1.1848 +SVGRenderer.prototype.info01 = function(shape)
  1.1849 +{   
  1.1850 + var shInfo = {};
  1.1851 +if(shape.id != "tracker"){
  1.1852 + //shInfo.id = shape.id.substr(6); 
  1.1853 + shInfo.id =shape.getAttribute('id');
  1.1854 + shInfo.type = shape.tagName; 
  1.1855 + 
  1.1856 + if(shape.tagName=='svg')
  1.1857 +  { 
  1.1858 +    shInfo.type ='doc'
  1.1859 +    shInfo.left = parseFloat(shape.getAttribute('x'));
  1.1860 +    shInfo.top = parseFloat(shape.getAttribute('y'));   
  1.1861 +    shInfo.width = parseFloat(shape.getAttribute('width'));
  1.1862 +    shInfo.height = parseFloat(shape.getAttribute('height'));   
  1.1863 +    shInfo.viewBox = shape.getAttribute('viewBox');  
  1.1864 +    shInfo.bgcolor=this.container.style.backgroundColor; 
  1.1865 +  }
  1.1866 +  
  1.1867 + if (shape.hasAttributeNS(null,'transform')) { 
  1.1868 +     shInfo.transform = shape.getAttribute('transform');
  1.1869 +  }else{
  1.1870 +     shInfo.transform ='';
  1.1871 +  }   
  1.1872 + 
  1.1873 +  if(shape.tagName == "text"){   
  1.1874 + 
  1.1875 +   shInfo.textFamily = shape.getAttribute('font-family')
  1.1876 +   shInfo.textSize = parseInt(shape.getAttribute('font-size'))
  1.1877 +   shInfo.top = parseFloat(shape.getAttribute('y'))
  1.1878 +   shInfo.left = parseFloat(shape.getAttribute('x'))
  1.1879 +   shInfo.text = shape.textContent 
  1.1880 +   shInfo.lineWidth = parseFloat(shape.getAttribute('stroke-width'))
  1.1881 +
  1.1882 +   //shInfo.text = shape.nodparseFloatue;
  1.1883 +   }                          
  1.1884 +  var styled=true; 
  1.1885 + if(shape.tagName =='image'){styled=false;}      
  1.1886 + if(shape.tagName =='g'){styled=false;}  
  1.1887 + if(shape.tagName =='stop'){styled=false;}  
  1.1888 + if(shape.tagName =='svg'){styled=false;}  
  1.1889 + if(styled)
  1.1890 +  {
  1.1891 +    shInfo.fillColor = shape.getAttribute('fill')
  1.1892 +    shInfo.lineColor = shape.getAttribute('stroke')  
  1.1893 +    shInfo.fillOpac = parseFloat(shape.getAttribute('fill-opacity'))
  1.1894 +    shInfo.lineOpac = parseFloat(shape.getAttribute('stroke-opacity'))
  1.1895 +    shInfo.lineWidth = parseFloat(shape.getAttribute('stroke-width'))
  1.1896 +    
  1.1897 +    var mystyle= shape.getAttribute('style'); 
  1.1898 +    
  1.1899 +    if(mystyle!= null && mystyle.indexOf('<![CDATA[')>=0)
  1.1900 +     {
  1.1901 +      
  1.1902 +     }
  1.1903 +      else
  1.1904 +     {
  1.1905 +      // shInfo.style=shape.getAttribute('style');
  1.1906 +     
  1.1907 +    if(mystyle!= null){
  1.1908 +      //var estilo=shape.getAttribute('style');
  1.1909 +      var data;  
  1.1910 +   
  1.1911 +      var estilo=generateJSON(mystyle);
  1.1912 +      eval("data="+estilo);
  1.1913 +      //var data=eval('"'+estilo+'"'); 
  1.1914 +      //var data=estilo.evalJSON(); 
  1.1915 +    
  1.1916 +      (data["font-size"])?shInfo.textSize=data["font-size"]:shInfo.textSize; 
  1.1917 +      (data["font-family"])?shInfo.textFamily=data["font-family"]:shInfo.textFamily; 
  1.1918 +      
  1.1919 +      (data.fill)?shInfo.fillColor=data.fill:shInfo.fillColor; 
  1.1920 +      (data.stroke)?shInfo.lineColor=data.stroke:shInfo.lineColor;
  1.1921 +      (data.transform)?shInfo.transform=data.transform:shInfo.transform;
  1.1922 +      (data["fill-opacity"])?shInfo.fillOpac=data["fill-opacity"]:shInfo.fillOpac; 
  1.1923 +       //shInfo.fillColor=data.fill;
  1.1924 +      //document.getElementById("someinfo").value +=data.fill+' ';//estilo ;//data['fill']+' ';//
  1.1925 +    }
  1.1926 +   }
  1.1927 +  }  
  1.1928 + 
  1.1929 + 
  1.1930 + if (shape.tagName == 'rect') 
  1.1931 +   {
  1.1932 +   if(shape.getAttribute('rx') || shape.getAttribute('ry')){
  1.1933 +   shInfo.type = "rect";
  1.1934 +   shInfo.rx = parseFloat(shape.getAttribute('rx'))
  1.1935 +   shInfo.ry = parseFloat(shape.getAttribute('rx'))
  1.1936 +   }
  1.1937 +    shInfo.left = parseFloat(shape.getAttribute( 'x'));
  1.1938 +    shInfo.top = parseFloat(shape.getAttribute( 'y'));
  1.1939 +    shInfo.width = parseFloat(shape.getAttribute('width'));
  1.1940 +    shInfo.height = parseFloat(shape.getAttribute('height'));  
  1.1941 +   }
  1.1942 +  else if (shape.tagName == 'ellipse' || shape.tagName == 'circle') 
  1.1943 +   {     
  1.1944 +    if(shape.tagName == 'circle'){
  1.1945 +      shInfo.width = parseFloat(shape.getAttribute('r'))*2; 
  1.1946 +      shInfo.height = parseFloat(shape.getAttribute('r'))*2; 
  1.1947 +     }else{
  1.1948 +      shInfo.width = parseFloat(shape.getAttribute('rx'))*2;
  1.1949 +      shInfo.height = parseFloat(shape.getAttribute('ry'))*2;   
  1.1950 +     }
  1.1951 +    
  1.1952 +    shInfo.left =    parseFloat(shape.getAttribute('cx')) - (shInfo.width/2);
  1.1953 +    shInfo.top =  parseFloat(shape.getAttribute('cy')) - (shInfo.height/2)  ;
  1.1954 +   }
  1.1955 +   else if(shape.tagName == 'linearGradient') {   
  1.1956 +    shInfo.left = (shape.getAttribute( 'x1'));
  1.1957 +    shInfo.top = parseFloat(shape.getAttribute( 'y1'));
  1.1958 +    shInfo.width = parseFloat(shape.getAttribute('x2'));
  1.1959 +    shInfo.height = parseFloat(shape.getAttribute('y2'));  
  1.1960 +
  1.1961 +   }
  1.1962 +   else if(shape.tagName == 'stop') {
  1.1963 +    shInfo.fillColor = shape.getAttribute('stop-color');
  1.1964 +    shInfo.fillOpac = shape.getAttribute('stop-opacity');
  1.1965 +    shInfo.lineOpac = shape.getAttribute('offset');
  1.1966 +    var mystyle= shape.getAttribute('style');
  1.1967 +    if(mystyle!= null && mystyle.indexOf('<![CDATA[')>=0)
  1.1968 +     {
  1.1969 +      
  1.1970 +     }
  1.1971 +      else
  1.1972 +     {
  1.1973 +    if(mystyle!= null){
  1.1974 +      var data;  
  1.1975 +      var estilo=generateJSON(mystyle);
  1.1976 +      eval("data="+estilo);
  1.1977 +      (data["stop-color"])?shInfo.fillColor=data["stop-color"]:shInfo.fillColor;
  1.1978 +      (data["stop-opacity"])?shInfo.fillOpac=data["stop-opacity"]:shInfo.fillOpac;
  1.1979 +      document.getElementById("someinfo").value +=data["stop-color"]+' '; 
  1.1980 +     } 
  1.1981 +     
  1.1982 +    }
  1.1983 +   }
  1.1984 +  else if (shape.tagName == 'line') 
  1.1985 +   {
  1.1986 +    shInfo.left = parseFloat(shape.getAttribute('x1'));
  1.1987 +    shInfo.top = parseFloat(shape.getAttribute('y1'));
  1.1988 +    shInfo.width = parseFloat(shape.getAttribute('x2')) -shInfo.left;
  1.1989 +    shInfo.height = parseFloat(shape.getAttribute('y2')) -shInfo.top;
  1.1990 +   } 
  1.1991 +  else if (shape.tagName == 'polyline') 
  1.1992 +   {
  1.1993 +    shInfo.points = shape.getAttribute('points');
  1.1994 +   } 
  1.1995 +  else if (shape.tagName == 'g') 
  1.1996 +   { 
  1.1997 +    shInfo.type = "group";
  1.1998 +    shInfo.left = parseFloat(shape.getAttribute( 'x'));
  1.1999 +    shInfo.top = parseFloat(shape.getAttribute( 'y'));
  1.2000 +    shInfo.width = parseFloat(shape.getAttribute('width'));
  1.2001 +    shInfo.height = parseFloat(shape.getAttribute('height'));  
  1.2002 +    shInfo.fillColor = shape.getAttribute('fill')
  1.2003 +
  1.2004 +   }   
  1.2005 +  else if (shape.tagName == 'path')
  1.2006 +   {
  1.2007 +    shInfo.points = shape.getAttribute('d');     
  1.2008 +    //shInfo.transform = shape.getAttribute('transform'); 
  1.2009 + 
  1.2010 +    //alert(shInfo.transform);
  1.2011 +    //document.forms[0].codebase.value=shape.getAttribute('d'); 
  1.2012 +   
  1.2013 +   }
  1.2014 +  else 
  1.2015 +  
  1.2016 + 
  1.2017 +  if (shape.tagName == 'image')
  1.2018 +   {                                     
  1.2019 +    
  1.2020 +    shInfo.left = parseFloat(shape.getAttribute( 'x'));
  1.2021 +    shInfo.top = parseFloat(shape.getAttribute( 'y'));
  1.2022 +    shInfo.width = parseFloat(shape.getAttribute('width'));
  1.2023 +    shInfo.height = parseFloat(shape.getAttribute('height'));   
  1.2024 +    shInfo.fillOpac = parseFloat(shape.getAttribute('opacity'));   
  1.2025 +    shInfo.href = shape.getAttribute('href');  
  1.2026 +     
  1.2027 +  } 
  1.2028 +  if(shape.parentNode.tagName != 'svg'){
  1.2029 +    //shInfo.width = parseFloat(shape.getAttribute('width'));
  1.2030 +    //shInfo.height = parseFloat(shape.getAttribute('height'));   
  1.2031 +    //shInfo.viewBox = parseFloat(shape.getAttribute('viewBox'));   
  1.2032 +    shInfo.parent=shape.parentNode.getAttribute('id');
  1.2033 +
  1.2034 +  }
  1.2035 +    return shInfo;  
  1.2036 +  }else{
  1.2037 +   //do nothing if its the tracker
  1.2038 +   }
  1.2039 +  
  1.2040 +   	
  1.2041 +   	
  1.2042 +};     
  1.2043 +SVGRenderer.prototype.info01 = function(shape)
  1.2044 +{   
  1.2045 +
  1.2046 +var shInfo = {};
  1.2047 +if(shape.id != "tracker"){
  1.2048 +shInfo.id = shape.id.substr(6);
  1.2049 + shInfo.type = shape.tagName;
  1.2050 + if (shape.hasAttributeNS(null,'transform')) { 
  1.2051 +     shInfo.transform = shape.getAttribute('transform');
  1.2052 +  }else{
  1.2053 +     shInfo.transform ='';
  1.2054 +  }   
  1.2055 +     
  1.2056 + 
  1.2057 + //if(shape.tagName !='image')
  1.2058 + // {
  1.2059 +    shInfo.fillColor = shape.getAttribute('fill')
  1.2060 +    shInfo.lineColor = shape.getAttribute('stroke')  
  1.2061 +    shInfo.fillOpac = parseFloat(shape.getAttribute('fill-opacity'))
  1.2062 +    shInfo.lineOpac = parseFloat(shape.getAttribute('stroke-opacity'))
  1.2063 +    shInfo.lineWidth = parseFloat(shape.getAttribute('stroke-width'))
  1.2064 + // }  
  1.2065 + 
  1.2066 + 
  1.2067 + if (shape.tagName == 'rect') 
  1.2068 +   {
  1.2069 +   if(shape.getAttribute('rx') || shape.getAttribute('ry')){
  1.2070 +   shInfo.type = "roundrect";
  1.2071 +   shInfo.rx = parseFloat(shape.getAttribute('rx'))
  1.2072 +   shInfo.ry = parseFloat(shape.getAttribute('rx'))
  1.2073 +   }
  1.2074 +    shInfo.left = parseFloat(shape.getAttribute( 'x'));
  1.2075 +    shInfo.top = parseFloat(shape.getAttribute( 'y'));
  1.2076 +    shInfo.width = parseFloat(shape.getAttribute('width'));
  1.2077 +    shInfo.height = parseFloat(shape.getAttribute('height'));  
  1.2078 +   }
  1.2079 +  else if (shape.tagName == 'ellipse') 
  1.2080 +   {
  1.2081 +    shInfo.width = parseFloat(shape.getAttribute('rx'))*2;
  1.2082 +    shInfo.height = parseFloat(shape.getAttribute('ry'))*2;   
  1.2083 +    shInfo.left =    parseFloat(shape.getAttribute('cx')) - (shInfo.width/2);
  1.2084 +    shInfo.top =  parseFloat(shape.getAttribute('cy')) - (shInfo.height/2)  ;
  1.2085 + 
  1.2086 +   }
  1.2087 +  else if (shape.tagName == 'line') 
  1.2088 +   {
  1.2089 +    shInfo.left = parseFloat(shape.getAttribute('x1'));
  1.2090 +    shInfo.top = parseFloat(shape.getAttribute('y1'));
  1.2091 +    shInfo.width = parseFloat(shape.getAttribute('x2')) -shInfo.left;
  1.2092 +    shInfo.height = parseFloat(shape.getAttribute('y2')) -shInfo.top;
  1.2093 +   } 
  1.2094 +  else if (shape.tagName == 'polyline') 
  1.2095 +   {
  1.2096 +    shInfo.points = shape.getAttribute('points');
  1.2097 +   }
  1.2098 +  else 
  1.2099 +  
  1.2100 +  if (shape.tagName == 'path')
  1.2101 +   {
  1.2102 +    shInfo.d = shape.getAttribute('d');     
  1.2103 +    //shInfo.transform = shape.getAttribute('transform'); 
  1.2104 + 
  1.2105 +    //alert(shInfo.transform);
  1.2106 +    //document.forms[0].codebase.value=shape.getAttribute('d'); 
  1.2107 +   
  1.2108 +   }
  1.2109 +  else 
  1.2110 +  
  1.2111 +  if(shape.tagName == "text"){   
  1.2112 + 
  1.2113 +   shInfo.textFamily = shape.getAttribute('font-family')
  1.2114 +   shInfo.textSize = parseInt(shape.getAttribute('font-size'))
  1.2115 +   shInfo.top = parseFloat(shape.getAttribute('y'))
  1.2116 +   shInfo.left = parseFloat(shape.getAttribute('x'))
  1.2117 +   shInfo.text = shape.textContent 
  1.2118 +   shInfo.lineWidth = parseFloat(shape.getAttribute('stroke-width'))
  1.2119 +
  1.2120 +   //shInfo.text = shape.nodparseFloatue;
  1.2121 +   }
  1.2122 +  else
  1.2123 + 
  1.2124 +  if (shape.tagName == 'image')
  1.2125 +   {                                     
  1.2126 +    
  1.2127 +    shInfo.left = parseFloat(shape.getAttribute( 'x'));
  1.2128 +    shInfo.top = parseFloat(shape.getAttribute( 'y'));
  1.2129 +    shInfo.width = parseFloat(shape.getAttribute('width'));
  1.2130 +    shInfo.height = parseFloat(shape.getAttribute('height'));   
  1.2131 +    shInfo.fillOpac = parseFloat(shape.getAttribute('opacity'));   
  1.2132 +    shInfo.href = shape.getAttribute('href');  
  1.2133 +     
  1.2134 +  }
  1.2135 +  
  1.2136 +    return shInfo;  
  1.2137 +  }else{
  1.2138 +   //do nothing if its the tracker
  1.2139 +   }
  1.2140 +
  1.2141 +   	
  1.2142 +}
  1.2143 +
  1.2144 +
  1.2145 +
  1.2146 +
  1.2147 +
  1.2148 +SVGRenderer.prototype.transformShape = function(shape,data,transform)
  1.2149 +{      
  1.2150 +  var svgNamespace = 'http://www.w3.org/2000/svg'; 
  1.2151 +  var xlinkNS="http://www.w3.org/1999/xlink"; 
  1.2152 +   //
  1.2153 + 
  1.2154 + if(shape.tagName == 'rect')
  1.2155 +  { 
  1.2156 +    var box = shape.getBBox();
  1.2157 +    var sdata=data.split(';'); 
  1.2158 +    
  1.2159 +    //alert(data[0]);     
  1.2160 +    shape.setAttributeNS(null,'x',parseFloat(sdata[0]));
  1.2161 +    shape.setAttributeNS(null,'y',parseFloat(sdata[1]));   
  1.2162 +    shape.setAttributeNS(null, 'width', parseFloat(sdata[2]));     
  1.2163 +    shape.setAttributeNS(null, 'height', parseFloat(sdata[3])); 
  1.2164 +    var centerx=parseFloat(sdata[0])+parseFloat(box.width/2);
  1.2165 +    var centery=parseFloat(sdata[1])+parseFloat(box.height/2);    
  1.2166 +    shape.setAttributeNS(null, 'transform','rotate('+parseFloat(sdata[4])+','+centerx+','+centery+')');
  1.2167 +    
  1.2168 +   //shape.nodparseFloatue=data;
  1.2169 +  }
  1.2170 +   else 
  1.2171 + if(shape.tagName == 'text')
  1.2172 +  {    
  1.2173 +    if(data.indexOf('<;>',0)==-1 )
  1.2174 +     {  
  1.2175 +      shape.textContent = data;  
  1.2176 +     }
  1.2177 +      else
  1.2178 +     {  
  1.2179 +       var sdata=data.split('<;>'); //?????????
  1.2180 +       shape.textContent = sdata[0]; 
  1.2181 +       shape.setAttributeNS(null,'font-size',parseFloat(sdata[1])); 
  1.2182 +        shape.setAttributeNS(null,'font-family',sdata[2]);
  1.2183 +     }
  1.2184 +   //shape.nodparseFloatue=data;
  1.2185 +  }
  1.2186 +   else
  1.2187 + if (shape.tagName == 'polyline') 
  1.2188 +  {
  1.2189 +    shape.setAttributeNS(null,'points',data);
  1.2190 +  }
  1.2191 +   else 
  1.2192 + if (shape.tagName == 'image') 
  1.2193 +  {   
  1.2194 +    //alert(data);  
  1.2195 +    if(data.indexOf(';',0)==-1 )
  1.2196 +     {  
  1.2197 +      shape.setAttributeNS(xlinkNS,'href',data);
  1.2198 +     }
  1.2199 +      else
  1.2200 +     {  
  1.2201 +        var box = shape.getBBox();
  1.2202 +        var sdata=data.split(';');
  1.2203 +        shape.setAttributeNS(null,'x',parseFloat(sdata[0]));
  1.2204 +        shape.setAttributeNS(null,'y',parseFloat(sdata[1]));   
  1.2205 +        shape.setAttributeNS(null, 'width', parseFloat(sdata[2])); 
  1.2206 +        shape.setAttributeNS(null, 'height',parseFloat(sdata[3]));  
  1.2207 +        var centerx=parseFloat(sdata[0])+parseFloat(box.width/2);
  1.2208 +        var centery=parseFloat(sdata[1])+parseFloat(box.height/2);    
  1.2209 +        shape.setAttributeNS(null, 'transform',' rotate('+parseFloat(sdata[4])+','+centerx+','+centery+')');
  1.2210 +
  1.2211 +
  1.2212 +     } 
  1.2213 +      
  1.2214 +  }
  1.2215 +   else 
  1.2216 + if (shape.tagName == 'path')
  1.2217 +  {     
  1.2218 +    if(data.indexOf(';',0)==-1 )
  1.2219 +     {  
  1.2220 +    	shape.setAttributeNS(null, 'd', data);  
  1.2221 +    	shape.setAttributeNS(null, 'transform', transform);  
  1.2222 +     }
  1.2223 +      else
  1.2224 +     {  
  1.2225 +        var box = shape.getBBox();
  1.2226 +        var sdata=data.split(';');
  1.2227 +        var centerx=parseFloat(sdata[0])+parseFloat(box.width/2);
  1.2228 +        var centery=parseFloat(sdata[1])+parseFloat(box.height/2);    
  1.2229 +        shape.setAttributeNS(null, 'transform','scale('+parseFloat(sdata[2])+','+parseFloat(sdata[3])+')'+' rotate('+parseFloat(sdata[4])+','+centerx+','+centery+')'+' translate('+parseFloat(sdata[0])+','+parseFloat(sdata[1])+')');
  1.2230 +
  1.2231 +
  1.2232 +     } 
  1.2233 +  }  
  1.2234 +   	                             
  1.2235 +	                             
  1.2236 +}
  1.2237 +SVGRenderer.prototype.editShape = function(shape,data)
  1.2238 +{   
  1.2239 + if(shape.tagName == 'text'){
  1.2240 +   shape.textContent = data
  1.2241 + }else
  1.2242 +   if (shape.tagName == 'polyline') 
  1.2243 +   {
  1.2244 +    shape.setAttributeNS(null,'points',data);
  1.2245 +   }
  1.2246 +  else 
  1.2247 +  
  1.2248 +  if (shape.tagName == 'path')
  1.2249 +   {
  1.2250 +    	shape.setAttributeNS(null, 'd', data);  
  1.2251 +    	
  1.2252 +   }  
  1.2253 +	
  1.2254 +}
  1.2255 +SVGRenderer.prototype.editCommand = function(shape, cmd, value)
  1.2256 +{
  1.2257 +  if (shape != null) {
  1.2258 +    if (cmd == 'fillcolor') {
  1.2259 +      if (value != '')
  1.2260 +        shape.setAttributeNS(null, 'fill', value);
  1.2261 +      else
  1.2262 +        shape.setAttributeNS(null, 'fill', 'none');
  1.2263 +    }
  1.2264 +    else if (cmd == 'linecolor') {
  1.2265 +      if (value != '')
  1.2266 +        shape.setAttributeNS(null, 'stroke', value);
  1.2267 +      else
  1.2268 +        shape.setAttributeNS(null, 'stroke', 'none');
  1.2269 +    }
  1.2270 +    else if (cmd == 'linewidth') {
  1.2271 +      shape.setAttributeNS(null, 'stroke-width', parseInt(value) + 'px');
  1.2272 +    } 
  1.2273 +    else if (cmd == 'fillopacity') {
  1.2274 +           if(shape.tagName=='image')
  1.2275 +            {
  1.2276 +             shape.setAttributeNS(null, 'opacity', parseFloat(value));
  1.2277 +            }
  1.2278 +             else
  1.2279 +            {
  1.2280 +                shape.setAttributeNS(null, 'fill-opacity', parseFloat(value));
  1.2281 +            }    
  1.2282 +      
  1.2283 +    }
  1.2284 +    else if (cmd == 'lineopacity') {         
  1.2285 +      
  1.2286 +      shape.setAttributeNS(null, 'stroke-opacity', parseFloat(value));
  1.2287 +      
  1.2288 +    }
  1.2289 +
  1.2290 +  }
  1.2291 +}
  1.2292 +
  1.2293 +
  1.2294 +SVGRenderer.prototype.queryCommand = function(shape, cmd)
  1.2295 +{
  1.2296 +  var result = '';
  1.2297 +  
  1.2298 +  if (shape != null) {
  1.2299 +    if (cmd == 'fillcolor') {
  1.2300 +      result = shape.getAttributeNS(null, 'fill');
  1.2301 +      if (result == 'none')
  1.2302 +        result = '';
  1.2303 +    }
  1.2304 +    else if (cmd == 'linecolor') {
  1.2305 +      result = shape.getAttributeNS(null, 'stroke');
  1.2306 +      if (result == 'none')
  1.2307 +        result = '';
  1.2308 +    }
  1.2309 +    else if (cmd == 'linewidth') {
  1.2310 +      result = shape.getAttributeNS(null, 'stroke');
  1.2311 +      if (result == 'none')
  1.2312 +        result = '';
  1.2313 +      else
  1.2314 +        result = shape.getAttributeNS(null, 'stroke-width');
  1.2315 +    }
  1.2316 +    else if (cmd == 'fillopacity') {
  1.2317 +           if(shape.tagName=='image')
  1.2318 +            {
  1.2319 +             shape.setAttributeNS(null, 'opacity', parseFloat(value));
  1.2320 +            }
  1.2321 +             else
  1.2322 +            {
  1.2323 +                shape.setAttributeNS(null, 'fill-opacity', parseFloat(value));
  1.2324 +            }    
  1.2325 +      
  1.2326 +    }
  1.2327 +    else if (cmd == 'lineopacity') {         
  1.2328 +      
  1.2329 +      shape.setAttributeNS(null, 'stroke-opacity', parseFloat(value));
  1.2330 +      
  1.2331 +    }
  1.2332 +
  1.2333 +  }
  1.2334 +  
  1.2335 +  return result;
  1.2336 +}
  1.2337 +
  1.2338 +SVGRenderer.prototype.getProperties = function(shape)
  1.2339 +{
  1.2340 +  var result = '';
  1.2341 +  
  1.2342 +  if (shape != null) 
  1.2343 +   {
  1.2344 +      result = shape.getAttributeNS(null, 'fill');
  1.2345 +      if (result == 'none')
  1.2346 +       {
  1.2347 +         mefillColor.visible = 'hidden';
  1.2348 +         mefillColor.hex = '#000000'; 
  1.2349 +         filldraw=true;
  1.2350 +         setbe(1,'img_okfill');
  1.2351 +       }
  1.2352 +        else
  1.2353 +       {   
  1.2354 +         //alert(mefillColor.hex+' '+result);
  1.2355 +         mefillColor.visible = 'visible';
  1.2356 +         mefillColor.hex = result; 
  1.2357 +         var rgb=hex2rgb(result)
  1.2358 +         mefillColor.r=rgb[0];
  1.2359 +         mefillColor.g=rgb[1];
  1.2360 +         mefillColor.b=rgb[2];
  1.2361 +         filldraw=false;
  1.2362 +         setbe(1,'img_okfill');
  1.2363 +
  1.2364 +       }
  1.2365 +
  1.2366 +      result = shape.getAttributeNS(null, 'stroke');
  1.2367 +      if (result == 'none')
  1.2368 +       {    
  1.2369 +         mestrokeColor.visible = 'hidden'; 
  1.2370 +         mestrokeColor.hex = '#000000';
  1.2371 +         mestrokeColor.width = 0;
  1.2372 +         strokedraw=true;
  1.2373 +         setbe(2,'img_okstroke');
  1.2374 +
  1.2375 +       }
  1.2376 +        else
  1.2377 +       { 
  1.2378 +         mestrokeColor.visible = 'visible'; 
  1.2379 +         mestrokeColor.hex = result; 
  1.2380 +         var rgb=hex2rgb(result)
  1.2381 +         mestrokeColor.r=rgb[0];
  1.2382 +         mestrokeColor.g=rgb[1];
  1.2383 +         mestrokeColor.b=rgb[2];
  1.2384 +         strokedraw=false;
  1.2385 +         setbe(2,'img_okstroke');
  1.2386 +
  1.2387 +       }
  1.2388 +
  1.2389 +      result = shape.getAttributeNS(null, 'stroke-width');
  1.2390 +      mestrokeColor.width = result;
  1.2391 + 
  1.2392 +      result = shape.getAttributeNS(null, 'fill-opacity'); 
  1.2393 +      mefillColor.opacity = result;
  1.2394 +
  1.2395 +      result = shape.getAttributeNS(null, 'stroke-opacity');
  1.2396 +      mestrokeColor.opacity = result;
  1.2397 +      
  1.2398 +      setProperties();
  1.2399 +   }
  1.2400 +}
  1.2401 +
  1.2402 +
  1.2403 +SVGRenderer.prototype.showMultiSelect = function(iniX,iniY) { 
  1.2404 +  var tracker = document.getElementById('trackerMultiSelect');
  1.2405 +  if (tracker) {
  1.2406 +    this.remove(tracker);
  1.2407 +  }
  1.2408 +  
  1.2409 +  var coord=this.editor.viewInputxy;
  1.2410 +	toX=parseFloat(coord[0]);
  1.2411 +	toY=parseFloat(coord[1]); 
  1.2412 +	
  1.2413 +    tracker = document.createElementNS(svgNamespace, 'rect'); 
  1.2414 +      
  1.2415 +    tracker.setAttributeNS(null, 'x', iniX);
  1.2416 +    tracker.setAttributeNS(null, 'y', iniY);    
  1.2417 +  tracker.setAttributeNS(null, 'width', toX);
  1.2418 +  tracker.setAttributeNS(null, 'height', toY);
  1.2419 +  tracker.setAttributeNS(null, 'fill', '#ffffff');
  1.2420 +  tracker.setAttributeNS(null, 'stroke', 'green');
  1.2421 +  tracker.setAttributeNS(null, 'stroke-width', widthLine);  
  1.2422 +  
  1.2423 +   this.svgRoot.appendChild(tracker);     
  1.2424 +}
  1.2425 +
  1.2426 +
  1.2427 +function mouseCoord()
  1.2428 +{                                           
  1.2429 +   var coord=this.editor.viewInputxy;
  1.2430 +   coord[0]=parseFloat(coord[0]);
  1.2431 +   coord[1]=parseFloat(coord[1]); 
  1.2432 +   return coord
  1.2433 +} 
  1.2434 +/*
  1.2435 +function nodeHit(node)
  1.2436 +{                                           
  1.2437 +   node.addEventListener("mousemove", function(event) {nodeMove(node)}, false);            
  1.2438 +  
  1.2439 +}
  1.2440 +
  1.2441 +function nodeUp(node)
  1.2442 +{                                           
  1.2443 +   //node.stopObserving("mousemove");
  1.2444 +}                                                                             
  1.2445 +
  1.2446 +function nodeMove(node)
  1.2447 +{                                           
  1.2448 +   var mypath=$('control_codebase').value; 
  1.2449 +   var  x= $('option_path_x').value;
  1.2450 +   var y= $('option_path_y').value; 
  1.2451 +   var precoord=x+','+y; 
  1.2452 +    var coord=mouseCoord(); 
  1.2453 +   node.setAttributeNS(null, 'x', coord[0]-2); 
  1.2454 +   node.setAttributeNS(null, 'y', coord[1]-2); 
  1.2455 +
  1.2456 +   $('option_path_x').value=parseFloat(node.getAttributeNS(null,'x'))+2; 
  1.2457 +   $('option_path_y').value=parseFloat(node.getAttributeNS(null,'y'))+2; 
  1.2458 +   
  1.2459 +    var  cadx= $('option_path_x').value;
  1.2460 +    var cady= $('option_path_y').value; 
  1.2461 +    var coord=cadx+','+cady;
  1.2462 +          var cad1=new RegExp(precoord,"g");
  1.2463 +      
  1.2464 +      
  1.2465 +      var result=mypath.replace(cad1, coord);
  1.2466 +      
  1.2467 +     
  1.2468 +      $('control_codebase').value=result; 
  1.2469 +      
  1.2470 +      $('someinfo').value=precoord;
  1.2471 +      setShape();
  1.2472 +
  1.2473 +    
  1.2474 +    
  1.2475 +} 
  1.2476 +*/ 
  1.2477 +                                                                             
  1.2478 +var memoNode=null; 
  1.2479 +var memoPrevControl=new Array();
  1.2480 +var memoNextControl=new Array();
  1.2481 +
  1.2482 +SVGRenderer.prototype.nodeMove = function(newx,newy) { 
  1.2483 +    var mypath=$('control_codebase').value; 
  1.2484 +   var  x= $('option_path_x').value;
  1.2485 +   var y= $('option_path_y').value; 
  1.2486 +   var precoord=x+','+y; 
  1.2487 +   
  1.2488 +   $('option_path_x').value=newx; 
  1.2489 +   $('option_path_y').value=newy; 
  1.2490 +    
  1.2491 +      var  cadx= newx;
  1.2492 +      var cady= newy; 
  1.2493 +  
  1.2494 +      var coord=cadx+','+cady;
  1.2495 +          var cad1=new RegExp(precoord,"g");
  1.2496 +      
  1.2497 +      
  1.2498 +      var result=mypath.replace(cad1, coord);
  1.2499 +      
  1.2500 +     
  1.2501 +      $('control_codebase').value=result; 
  1.2502 +      
  1.2503 +      $('someinfo').value=precoord;
  1.2504 +      setShape();
  1.2505 +
  1.2506 +}
  1.2507 +
  1.2508 +function drawNodeControl(svg,numId){
  1.2509 +
  1.2510 +      var svgNamespace = 'http://www.w3.org/2000/svg';
  1.2511 +      var color1='#0066ff';          
  1.2512 +           // if(parseInt(memoNode.id)==a){   
  1.2513 +                   
  1.2514 +                   var pointprev=memoPrevControl[numId].split(',');
  1.2515 +            
  1.2516 +                  var controlNode1 = document.createElementNS(svgNamespace, 'rect'); 
  1.2517 +                  controlNode1.setAttributeNS(null, 'x', pointprev[0]-widthLine*2);
  1.2518 +                  controlNode1.setAttributeNS(null, 'y', pointprev[1]-widthLine*2);
  1.2519 +          
  1.2520 +                  controlNode1.setAttributeNS(null, 'width', widthLine*4);
  1.2521 +                  controlNode1.setAttributeNS(null, 'height', widthLine*4);
  1.2522 +                  controlNode1.setAttributeNS(null, 'fill', color1);
  1.2523 +                  controlNode1.setAttributeNS(null, 'stroke', '#000000');
  1.2524 +                  controlNode1.setAttributeNS(null, 'stroke-width', '0'); 
  1.2525 +                  controlNode1.setAttributeNS(null, 'id', 'controlNode1'); 
  1.2526 +                  controlNode1.addEventListener("mousedown", function(event) {if(memoNode != null){memoNode.setAttributeNS(null, 'stroke-width', 0 );} memoNode=this; this.setAttributeNS(null, 'fill-color', '#ffff00' );this.setAttributeNS(null, 'stroke-width', 1 );$('option_path_num').value=this.getAttributeNS(null,'id'); $('option_path_x').value=parseFloat(this.getAttributeNS(null,'x'))+2; $('option_path_y').value=parseFloat(this.getAttributeNS(null,'y'))+2;  }, false);
  1.2527 +                  svg.appendChild(controlNode1);  
  1.2528 +                  
  1.2529 +                   var pointnext=memoNextControl[numId].split(',');
  1.2530 +                  
  1.2531 +               
  1.2532 +                  var controlNode2 = document.createElementNS(svgNamespace, 'rect'); 
  1.2533 +                  controlNode2.setAttributeNS(null, 'x', pointnext[0]-widthLine*2);
  1.2534 +                  controlNode2.setAttributeNS(null, 'y', pointnext[1]-widthLine*2);
  1.2535 +          
  1.2536 +                  controlNode2.setAttributeNS(null, 'width', widthLine*4);
  1.2537 +                  controlNode2.setAttributeNS(null, 'height', widthLine*4);
  1.2538 +                  controlNode2.setAttributeNS(null, 'fill', color1);
  1.2539 +                  controlNode2.setAttributeNS(null, 'stroke', '#000000');
  1.2540 +                  controlNode2.setAttributeNS(null, 'stroke-width', '0'); 
  1.2541 +                  controlNode2.setAttributeNS(null, 'id', 'controlNode1'); 
  1.2542 +                  controlNode2.addEventListener("mousedown", function(event) {if(memoNode != null){memoNode.setAttributeNS(null, 'stroke-width', 0 );} memoNode=this; this.setAttributeNS(null, 'fill-color', '#ffff00' );this.setAttributeNS(null, 'stroke-width', 1 );$('option_path_num').value=this.getAttributeNS(null,'id'); $('option_path_x').value=parseFloat(this.getAttributeNS(null,'x'))+2; $('option_path_y').value=parseFloat(this.getAttributeNS(null,'y'))+2;  }, false);
  1.2543 +                  svg.appendChild(controlNode2);  
  1.2544 +
  1.2545 +            //}
  1.2546 +
  1.2547 +
  1.2548 +}  
  1.2549 +                                                                   
  1.2550 +SVGRenderer.prototype.showNodesCurve = function(path,controlNodeNum){ 
  1.2551 +     memoNextControl=new Array();
  1.2552 +     memoPrevControl=new Array(); 
  1.2553 +      var widthLine=this.editor.unit;
  1.2554 +     var svgNamespace = 'http://www.w3.org/2000/svg';
  1.2555 +    // tracker = document.createElementNS(svgNamespace, 'g');   
  1.2556 +     var svg = this.container.ownerDocument.createElementNS(svgNamespace, 'g'); 
  1.2557 +      svg.setAttributeNS(null, 'id', 'editNodesPath'); 
  1.2558 +
  1.2559 +     /* var group = document.getElementById('editNodesPath');
  1.2560 +      if (group) 
  1.2561 +       {
  1.2562 +           this.remove(group);
  1.2563 +       }
  1.2564 +       */
  1.2565 +
  1.2566 +  var points=path.split(' ');
  1.2567 +     var chain='';
  1.2568 +     var segment=' ';  
  1.2569 +     prevControl=' ';
  1.2570 +     nextControl=' ';
  1.2571 +     nodePoint=' ';
  1.2572 +      var init=points[0].split('M'); 
  1.2573 +      var allcoords=init[1].split(' ');
  1.2574 +      var point=allcoords[0].split(',');
  1.2575 +          var rect1 = document.createElementNS(svgNamespace, 'rect');  
  1.2576 +        rect1.setAttributeNS(null, 'x', point[0]-widthLine*2);
  1.2577 +        rect1.setAttributeNS(null, 'y', point[1]-widthLine*2);
  1.2578 +          
  1.2579 +        rect1.setAttributeNS(null, 'width', widthLine*4);
  1.2580 +        rect1.setAttributeNS(null, 'height', widthLine*4);
  1.2581 +        rect1.setAttributeNS(null, 'fill', '#ff7700');
  1.2582 +        rect1.setAttributeNS(null, 'stroke', '#000000');
  1.2583 +        rect1.setAttributeNS(null, 'stroke-width', '0');  
  1.2584 +        rect1.setAttributeNS(null, 'id', '0'); 
  1.2585 +        //rect1.addEventListener("mouseover", function(event) {this.setAttributeNS(null, 'stroke-width', 1 ); }, false);
  1.2586 +      rect1.addEventListener("mousedown", function(event) {if(memoNode != null){memoNode.setAttributeNS(null, 'stroke-width', 0 );} memoNode=this; this.setAttributeNS(null, 'fill-color', '#ffff00' );this.setAttributeNS(null, 'stroke-width', 1 );$('option_path_num').value=this.getAttributeNS(null,'id'); $('option_path_x').value=parseFloat(this.getAttributeNS(null,'x'))+2; $('option_path_y').value=parseFloat(this.getAttributeNS(null,'y'))+2;  }, false);
  1.2587 +
  1.2588 +        //rect1.addEventListener("mouseout", function(event) {this.setAttributeNS(null, 'stroke-width', 0 );}, false);
  1.2589 +
  1.2590 +        svg.appendChild(rect1);                                    
  1.2591 +      
  1.2592 +          if(controlNodeNum==0){ var color='#ffff00';}  
  1.2593 +         if(controlNodeNum==1){var color='#00ffff';}  
  1.2594 +         if(controlNodeNum==2){var color='#00cc00';}  
  1.2595 +         var color1='#ffff00';
  1.2596 +      
  1.2597 +     var numpoints=points.length-1;  
  1.2598 +     var recalls='';
  1.2599 +     var re = /^[-]?\d*\.?\d*$/;
  1.2600 +     for(var a=1;a<=numpoints;a++)
  1.2601 +      { 
  1.2602 +        
  1.2603 +        var ini=points[a].substring(0,1);
  1.2604 +        if (!ini.match(re))        
  1.2605 +        {                          
  1.2606 +          var end=points[a].substring(1); 
  1.2607 +          color='#0000ff';
  1.2608 +          if(ini=='L' || ini=='M')
  1.2609 +           {
  1.2610 +             color='#ffff00';
  1.2611 +           }
  1.2612 +          
  1.2613 +          if(ini=='C')
  1.2614 +          { 
  1.2615 +             recall=a+2;
  1.2616 +             //color='#ffff00';
  1.2617 +          }
  1.2618 +
  1.2619 +        }else
  1.2620 +        { 
  1.2621 +          var end=points[a];
  1.2622 +          var ini='';  
  1.2623 +          color='#ff00ff'; 
  1.2624 +          if(a==recall)
  1.2625 +          { 
  1.2626 +             color='#ffff00';
  1.2627 +          }
  1.2628 +        } 
  1.2629 +        
  1.2630 +            
  1.2631 +        //segment=points[a].split(',');
  1.2632 +         prevControl=segment[0]+' '; 
  1.2633 +         nextControl=segment[1]+' '; 
  1.2634 +         nodePoint=segment[2]+' ';     
  1.2635 +         memoPrevControl[a]=prevControl;
  1.2636 +         memoNextControl[a]=nextControl;
  1.2637 +         if(controlNodeNum==0){chain+=prevControl; var point=prevControl.split(',');}  
  1.2638 +         if(controlNodeNum==1){chain+=nextControl; var point=nextControl.split(',');}  
  1.2639 +         if(controlNodeNum==2){chain+=nodePoint; var point=nodePoint.split(',');}  
  1.2640 +         if(controlNodeNum==3){chain+=nodePoint; var point=nodePoint.split(',');}
  1.2641 +           
  1.2642 +            
  1.2643 +               //if (isNaN(valnum))         
  1.2644 +
  1.2645 +         //if(ini=='C'){color='#ff00ff';}
  1.2646 +         
  1.2647 +         var point=end.split(',');
  1.2648 +         if(memoNode!=null){
  1.2649 +         }
  1.2650 +          var rect1 = document.createElementNS(svgNamespace, 'rect');  
  1.2651 +        rect1.setAttributeNS(null, 'x', point[0]-widthLine*2);
  1.2652 +        rect1.setAttributeNS(null, 'y', point[1]-widthLine*2);
  1.2653 +          
  1.2654 +        rect1.setAttributeNS(null, 'width', widthLine*4);
  1.2655 +        rect1.setAttributeNS(null, 'height', widthLine*4);
  1.2656 +        rect1.setAttributeNS(null, 'fill', color);
  1.2657 +        rect1.setAttributeNS(null, 'stroke', '#000000');
  1.2658 +        rect1.setAttributeNS(null, 'stroke-width', '0'); 
  1.2659 +        rect1.setAttributeNS(null, 'id', ''+a); 
  1.2660 +        rect1.addEventListener("mousedown", function(event) {if(memoNode != null){memoNode.setAttributeNS(null, 'stroke-width', 0 );}drawNodeControl(svg,this.getAttributeNS(null,'id')); memoNode=this; this.setAttributeNS(null, 'fill-color', '#ffff00' );this.setAttributeNS(null, 'stroke-width', 1 );$('option_path_num').value=this.getAttributeNS(null,'id'); $('option_path_x').value=parseFloat(this.getAttributeNS(null,'x'))+2; $('option_path_y').value=parseFloat(this.getAttributeNS(null,'y'))+2;  }, false);
  1.2661 +
  1.2662 +        //rect1.addEventListener("mouseover", function(event) {this.setAttributeNS(null, 'stroke-width', 1 );$('option_path_num').value=this.getAttributeNS(null,'id'); $('option_path_x').value=parseFloat(this.getAttributeNS(null,'x'))+2; $('option_path_y').value=parseFloat(this.getAttributeNS(null,'y'))+2; }, false);
  1.2663 +        // rect1.addEventListener("mousedown", function(event) {nodeHit(this);if(memoNode != null){memoNode.setAttributeNS(null, 'stroke-width', 0 );} memoNode=this; this.setAttributeNS(null, 'fill-color', '#ffff00' );this.setAttributeNS(null, 'stroke-width', 1 );$('option_path_num').value=this.getAttributeNS(null,'id'); $('option_path_x').value=parseFloat(this.getAttributeNS(null,'x'))+2; $('option_path_y').value=parseFloat(this.getAttributeNS(null,'y'))+2; document.forms[0].option_path_x.focus(); }, false);
  1.2664 +         //rect1.addEventListener("mousedown", function(event) { if(memoNode != null){memoNode.setAttributeNS(null, 'stroke-width', 0 );} nodeHit(this); memoNode=this;this.setAttributeNS(null, 'stroke-width', 1 );$('option_path_num').value=this.getAttributeNS(null,'id'); $('option_path_x').value=parseFloat(this.getAttributeNS(null,'x'))+2; $('option_path_y').value=parseFloat(this.getAttributeNS(null,'y'))+2; }, false);
  1.2665 +         //rect1.addEventListener("mousedown", function(event) {if(memoNode != null){memoNode.setAttributeNS(null, 'stroke-width', 0 );} addControlPoints(segment[0],segment[1],svg); memoNode=this; this.setAttributeNS(null, 'fillColor', '#ffff00' );this.setAttributeNS(null, 'stroke-width', 1 );$('option_path_num').value=this.getAttributeNS(null,'id'); $('option_path_x').value=parseFloat(this.getAttributeNS(null,'x'))+2; $('option_path_y').value=parseFloat(this.getAttributeNS(null,'y'))+2; }, false);
  1.2666 +         //rect1.addEventListener("mouseup", function(event) {nodeUp(this); }, false);
  1.2667 +         //rect1.addEventListener("mouseover", function(event) {this.setAttributeNS(null, 'fillColor', '#ffcc00' ); }, false);
  1.2668 +         //rect1.addEventListener("mouseout", function(event) {this.setAttributeNS(null, 'fillColor', '#00cc00' ); }, false);
  1.2669 +         
  1.2670 +
  1.2671 +         //rect1.addEventListener("mouseout", function(event) {this.setAttributeNS(null, 'stroke-width', 0 ); }, false);
  1.2672 +
  1.2673 +        svg.appendChild(rect1);                                    
  1.2674 +         
  1.2675 +      }                     
  1.2676 +      var info='';
  1.2677 +       
  1.2678 +         if(controlNodeNum==0){info='prev Control'}  
  1.2679 +         if(controlNodeNum==1){info='next Control'}  
  1.2680 +         if(controlNodeNum==2){info='points node'}   
  1.2681 +        // $('someinfo').value=numpoints+ ' '+info+':'+ chain;
  1.2682 +        $('someinfo').value='Crtl+Arrow to move';
  1.2683 +    //return chain;                                          
  1.2684 +    
  1.2685 +
  1.2686 +      //this.svgRoot.appendChild(svg);   
  1.2687 +    
  1.2688 +    return svg;  
  1.2689 +        
  1.2690 +};
  1.2691 +
  1.2692 +SVGRenderer.prototype.showNodesCurve1 = function(path,controlNodeNum){ 
  1.2693 +     memoNextControl=new Array();
  1.2694 +     memoPrevControl=new Array();
  1.2695 +     var svgNamespace = 'http://www.w3.org/2000/svg';
  1.2696 +    // tracker = document.createElementNS(svgNamespace, 'g');   
  1.2697 +     var svg = this.container.ownerDocument.createElementNS(svgNamespace, 'g'); 
  1.2698 +      svg.setAttributeNS(null, 'id', 'editNodesPath'); 
  1.2699 +
  1.2700 +     /* var group = document.getElementById('editNodesPath');
  1.2701 +      if (group) 
  1.2702 +       {
  1.2703 +           this.remove(group);
  1.2704 +       }
  1.2705 +       */
  1.2706 +
  1.2707 +  var points=path.split('C');
  1.2708 +     var chain='';
  1.2709 +     var segment=' ';  
  1.2710 +     prevControl=' ';
  1.2711 +     nextControl=' ';
  1.2712 +     nodePoint=' ';
  1.2713 +      var init=points[0].split('M'); 
  1.2714 +      var allcoords=init[1].split(' ');
  1.2715 +      var point=allcoords[0].split(',');
  1.2716 +          var rect1 = document.createElementNS(svgNamespace, 'rect');  
  1.2717 +        rect1.setAttributeNS(null, 'x', point[0]-2);
  1.2718 +        rect1.setAttributeNS(null, 'y', point[1]-2);
  1.2719 +          
  1.2720 +        rect1.setAttributeNS(null, 'width', 4);
  1.2721 +        rect1.setAttributeNS(null, 'height', 4);
  1.2722 +        rect1.setAttributeNS(null, 'fill', '#ff7700');
  1.2723 +        rect1.setAttributeNS(null, 'stroke', '#000000');
  1.2724 +        rect1.setAttributeNS(null, 'stroke-width', '0');  
  1.2725 +        rect1.setAttributeNS(null, 'id', '0'); 
  1.2726 +        //rect1.addEventListener("mouseover", function(event) {this.setAttributeNS(null, 'stroke-width', 1 ); }, false);
  1.2727 +        rect1.addEventListener("mousedown", function(event) {if(memoNode != null){memoNode.setAttributeNS(null, 'stroke-width', 0 );} memoNode=this; this.setAttributeNS(null, 'fill-color', '#ffff00' );this.setAttributeNS(null, 'stroke-width', 1 );$('option_path_num').value=this.getAttributeNS(null,'id'); $('option_path_x').value=parseFloat(this.getAttributeNS(null,'x'))+2; $('option_path_y').value=parseFloat(this.getAttributeNS(null,'y'))+2;  }, false);
  1.2728 +
  1.2729 +        //rect1.addEventListener("mouseout", function(event) {this.setAttributeNS(null, 'stroke-width', 0 );}, false);
  1.2730 +
  1.2731 +        svg.appendChild(rect1);                                    
  1.2732 +      
  1.2733 +          if(controlNodeNum==0){ var color='#ffff00';}  
  1.2734 +         if(controlNodeNum==1){var color='#00ffff';}  
  1.2735 +         if(controlNodeNum==2){var color='#00cc00';}  
  1.2736 +         var color1='#ffff00';
  1.2737 +      
  1.2738 +     var numpoints=points.length-1;
  1.2739 +     for(var a=1;a<=numpoints;a++)
  1.2740 +      { 
  1.2741 +        
  1.2742 +        
  1.2743 +            
  1.2744 +        segment=points[a].split(' ');
  1.2745 +         prevControl=segment[0]+' '; 
  1.2746 +         nextControl=segment[1]+' '; 
  1.2747 +         nodePoint=segment[2]+' ';     
  1.2748 +         memoPrevControl[a]=prevControl;
  1.2749 +         memoNextControl[a]=nextControl;
  1.2750 +         if(controlNodeNum==0){chain+=prevControl; var point=prevControl.split(',');}  
  1.2751 +         if(controlNodeNum==1){chain+=nextControl; var point=nextControl.split(',');}  
  1.2752 +         if(controlNodeNum==2){chain+=nodePoint; var point=nodePoint.split(',');}  
  1.2753 +         if(controlNodeNum==3){chain+=nodePoint; var point=nodePoint.split(',');}  
  1.2754 +      
  1.2755 +         if(memoNode!=null){
  1.2756 +         }
  1.2757 +          var rect1 = document.createElementNS(svgNamespace, 'rect');  
  1.2758 +        rect1.setAttributeNS(null, 'x', point[0]-2);
  1.2759 +        rect1.setAttributeNS(null, 'y', point[1]-2);
  1.2760 +          
  1.2761 +        rect1.setAttributeNS(null, 'width', 4);
  1.2762 +        rect1.setAttributeNS(null, 'height', 4);
  1.2763 +        rect1.setAttributeNS(null, 'fill', color);
  1.2764 +        rect1.setAttributeNS(null, 'stroke', '#000000');
  1.2765 +        rect1.setAttributeNS(null, 'stroke-width', '0'); 
  1.2766 +        rect1.setAttributeNS(null, 'id', ''+a); 
  1.2767 +        rect1.addEventListener("mousedown", function(event) {if(memoNode != null){memoNode.setAttributeNS(null, 'stroke-width', 0 );}drawNodeControl(svg,this.getAttributeNS(null,'id')); memoNode=this; this.setAttributeNS(null, 'fill-color', '#ffff00' );this.setAttributeNS(null, 'stroke-width', 1 );$('option_path_num').value=this.getAttributeNS(null,'id'); $('option_path_x').value=parseFloat(this.getAttributeNS(null,'x'))+2; $('option_path_y').value=parseFloat(this.getAttributeNS(null,'y'))+2;  }, false);
  1.2768 +
  1.2769 +        //rect1.addEventListener("mouseover", function(event) {this.setAttributeNS(null, 'stroke-width', 1 );$('option_path_num').value=this.getAttributeNS(null,'id'); $('option_path_x').value=parseFloat(this.getAttributeNS(null,'x'))+2; $('option_path_y').value=parseFloat(this.getAttributeNS(null,'y'))+2; }, false);
  1.2770 +        // rect1.addEventListener("mousedown", function(event) {nodeHit(this);if(memoNode != null){memoNode.setAttributeNS(null, 'stroke-width', 0 );} memoNode=this; this.setAttributeNS(null, 'fill-color', '#ffff00' );this.setAttributeNS(null, 'stroke-width', 1 );$('option_path_num').value=this.getAttributeNS(null,'id'); $('option_path_x').value=parseFloat(this.getAttributeNS(null,'x'))+2; $('option_path_y').value=parseFloat(this.getAttributeNS(null,'y'))+2; document.forms[0].option_path_x.focus(); }, false);
  1.2771 +         //rect1.addEventListener("mousedown", function(event) { if(memoNode != null){memoNode.setAttributeNS(null, 'stroke-width', 0 );} nodeHit(this); memoNode=this;this.setAttributeNS(null, 'stroke-width', 1 );$('option_path_num').value=this.getAttributeNS(null,'id'); $('option_path_x').value=parseFloat(this.getAttributeNS(null,'x'))+2; $('option_path_y').value=parseFloat(this.getAttributeNS(null,'y'))+2; }, false);
  1.2772 +         //rect1.addEventListener("mousedown", function(event) {if(memoNode != null){memoNode.setAttributeNS(null, 'stroke-width', 0 );} addControlPoints(segment[0],segment[1],svg); memoNode=this; this.setAttributeNS(null, 'fillColor', '#ffff00' );this.setAttributeNS(null, 'stroke-width', 1 );$('option_path_num').value=this.getAttributeNS(null,'id'); $('option_path_x').value=parseFloat(this.getAttributeNS(null,'x'))+2; $('option_path_y').value=parseFloat(this.getAttributeNS(null,'y'))+2; }, false);
  1.2773 +         //rect1.addEventListener("mouseup", function(event) {nodeUp(this); }, false);
  1.2774 +         //rect1.addEventListener("mouseover", function(event) {this.setAttributeNS(null, 'fillColor', '#ffcc00' ); }, false);
  1.2775 +         //rect1.addEventListener("mouseout", function(event) {this.setAttributeNS(null, 'fillColor', '#00cc00' ); }, false);
  1.2776 +         
  1.2777 +
  1.2778 +         //rect1.addEventListener("mouseout", function(event) {this.setAttributeNS(null, 'stroke-width', 0 ); }, false);
  1.2779 +
  1.2780 +        svg.appendChild(rect1);                                    
  1.2781 +         
  1.2782 +      }                     
  1.2783 +      var info='';
  1.2784 +       
  1.2785 +         if(controlNodeNum==0){info='prev Control'}  
  1.2786 +         if(controlNodeNum==1){info='next Control'}  
  1.2787 +         if(controlNodeNum==2){info='points node'}   
  1.2788 +        // $('someinfo').value=numpoints+ ' '+info+':'+ chain;
  1.2789 +        $('someinfo').value='Crtl+Arrow to move';
  1.2790 +    //return chain;                                          
  1.2791 +    
  1.2792 +
  1.2793 +      //this.svgRoot.appendChild(svg);   
  1.2794 +    
  1.2795 +    return svg;  
  1.2796 +        
  1.2797 +};
  1.2798 +SVGRenderer.prototype.showTracker = function(shape,pathsEdit) {  
  1.2799 +
  1.2800 +  var box = shape.getBBox();
  1.2801 + var matrix = shape.getScreenCTM();
  1.2802 +  var trshape= shape.getAttributeNS(null, 'transform');  
  1.2803 +  var shap=1; 
  1.2804 +  var T = shape.getCTM();
  1.2805 +  //a,b,c,d,e,f
  1.2806 +  
  1.2807 +  var widthLine=this.editor.unit;
  1.2808 +    
  1.2809 + 
  1.2810 + 
  1.2811 +    //var thisTransform = {  sx: s[0], r: shape.vRotate, t: shape.vTranslate };
  1.2812 +    //if (currentTransform != null) alert(currentTransform.t);
  1.2813 + 
  1.2814 +  if (shape.tagName == 'rect') { 
  1.2815 +     
  1.2816 +     $('option_rect_rot').value= T.b* (Math.PI * 2 / 360); 
  1.2817 +     $('option_rect_trx').value= box.x;  
  1.2818 +     $('option_rect_try').value= box.y;
  1.2819 +     $('option_rect_sclx').value= box.width;  
  1.2820 +     $('option_rect_scly').value= box.height;
  1.2821 +
  1.2822 +  }  
  1.2823 +
  1.2824 +  if (shape.tagName == 'image'){
  1.2825 +    $('option_img_trx').value= box.x; 
  1.2826 +    $('option_img_try').value= box.y;
  1.2827 +    $('option_img_sclx').value= box.width;  
  1.2828 +    $('option_img_scly').value= box.height;
  1.2829 +    $('option_img_rot').value= T.b* (Math.PI * 2 / 360);
  1.2830 +  }
  1.2831 +  if (shape.tagName == 'text'){
  1.2832 +    //$('option_text_trx').value= box.x; 
  1.2833 +    //$('option_text_try').value= box.y; 
  1.2834 +    $('option_text_size').value= box.height;
  1.2835 +    /*$('option_text_sclx').value= box.width;  
  1.2836 +    $('option_text_scly').value= box.height;
  1.2837 +    $('option_text_rot').value= T.b* (Math.PI * 2 / 360);
  1.2838 +   */
  1.2839 +  }
  1.2840 +  if (shape.tagName == 'line'){ 
  1.2841 +    /*
  1.2842 +    $('option_line_trx').value= box.x;  
  1.2843 +    $('option_line_try').value= box.y;
  1.2844 +    */
  1.2845 +  }   
  1.2846 +  if (shape.tagName == 'ellipse'){  
  1.2847 +    /*$('option_ellipse_trx').value= putx;  
  1.2848 +    $('option_ellipse_try').value= puty;
  1.2849 +    $('option_ellipse_sclx').value= box.width;  
  1.2850 +    $('option_ellipse_scly').value= box.height;
  1.2851 +    $('option_ellipse_rot').value= T.b* (Math.PI * 2 / 360);
  1.2852 +    */
  1.2853 +  }
  1.2854 +  
  1.2855 +  
  1.2856 +  
  1.2857 + /* if (shape.getAttributeNS(null, 'transform') ) { 
  1.2858 +        
  1.2859 +        
  1.2860 +        shap=2; }else{
  1.2861 +  }*/ 
  1.2862 +  var tracker = document.getElementById('tracker');
  1.2863 +  if (tracker) {
  1.2864 +    this.remove(tracker);
  1.2865 +  }
  1.2866 +
  1.2867 +  var svgNamespace = 'http://www.w3.org/2000/svg';
  1.2868 +  
  1.2869 +     tracker = document.createElementNS(svgNamespace, 'g');    
  1.2870 +      tracker.setAttributeNS(null, 'id', 'tracker'); 
  1.2871 +      
  1.2872 +    var controlPoints=null;
  1.2873 +    if (shape.tagName == 'path') { shap=2; 
  1.2874 +    
  1.2875 +    /* $('option_path_trx').value= box.x;  
  1.2876 +     $('option_path_try').value= box.y;
  1.2877 +     $('option_path_sclx').value= T.a;   
  1.2878 +     $('option_path_scly').value= T.d; 
  1.2879 +     $('option_path_rot').value= T.b* (Math.PI * 2 / 360);
  1.2880 +     */                                        
  1.2881 +     var path=shape.getAttributeNS(null, 'd');
  1.2882 +      $('control_codebase').value=path;  
  1.2883 +       
  1.2884 +       //controlPoints=this.showNodesCurve(path,0);
  1.2885 +       //controlPoints=this.showNodesCurve(path,1); 
  1.2886 +       controlPoints=this.showNodesCurve(path,2);
  1.2887 +       
  1.2888 +           
  1.2889 +        /*   controlPoints=this.showNodesCurve(path,1); 
  1.2890 +   
  1.2891 +           tracker.appendChild(controlPoints);     
  1.2892 +           
  1.2893 +           controlPoints=this.showNodesCurve(path,0); 
  1.2894 +   
  1.2895 +           tracker.appendChild(controlPoints); 
  1.2896 +        */   
  1.2897 +   }        
  1.2898 +      
  1.2899 +     var svg = this.container.ownerDocument.createElementNS(svgNamespace, 'g'); 
  1.2900 +      svg.setAttributeNS(null, 'id', 'transformSquares'); 
  1.2901 +   
  1.2902 +          
  1.2903 +       //var rect = document.createElementNS(svgNamespace, 'rect');   
  1.2904 +       var border = document.createElementNS(svgNamespace, 'path');  
  1.2905 +       
  1.2906 +       var trshape='translate (0,0) rotate(0) translate(0,0) '; 
  1.2907 +       var trshape_split=trshape.split(') ');    
  1.2908 +       
  1.2909 +      // get_between (trshape, s1, s2) ;
  1.2910 +     if(shape.getAttributeNS(null, 'transform')){ 
  1.2911 +         var trshape=shape.getAttributeNS(null, 'transform') ;   
  1.2912 +         //var spl=trshape.replace(', ',' ');  
  1.2913 +         //var spl1=spl.replace(')',' ');    
  1.2914 +         var trshape_split=trshape.split(') '); 
  1.2915 +         
  1.2916 +
  1.2917 +    }
  1.2918 +                                         
  1.2919 +  var corners = [];
  1.2920 +  var point = createPoint(box.x, box.y, box.width, box.height);
  1.2921 + //point = {x:box.x, y:box.y, width: box.width, height:box.height};
  1.2922 +//point = createPoint(box.x, box.y, box.width, box.height);    
  1.2923 +  //1
  1.2924 +  corners.push( createPoint(box.x + box.width, box.y, box.width, box.height) );
  1.2925 +  point.x = box.x + box.width;
  1.2926 +  point.y = box.y;
  1.2927 +  //2
  1.2928 +  corners.push( createPoint(box.x + box.width, box.y + box.height, box.width, box.height) );
  1.2929 +  point.x = box.x + box.width;
  1.2930 +  point.y = box.y + box.height;
  1.2931 +  //3
  1.2932 +  //corners.push( point.matrixTransform(matrix) );
  1.2933 +  corners.push( createPoint(box.x , box.y + box.height, box.width, box.height) );
  1.2934 +  point.x = box.x;
  1.2935 +  point.y = box.y + box.height;
  1.2936 +  //4
  1.2937 +  corners.push( createPoint(box.x + box.width, box.y, box.width, box.height) );   
  1.2938 +  
  1.2939 +  var max = createPoint(corners[0].x, corners[0].y);
  1.2940 +  var min = createPoint(corners[0].x, corners[0].y);
  1.2941 +
  1.2942 +  // identify the new corner coordinates of the
  1.2943 +  // fully transformed bounding box
  1.2944 +  for (var i = 1; i < corners.length; i++) {
  1.2945 +    var x = corners[i].x;
  1.2946 +    var y = corners[i].y;
  1.2947 +    if (x < min.x) {
  1.2948 +      min.x = x;
  1.2949 +    }
  1.2950 +    else if (x > max.x) {
  1.2951 +      max.x = x;
  1.2952 +    }
  1.2953 +    if (y < min.y) {
  1.2954 +      min.y = y;
  1.2955 +    }
  1.2956 +    else if (y > max.y) {
  1.2957 +      max.y = y;
  1.2958 +    }
  1.2959 +  }
  1.2960 +  
  1.2961 +     
  1.2962 +     border.setAttributeNS(null, 'd', "M"+(min.x-(widthLine*10))+","+ (min.y-(widthLine*10))+' h'+(box.width+(widthLine*20))+','+(0)+' v'+(0)+','+(box.height+(widthLine*20))+' h'+(-box.width-(widthLine*20))+','+(0)+' z M'+(box.x+box.width+(widthLine*10))+","+ (box.y+(box.height/2)+' h'+(widthLine*25)+',0 '));   
  1.2963 +     
  1.2964 +     
  1.2965 +     border.setAttributeNS(null, 'fill', 'none');
  1.2966 +     border.setAttributeNS(null, 'stroke', '#cccccc');
  1.2967 +     border.setAttributeNS(null, 'stroke-width', widthLine); 
  1.2968 +       
  1.2969 +// createRect(min.x, min.y, max.x - min.x, max.y - min.y);
  1.2970 +
  1.2971 +      var circle1 = document.createElementNS(svgNamespace, 'ellipse');  
  1.2972 +      circle1.setAttributeNS(null, 'cx', (box.x + box.width+(widthLine*40)) + 'px');
  1.2973 +    circle1.setAttributeNS(null, 'cy', (box.y + box.height / 2) + 'px');
  1.2974 +    circle1.setAttributeNS(null, 'rx', (widthLine*5) + 'px');
  1.2975 +    circle1.setAttributeNS(null, 'ry', (widthLine*5) + 'px');   
  1.2976 +   circle1.setAttributeNS(null, 'fill', '#ffffff');
  1.2977 +  circle1.setAttributeNS(null, 'stroke', 'green');
  1.2978 +  circle1.setAttributeNS(null, 'stroke-width', widthLine);   
  1.2979 +
  1.2980 +      var circleCenter = document.createElementNS(svgNamespace, 'ellipse');  
  1.2981 +      circleCenter.setAttributeNS(null, 'cx', (box.x + (box.width/2)) + 'px');
  1.2982 +    circleCenter.setAttributeNS(null, 'cy', (box.y + (box.height /2)) + 'px');
  1.2983 +    circleCenter.setAttributeNS(null, 'rx', (widthLine*10) + 'px');
  1.2984 +    circleCenter.setAttributeNS(null, 'ry', (widthLine*10) + 'px');   
  1.2985 +   circleCenter.setAttributeNS(null, 'fill', '#ffffff');
  1.2986 +  circleCenter.setAttributeNS(null, 'stroke', 'green');
  1.2987 +  circleCenter.setAttributeNS(null, 'stroke-width', widthLine);   
  1.2988 +
  1.2989 +     var rect1 = document.createElementNS(svgNamespace, 'rect');  
  1.2990 +  rect1.setAttributeNS(null, 'width', widthLine*10);
  1.2991 +  rect1.setAttributeNS(null, 'height', widthLine*10);
  1.2992 +  rect1.setAttributeNS(null, 'fill', '#ffffff');
  1.2993 +  rect1.setAttributeNS(null, 'stroke', 'green');
  1.2994 +  rect1.setAttributeNS(null, 'stroke-width', widthLine);  
  1.2995 +
  1.2996 +  var rect2 = document.createElementNS(svgNamespace, 'rect');  
  1.2997 +  rect2.setAttributeNS(null, 'width', widthLine*10);
  1.2998 +  rect2.setAttributeNS(null, 'height', widthLine*10);
  1.2999 +  rect2.setAttributeNS(null, 'fill', '#ffffff');
  1.3000 +  rect2.setAttributeNS(null, 'stroke', 'green');
  1.3001 +  rect2.setAttributeNS(null, 'stroke-width', widthLine);  
  1.3002 +
  1.3003 +  var rect3 = document.createElementNS(svgNamespace, 'rect');  
  1.3004 +  rect3.setAttributeNS(null, 'width', widthLine*10);
  1.3005 +  rect3.setAttributeNS(null, 'height', widthLine*10);
  1.3006 +  rect3.setAttributeNS(null, 'fill', '#ffffff');
  1.3007 +  rect3.setAttributeNS(null, 'stroke', 'green');
  1.3008 +  rect3.setAttributeNS(null, 'stroke-width', widthLine); 
  1.3009 +  
  1.3010 +  var rect4 = document.createElementNS(svgNamespace, 'rect');  
  1.3011 +  rect4.setAttributeNS(null, 'width', widthLine*10);
  1.3012 +  rect4.setAttributeNS(null, 'height', widthLine*10);
  1.3013 +  rect4.setAttributeNS(null, 'fill', '#ffffff');
  1.3014 +  rect4.setAttributeNS(null, 'stroke', 'green');
  1.3015 +  rect4.setAttributeNS(null, 'stroke-width', widthLine);  
  1.3016 + 
  1.3017 +  var rectmid12 = document.createElementNS(svgNamespace, 'rect');  
  1.3018 +  rectmid12.setAttributeNS(null, 'width', widthLine*10);
  1.3019 +  rectmid12.setAttributeNS(null, 'height', widthLine*10);
  1.3020 +  rectmid12.setAttributeNS(null, 'fill', '#ffffff');
  1.3021 +  rectmid12.setAttributeNS(null, 'stroke', 'green');
  1.3022 +  rectmid12.setAttributeNS(null, 'stroke-width', widthLine);  
  1.3023 +
  1.3024 +  var rectmid23 = document.createElementNS(svgNamespace, 'rect');  
  1.3025 +  rectmid23.setAttributeNS(null, 'width', widthLine*10);
  1.3026 +  rectmid23.setAttributeNS(null, 'height', widthLine*10);
  1.3027 +  rectmid23.setAttributeNS(null, 'fill', '#ffffff');
  1.3028 +  rectmid23.setAttributeNS(null, 'stroke', 'green');
  1.3029 +  rectmid23.setAttributeNS(null, 'stroke-width', widthLine);  
  1.3030 +
  1.3031 +  var rectmid34 = document.createElementNS(svgNamespace, 'rect');  
  1.3032 +  rectmid34.setAttributeNS(null, 'width', widthLine*10);
  1.3033 +  rectmid34.setAttributeNS(null, 'height', widthLine*10);
  1.3034 +  rectmid34.setAttributeNS(null, 'fill', '#ffffff');
  1.3035 +  rectmid34.setAttributeNS(null, 'stroke', 'green');
  1.3036 +  rectmid34.setAttributeNS(null, 'stroke-width', widthLine); 
  1.3037 +  
  1.3038 +  var rectmid41 = document.createElementNS(svgNamespace, 'rect');  
  1.3039 +  rectmid41.setAttributeNS(null, 'width', widthLine*10);
  1.3040 +  rectmid41.setAttributeNS(null, 'height', widthLine*10);
  1.3041 +  rectmid41.setAttributeNS(null, 'fill', '#ffffff');
  1.3042 +  rectmid41.setAttributeNS(null, 'stroke', 'green');
  1.3043 +  rectmid41.setAttributeNS(null, 'stroke-width', widthLine);   
  1.3044 +   // rect.setAttributeNS(null, 'x', box.x - widthLine*10);
  1.3045 +   // rect.setAttributeNS(null, 'y', box.y - widthLine*10);    
  1.3046 +    
  1.3047 +    rect1.setAttributeNS(null, 'x', box.x - widthLine*15);
  1.3048 +    rect1.setAttributeNS(null, 'y', box.y - widthLine*15);  
  1.3049 +   
  1.3050 +    
  1.3051 +    rect2.setAttributeNS(null, 'x', box.x + box.width +widthLine*5 );
  1.3052 +    rect2.setAttributeNS(null, 'y', box.y - widthLine*15);   
  1.3053 +
  1.3054 +    rect3.setAttributeNS(null, 'x', box.x + box.width + widthLine*5 );
  1.3055 +    rect3.setAttributeNS(null, 'y', box.y + box.height + widthLine*5);
  1.3056 +                                                       
  1.3057 +    rect4.setAttributeNS(null, 'x', box.x - widthLine*15 );
  1.3058 +    rect4.setAttributeNS(null, 'y', box.y + box.height + widthLine*5);    
  1.3059 +
  1.3060 +    
  1.3061 +
  1.3062 +    rectmid12.setAttributeNS(null, 'x', box.x + (box.width/2) - widthLine*5);
  1.3063 +    rectmid12.setAttributeNS(null, 'y', box.y - widthLine*15);  
  1.3064 +
  1.3065 +    rectmid23.setAttributeNS(null, 'x', box.x + box.width + widthLine*5 );
  1.3066 +    rectmid23.setAttributeNS(null, 'y', box.y + (box.height/2) - widthLine*5);   
  1.3067 +    
  1.3068 +    rectmid34.setAttributeNS(null, 'x', box.x + (box.width/2) - widthLine*5 );
  1.3069 +    rectmid34.setAttributeNS(null, 'y', box.y + box.height + widthLine*5);
  1.3070 +                                                           
  1.3071 +    rectmid41.setAttributeNS(null, 'x', box.x - widthLine*15 );
  1.3072 +    rectmid41.setAttributeNS(null, 'y', box.y + (box.height/2) - widthLine*5);
  1.3073 +     
  1.3074 +    svg.appendChild(border); 
  1.3075 +    var colorin="#ff0000";
  1.3076 +    var colorout="#ffffff" 
  1.3077 +      
  1.3078 +     circle1.addEventListener("mouseover", function(event) {circle1.setAttributeNS(null, 'cursor', 's-resize');  circle1.setAttributeNS(null, 'fill', colorin ); typeTransform='Rotate'; scaleType='nw'; }, false);
  1.3079 +     circle1.addEventListener("mouseout", function(event) {circle1.setAttributeNS(null, 'cursor', 'default');  circle1.setAttributeNS(null, 'fill', colorout ); typeTransform='Rotate'; }, false); //typeTransform='rotate'
  1.3080 +     circleCenter.addEventListener("mouseover", function(event) {circleCenter.setAttributeNS(null, 'cursor', 'move');  circleCenter.setAttributeNS(null, 'fill', colorin ); typeTransform='spìnCenter'; scaleType='nw'; }, false);
  1.3081 +     circleCenter.addEventListener("mouseout", function(event) {circleCenter.setAttributeNS(null, 'cursor', 'default');  circleCenter.setAttributeNS(null, 'fill', colorout ); typeTransform=''; }, false); //typeTransform='rotate'
  1.3082 + 
  1.3083 +      
  1.3084 +     rect1.addEventListener("mouseover", function(event) {rect1.setAttributeNS(null, 'cursor', 'nw-resize');  rect1.setAttributeNS(null, 'fill', colorin ); typeTransform='Scale'; scaleType='nw';}, false);
  1.3085 +     rect1.addEventListener("mouseout", function(event) {rect1.setAttributeNS(null, 'cursor', 'default');  rect1.setAttributeNS(null, 'fill', colorout ); typeTransform='Scale'; }, false); //typeTransform='rotate'
  1.3086 +    
  1.3087 +     rect2.addEventListener("mouseover", function(event) {rect2.setAttributeNS(null, 'cursor', 'ne-resize');  rect2.setAttributeNS(null, 'fill', colorin ); typeTransform='Scale'; scaleType='ne';}, false);  
  1.3088 +     rect2.addEventListener("mouseout", function(event) {rect2.setAttributeNS(null, 'cursor', 'default');  rect2.setAttributeNS(null, 'fill', colorout ); typeTransform='Scale'; }, false);
  1.3089 +      
  1.3090 +     rect3.addEventListener("mouseover", function(event) {rect3.setAttributeNS(null, 'cursor', 'se-resize');  rect3.setAttributeNS(null, 'fill', colorin ); typeTransform='Scale'; scaleType='se';}, false);  
  1.3091 +     rect3.addEventListener("mouseout", function(event) {rect3.setAttributeNS(null, 'cursor', 'default');  rect3.setAttributeNS(null, 'fill', colorout ); typeTransform='Scale'; }, false);
  1.3092 +     
  1.3093 +     rect4.addEventListener("mouseover", function(event) {rect4.setAttributeNS(null, 'cursor', 'sw-resize');  rect4.setAttributeNS(null, 'fill', colorin ); typeTransform='Scale'; scaleType='sw';}, false);  
  1.3094 +     rect4.addEventListener("mouseout", function(event) {rect4.setAttributeNS(null, 'cursor', 'default');  rect4.setAttributeNS(null, 'fill', colorout ); typeTransform='Scale'; }, false);
  1.3095 +                                                    
  1.3096 +     rectmid12.addEventListener("mouseover", function(event) {rectmid12.setAttributeNS(null, 'cursor', 'n-resize');  rectmid12.setAttributeNS(null, 'fill', colorin ); typeTransform='Scale'; scaleType='n';}, false);  
  1.3097 +     rectmid12.addEventListener("mouseout", function(event) {rectmid12.setAttributeNS(null, 'cursor', 'default');  rectmid12.setAttributeNS(null, 'fill', colorout ); typeTransform='Scale'; }, false); 
  1.3098 +
  1.3099 +     rectmid23.addEventListener("mouseover", function(event) {rectmid23.setAttributeNS(null, 'cursor', 'e-resize');  rectmid23.setAttributeNS(null, 'fill', colorin ); typeTransform='Scale'; scaleType='e';}, false);  
  1.3100 +     rectmid23.addEventListener("mouseout", function(event) {rectmid23.setAttributeNS(null, 'cursor', 'default');  rectmid23.setAttributeNS(null, 'fill', colorout ); typeTransform='Scale'; }, false); 
  1.3101 +     
  1.3102 +     rectmid34.addEventListener("mouseover", function(event) {rectmid34.setAttributeNS(null, 'cursor', 's-resize');  rectmid34.setAttributeNS(null, 'fill', colorin ); typeTransform='Scale'; scaleType='s';}, false);  
  1.3103 +     rectmid34.addEventListener("mouseout", function(event) {rectmid34.setAttributeNS(null, 'cursor', 'default');  rectmid34.setAttributeNS(null, 'fill', colorout ); typeTransform='Scale'; }, false); 
  1.3104 +
  1.3105 +     rectmid41.addEventListener("mouseover", function(event) {rectmid41.setAttributeNS(null, 'cursor', 'w-resize');  rectmid41.setAttributeNS(null, 'fill', colorin ); typeTransform='Scale'; scaleType='w'; }, false);  
  1.3106 +     rectmid41.addEventListener("mouseout", function(event) {rectmid41.setAttributeNS(null, 'cursor', 'default');  rectmid41.setAttributeNS(null, 'fill', colorout ); typeTransform='Scale'; }, false); 
  1.3107 +     
  1.3108 +     //////////
  1.3109 +     svg.setAttributeNS(null, 'transform',trshape); 
  1.3110 +  
  1.3111 +    svg.appendChild(circle1);    
  1.3112 +    //tracker.appendChild(circleCenter);  
  1.3113 +   if (shape.tagName == 'text'){   
  1.3114 +    svg.appendChild(rect1); 
  1.3115 +    svg.appendChild(rect2);   
  1.3116 +    svg.appendChild(rect3); 
  1.3117 +    svg.appendChild(rect4);  
  1.3118 +  }else{
  1.3119 +    svg.appendChild(rect1); 
  1.3120 +    svg.appendChild(rect2);   
  1.3121 +    svg.appendChild(rect3); 
  1.3122 +    svg.appendChild(rect4);  
  1.3123 +    svg.appendChild(rectmid12);  
  1.3124 +    svg.appendChild(rectmid23);
  1.3125 +    svg.appendChild(rectmid34);
  1.3126 +    svg.appendChild(rectmid41);                                    
  1.3127 +
  1.3128 +  }  
  1.3129 +    if(pathsEdit)
  1.3130 +     {    
  1.3131 +        controlPoints.setAttributeNS(null, 'transform',trshape); 
  1.3132 +        tracker.appendChild(controlPoints);      
  1.3133 +     }else{   
  1.3134 +        tracker.appendChild(svg); 
  1.3135 +     }   
  1.3136 +  this.svgRoot.appendChild(tracker);  
  1.3137 +      
  1.3138 +}
  1.3139 +
  1.3140 +
  1.3141 +SVGRenderer.prototype.getMarkup = function() { 
  1.3142 +       
  1.3143 +  return this.container.innerHTML;
  1.3144 +}   
  1.3145 +
  1.3146 +
  1.3147 +/////////////////////////////////
  1.3148 +var rotatexxx=0; 
  1.3149 + 
  1.3150 +var scaleType=''; 
  1.3151 +var xrot=0;
  1.3152 +var yrot=0;  
  1.3153 +
  1.3154 +var point = {x:0, y:0, width: 0, height:0};
  1.3155 +
  1.3156 +function createPoint (x, y, width, height) {
  1.3157 +    //var point = {x:34, y:22, width: 22, height:23};
  1.3158 +    //point.x = x;
  1.3159 +    //point.y = y;   
  1.3160 +    point = {x:x, y:y, width: width, height:height};
  1.3161 +    return point;
  1.3162 +  }
  1.3163 +
  1.3164 +///////////////////////////////
  1.3165 +
  1.3166 +SVGRenderer.prototype.restruct= function(shape)
  1.3167 +{
  1.3168 + //alert('end');       
  1.3169 + //forceRedraw(); 
  1.3170 +//clearWorkspace();  
  1.3171 +//document.getElementById('richdraw').style.cursor='default';    
  1.3172 +};        
  1.3173 +
  1.3174 +
  1.3175 +
  1.3176 +SVGRenderer.prototype.transform = function() {
  1.3177 +    //document.forms[0].code.value='Im tranforming';
  1.3178 +};
  1.3179 +
  1.3180 +SVGRenderer.prototype.scaleShape = function(shape,previus, toX, toY) {
  1.3181 +
  1.3182 +	 var box = shape.getBBox();  
  1.3183 +	 var prevbox=previus.getBBox();
  1.3184 +	var centerx= box.x+(box.width/2);
  1.3185 +	var centery= box.y+(box.height/2); 
  1.3186 +	var coord=this.editor.viewInputxy;
  1.3187 +	toX=parseFloat(coord[0]);
  1.3188 +	toY=parseFloat(coord[1]); 
  1.3189 +	var d2p_center=dist2p(centerx,centery,toX,toY);       
  1.3190 +
  1.3191 +	var d2p=dist2p(box.x,box.y,toX,toY);
  1.3192 +
  1.3193 +	var shareScale=box.width/d2p;
  1.3194 +
  1.3195 +	var trans_ShareScale='';
  1.3196 +	var tx, ty, tw, yh;
  1.3197 +
  1.3198 +	if(scaleType.length==1){
  1.3199 +		if(scaleType== 'w')
  1.3200 +		 {
  1.3201 +			trans_ShareScale=shareScale+",1";  
  1.3202 +			tx=toX; 
  1.3203 +			ty=prevbox.y; 
  1.3204 +			var dist=prevbox.x-toX;
  1.3205 +			var w=dist+prevbox.width;
  1.3206 +			if(w<1){w=1;}
  1.3207 +			tw=w;
  1.3208 +			th=prevbox.height;
  1.3209 +			//document.forms[0].code.value=box.x+' '+toX+' '+dist+''; 
  1.3210 +		 }        
  1.3211 +		if(scaleType== 'e')
  1.3212 +		 {
  1.3213 +		        trans_ShareScale=shareScale+",1"; 
  1.3214 +			tx=prevbox.x; 
  1.3215 +			ty=prevbox.y; 
  1.3216 +			var dist=toX-(prevbox.x+prevbox.width); //dist2p(toX,b,c,d);
  1.3217 +			var w=dist+prevbox.width;
  1.3218 +			if(w<1){w=1;}
  1.3219 +			tw=w;
  1.3220 +			th=prevbox.height;
  1.3221 + 
  1.3222 +		 }        
  1.3223 +		if(scaleType== 'n')
  1.3224 +		 {
  1.3225 +			trans_ShareScale="1,"+shareScale; 
  1.3226 +			
  1.3227 +			tx=prevbox.x; 
  1.3228 +			ty=toY; 
  1.3229 +			var dist=prevbox.y-toY;
  1.3230 +			var h=dist+prevbox.height;
  1.3231 +			if(h<1){h=1;}
  1.3232 +			tw=prevbox.width;
  1.3233 +			th=h;
  1.3234 +
  1.3235 +		 }
  1.3236 +                if( scaleType== 's')
  1.3237 +                 {
  1.3238 +                        trans_ShareScale="1,"+shareScale;  
  1.3239 +
  1.3240 +			tx=prevbox.x; 
  1.3241 +			ty=prevbox.y; 
  1.3242 +			var dist=toY-(prevbox.y+prevbox.height); //dist2p(toX,b,c,d);
  1.3243 +			var h=dist+prevbox.height;
  1.3244 +			if(h<1){h=1;}
  1.3245 +			tw=prevbox.width;
  1.3246 +			th=h;
  1.3247 +
  1.3248 +	         }
  1.3249 +        }
  1.3250 +	if(scaleType.length==2){
  1.3251 +		if(scaleType== 'nw'){
  1.3252 +			trans_ShareScale=shareScale+","+shareScale; 
  1.3253 +          
  1.3254 +      			//var angle_diagonal=getAngle(prevbox.width,prevbox.height);
  1.3255 +      			  var angle_diagonal=ang2v(prevbox.x,prevbox.y,prevbox.x+prevbox.width,prevbox.y+prevbox.height)
  1.3256 +            
  1.3257 +                        var ax= prevbox.x;
  1.3258 +                        var ay= prevbox.y;
  1.3259 +                        var bx= prevbox.x+prevbox.width; 
  1.3260 +                        var by= prevbox.y+prevbox.height; 
  1.3261 +                        
  1.3262 +                        var cx= toX;
  1.3263 +                        var cy= toY;
  1.3264 +                        var dx= toX+10*Math.cos(angle_diagonal+(Math.PI/2)); 
  1.3265 +                        var dy= toY+10*Math.sin(angle_diagonal+(Math.PI/2));  
  1.3266 +                        
  1.3267 +                        var section_a=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);   
  1.3268 +                 this.editor.log(angle_diagonal* 180 / Math.PI);       
  1.3269 +                    
  1.3270 +                var tx= section_a[1];
  1.3271 +                var ty= section_a[2];
  1.3272 +                
  1.3273 +                        var ax= section_a[1];
  1.3274 +                        var ay= section_a[2];
  1.3275 +                        var bx= 0;
  1.3276 +                        var by= section_a[2] ; 
  1.3277 +                        
  1.3278 +                        var cx=prevbox.x+prevbox.width; 
  1.3279 +                        var cy= prevbox.y;
  1.3280 +
  1.3281 +                        var dx= prevbox.x+prevbox.width;  
  1.3282 +                        var dy= 0;
  1.3283 +                        
  1.3284 +                      
  1.3285 +                var section_b=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);
  1.3286 +
  1.3287 +                var distx=dist2p(section_a[1],section_a[2],section_b[1],section_b[2]);         
  1.3288 +
  1.3289 +              
  1.3290 +                
  1.3291 +                        var ax= section_a[1];
  1.3292 +                        var ay= section_a[2];
  1.3293 +                        var bx= section_a[1] 
  1.3294 +                        var by= 0; 
  1.3295 +                        
  1.3296 +                        var cx= prevbox.x; 
  1.3297 +                        var cy= prevbox.y+prevbox.height; 
  1.3298 +
  1.3299 +                        var dx= 0; 
  1.3300 +                        var dy= prevbox.y+prevbox.height;
  1.3301 +                        
  1.3302 +                      
  1.3303 +                var section_c=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);
  1.3304 +                var disty=dist2p(section_a[1],section_a[2],section_c[1],section_c[2]);         
  1.3305 +                
  1.3306 +                
  1.3307 +
  1.3308 +                    
  1.3309 +                        if(distx<1){distx=1;}    
  1.3310 +			
  1.3311 +         		
  1.3312 +			if(disty<1){disty=1;}
  1.3313 +                        //document.forms[0].code.value=distx+' '+disty;
  1.3314 +			tw=distx;
  1.3315 +			th=disty;
  1.3316 +
  1.3317 +			
  1.3318 +		}                  
  1.3319 +		
  1.3320 +	//////////////////// SE
  1.3321 +		
  1.3322 +           if( scaleType== 'se'){
  1.3323 +			trans_ShareScale=shareScale+","+shareScale;   
  1.3324 +			
  1.3325 +	          
  1.3326 +      			//var angle_diagonal=getAngle(prevbox.width,prevbox.height);
  1.3327 +       			var angle_diagonal=ang2v(prevbox.x,prevbox.y,prevbox.x+prevbox.width,prevbox.y+prevbox.height)
  1.3328 +		
  1.3329 +			
  1.3330 +			
  1.3331 +                        var ax= prevbox.x;
  1.3332 +                        var ay= prevbox.y;
  1.3333 +                        var bx= prevbox.x+prevbox.width; 
  1.3334 +                        var by= prevbox.y+prevbox.height; 
  1.3335 +                        
  1.3336 +                        var cx= toX;
  1.3337 +                        var cy= toY;   
  1.3338 +                        var dx= toX+10*Math.cos(angle_diagonal+(Math.PI/2)); 
  1.3339 +                        var dy= toY+10*Math.sin(angle_diagonal+(Math.PI/2)); 
  1.3340 +      
  1.3341 +                var section_a=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);   
  1.3342 +                
  1.3343 +                                         
  1.3344 +                 var svgNamespace = 'http://www.w3.org/2000/svg';  
  1.3345 +                 var tracker = document.getElementById('tracker');
  1.3346 +
  1.3347 +                //////////
  1.3348 +                var tx= prevbox.x;
  1.3349 +                var ty= prevbox.y;
  1.3350 +                
  1.3351 +                        var ax= section_a[1];
  1.3352 +                        var ay= section_a[2];
  1.3353 +                        var bx= 0;
  1.3354 +                        var by= section_a[2] ; 
  1.3355 +                        
  1.3356 +                        var cx=prevbox.x; 
  1.3357 +                        var cy= prevbox.y;
  1.3358 +
  1.3359 +                        var dx= prevbox.x;  
  1.3360 +                        var dy= 0;
  1.3361 +                        
  1.3362 +                      
  1.3363 +                var section_b=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);
  1.3364 +               
  1.3365 +               /////////////////
  1.3366 +               
  1.3367 +               
  1.3368 +                var distx=dist2p(section_a[1],section_a[2],section_b[1],section_b[2]);         
  1.3369 +
  1.3370 +             
  1.3371 +                        var ax= section_a[1];
  1.3372 +                        var ay= section_a[2];
  1.3373 +                        var bx= section_a[1] 
  1.3374 +                        var by= 0; 
  1.3375 +                        
  1.3376 +                        var cx= prevbox.x; 
  1.3377 +                        var cy= prevbox.y; 
  1.3378 +
  1.3379 +                        var dx=0;
  1.3380 +                        var dy= prevbox.y;
  1.3381 +                        
  1.3382 +                      
  1.3383 +                var section_c=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);
  1.3384 +               
  1.3385 +               ///////////////
  1.3386 +               
  1.3387 +                var disty=dist2p(section_a[1],section_a[2],section_c[1],section_c[2]);         
  1.3388 +                
  1.3389 +   
  1.3390 +                    
  1.3391 +                        if(distx<1){distx=1;}    
  1.3392 +			
  1.3393 +         		
  1.3394 +			if(disty<1){disty=1;}
  1.3395 +                        
  1.3396 +			tw=distx;
  1.3397 +			th=disty;
  1.3398 +
  1.3399 +			
  1.3400 +		}
  1.3401 +
  1.3402 +		if(scaleType== 'ne'){  
  1.3403 +		        
  1.3404 +			trans_ShareScale=shareScale+","+shareScale;   
  1.3405 +			
  1.3406 +	                var angle_diagonal=ang2v(prevbox.x,prevbox.y+prevbox.height,prevbox.x+prevbox.width,prevbox.y)
  1.3407 +      			//var angle_diagonal=getAngle(prevbox.width,prevbox.height);
  1.3408 + 		
  1.3409 +			
  1.3410 +				
  1.3411 +			
  1.3412 +                        var ax= prevbox.x;
  1.3413 +                        var ay= prevbox.y+prevbox.height;
  1.3414 +                        var bx= prevbox.x+prevbox.width; 
  1.3415 +                        var by= prevbox.y;
  1.3416 +                       
  1.3417 +                        var cx= toX;
  1.3418 +                        var cy= toY;   
  1.3419 +                        var dx= toX+10*Math.cos(angle_diagonal+(Math.PI/2)); 
  1.3420 +                        var dy= toY+10*Math.sin(angle_diagonal+(Math.PI/2)); 
  1.3421 +
  1.3422 +
  1.3423 +                      this.editor.log(angle_diagonal);
  1.3424 +
  1.3425 +      
  1.3426 +                var section_a=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);   
  1.3427 +                
  1.3428 +                                         
  1.3429 +                 var svgNamespace = 'http://www.w3.org/2000/svg';  
  1.3430 +                 var tracker = document.getElementById('tracker');
  1.3431 +
  1.3432 +                //////////
  1.3433 +                var tx= prevbox.x;
  1.3434 +                var ty= section_a[2];
  1.3435 +                
  1.3436 +                        var ax= section_a[1];
  1.3437 +                        var ay= section_a[2];
  1.3438 +                        var bx= 0;
  1.3439 +                        var by= section_a[2] ; 
  1.3440 +                        
  1.3441 +                        var cx=prevbox.x; 
  1.3442 +                        var cy= prevbox.y;
  1.3443 +
  1.3444 +                        var dx= prevbox.x;  
  1.3445 +                        var dy= 0;
  1.3446 +                        
  1.3447 +                      
  1.3448 +                var section_b=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);
  1.3449 +               
  1.3450 +               /////////////////
  1.3451 +               
  1.3452 +               
  1.3453 +                var distx=dist2p(section_a[1],section_a[2],section_b[1],section_b[2]);         
  1.3454 +
  1.3455 +             
  1.3456 +                        var ax= section_a[1];
  1.3457 +                        var ay= section_a[2];
  1.3458 +                        var bx= section_a[1]; 
  1.3459 +                        var by= 0; 
  1.3460 +                        
  1.3461 +                        var cx= prevbox.x; 
  1.3462 +                        var cy= prevbox.y+prevbox.height; 
  1.3463 +
  1.3464 +                        var dx=0;
  1.3465 +                        var dy= prevbox.y+prevbox.height;
  1.3466 +                        
  1.3467 +                      
  1.3468 +                var section_c=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);
  1.3469 +               
  1.3470 +               ///////////////
  1.3471 +               
  1.3472 +                var disty=dist2p(section_a[1],section_a[2],section_c[1],section_c[2]);         
  1.3473 +                
  1.3474 +
  1.3475 +                    
  1.3476 +                        if(distx<1){distx=1;}    
  1.3477 +			
  1.3478 +         		
  1.3479 +			if(disty<1){disty=1;}
  1.3480 +                        //document.forms[0].code.value=distx+' '+disty;
  1.3481 +			tw=distx;
  1.3482 +			th=disty;
  1.3483 +			
  1.3484 +			
  1.3485 +			
  1.3486 +			
  1.3487 +			
  1.3488 +		}
  1.3489 +		if(scaleType== 'sw'){
  1.3490 +			trans_ShareScale=shareScale+","+shareScale;  
  1.3491 +			
  1.3492 +			
  1.3493 +				
  1.3494 +			
  1.3495 +	                var angle_diagonal=ang2v(prevbox.x,prevbox.y+prevbox.height,prevbox.x+prevbox.width,prevbox.y)
  1.3496 +      			//var angle_diagonal=getAngle(prevbox.width,prevbox.height);
  1.3497 + 		
  1.3498 +			
  1.3499 +				
  1.3500 +			
  1.3501 +                        var ax= prevbox.x;
  1.3502 +                        var ay= prevbox.y+prevbox.height;
  1.3503 +                        var bx= prevbox.x+prevbox.width; 
  1.3504 +                        var by= prevbox.y;
  1.3505 +                       
  1.3506 +                        var cx= toX;
  1.3507 +                        var cy= toY;   
  1.3508 +                        var dx= toX+10*Math.cos(angle_diagonal+(Math.PI/2)); 
  1.3509 +                        var dy= toY+10*Math.sin(angle_diagonal+(Math.PI/2)); 
  1.3510 +
  1.3511 +
  1.3512 +                      this.editor.log(angle_diagonal);
  1.3513 +
  1.3514 +      
  1.3515 +                var section_a=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);   
  1.3516 +                
  1.3517 +                                         
  1.3518 +                 var svgNamespace = 'http://www.w3.org/2000/svg';  
  1.3519 +                 var tracker = document.getElementById('tracker');
  1.3520 +
  1.3521 +                //////////
  1.3522 +                var tx= section_a[1];
  1.3523 +                var ty= prevbox.y;
  1.3524 +                
  1.3525 +                        var ax= section_a[1];
  1.3526 +                        var ay= section_a[2];
  1.3527 +                        var bx= 0;
  1.3528 +                        var by= section_a[2] ; 
  1.3529 +                        
  1.3530 +                        var cx=prevbox.x+prevbox.width; 
  1.3531 +                        var cy= prevbox.y+prevbox.height;
  1.3532 +
  1.3533 +                        var dx= prevbox.x+prevbox.width;  
  1.3534 +                        var dy= 0;
  1.3535 +                        
  1.3536 +                      
  1.3537 +                var section_b=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);
  1.3538 +                var distx=dist2p(section_a[1],section_a[2],section_b[1],section_b[2]);         
  1.3539 +
  1.3540 +               /////////////////             
  1.3541 +                        var ax= section_a[1];
  1.3542 +                        var ay= section_a[2];
  1.3543 +                        var bx= section_a[1];
  1.3544 +                        var by= 0; 
  1.3545 +                          
  1.3546 +                        var cx= prevbox.x; 
  1.3547 +                        var cy= prevbox.y; 
  1.3548 +
  1.3549 +                        var dx=0;
  1.3550 +                        var dy= prevbox.y;
  1.3551 +                        
  1.3552 +                      
  1.3553 +                var section_c=ntrsccn2rb(ax,ay,bx,by,cx,cy,dx,dy);
  1.3554 +                  var disty=dist2p(section_a[1],section_a[2],section_c[1],section_c[2]);         
  1.3555 +              ///////////////
  1.3556 +                
  1.3557 +   
  1.3558 +                    
  1.3559 +                        if(distx<1){distx=1;}    
  1.3560 +			
  1.3561 +         		
  1.3562 +			if(disty<1){disty=1;}
  1.3563 +                        //document.forms[0].code.value=distx+' '+disty;
  1.3564 +			tw=distx;
  1.3565 +			th=disty;
  1.3566 +			
  1.3567 +		}
  1.3568 +
  1.3569 +	}  
  1.3570 +
  1.3571 +
  1.3572 +
  1.3573 + if(shape.tagName == 'rect')
  1.3574 +  { 
  1.3575 +    //alert(data[0]);     
  1.3576 +   shape.setAttributeNS(null,'x',tx);
  1.3577 +    shape.setAttributeNS(null,'y',ty);   
  1.3578 +    shape.setAttributeNS(null, 'width', tw);     
  1.3579 +    shape.setAttributeNS(null, 'height', th); 
  1.3580 +    
  1.3581 +   //shape.nodparseFloatue=data;
  1.3582 +  }
  1.3583 +   else 
  1.3584 + if(shape.tagName == 'text')
  1.3585 +  { 
  1.3586 +    
  1.3587 +    var tsize=shape.getAttributeNS(null, 'font-size') ; 
  1.3588 +      // var d2p_center=dist2p(centerx,centery,toX,toY);       
  1.3589 +
  1.3590 +    	var d2p=dist2p(0,box.y,0,toY);
  1.3591 + //shape.setAttributeNS(null, 'x', tx + 'px');
  1.3592 +    //shape.setAttributeNS(null, 'y', ty + 'px'); 
  1.3593 +    //var mysize=box.height+1 ; 
  1.3594 +     //if((toX - centerx)<0){tsize++}else{tsize--}
  1.3595 +     tsize=d2p;
  1.3596 +    //var mysize=parseInt(Math.round(th));
  1.3597 +    
  1.3598 +    if(scaleType== 'ne'){ shape.setAttributeNS(null, 'font-size',tsize);}  
  1.3599 +    if(scaleType== 'se'){ shape.setAttributeNS(null, 'font-size',tsize);}  
  1.3600 +    if(scaleType== 'nw'){ shape.setAttributeNS(null, 'font-size',tsize);}  
  1.3601 +    if(scaleType== 'sw'){ shape.setAttributeNS(null, 'font-size',tsize);}  
  1.3602 +
  1.3603 +      //shape.setAttributeNS(null, 'font-size', mysize);  
  1.3604 +      
  1.3605 +   
  1.3606 +   /*
  1.3607 +    shape.setAttributeNS(null,'x',tx);
  1.3608 +    shape.setAttributeNS(null,'y',ty);   
  1.3609 +    shape.setAttributeNS(null, 'width', tw);     
  1.3610 +    shape.setAttributeNS(null, 'height', th); 
  1.3611 +    
  1.3612 +    //previus.setAttributeNS(null,'transform', "scale("+trans_ShareScale+")");
  1.3613 +    shape.setAttributeNS(null, 'x', tx + 'px');
  1.3614 +    shape.setAttributeNS(null, 'y', ty + 'px');
  1.3615 +
  1.3616 +    shape.setAttributeNS(null, 'textLength', parseInt(Math.round(tw)));    
  1.3617 +    
  1.3618 +     */
  1.3619 +  } 
  1.3620 +   else 
  1.3621 + if(shape.tagName == 'ellipse')
  1.3622 +  {
  1.3623 +    //shape.getAttributeNS(null, 'transform)
  1.3624 +    shape.setAttributeNS(null, 'cx', (tx + (box.width / 2)) + 'px');
  1.3625 +    shape.setAttributeNS(null, 'cy', (ty + (box.height / 2)) + 'px');
  1.3626 +    shape.setAttributeNS(null, 'rx', (tw / 2) + 'px');
  1.3627 +    shape.setAttributeNS(null, 'ry', (th / 2) + 'px');   
  1.3628 + 
  1.3629 +        
  1.3630 +  }
  1.3631 +   else 
  1.3632 + if(shape.tagName == 'line')
  1.3633 +  { 
  1.3634 +    shape.setAttributeNS(null, 'x1', tx + 'px');
  1.3635 +    shape.setAttributeNS(null, 'y1', ty + 'px');
  1.3636 +    shape.setAttributeNS(null, 'x2', tx + tw + 'px');
  1.3637 +    shape.setAttributeNS(null, 'y2', ty + th + 'px');  
  1.3638 +         
  1.3639 +  }
  1.3640 +   else
  1.3641 + if (shape.tagName == 'polyline') 
  1.3642 +  {
  1.3643 +   
  1.3644 +  }
  1.3645 +   else 
  1.3646 + if (shape.tagName == 'image') 
  1.3647 +  {   
  1.3648 +    shape.setAttributeNS(null,'x',tx);
  1.3649 +    shape.setAttributeNS(null,'y',ty);   
  1.3650 +    shape.setAttributeNS(null, 'width', tw);     
  1.3651 +    shape.setAttributeNS(null, 'height', th); 
  1.3652 +      
  1.3653 +  }
  1.3654 +   else 
  1.3655 + if (shape.tagName == 'path')
  1.3656 +  {     
  1.3657 +     // var xscale=  box.width/tw;
  1.3658 +     // var yscale=  box.height/th;  
  1.3659 +      var xscale=  tw/box.width;
  1.3660 +      var yscale=  th/box.height;  
  1.3661 +      var xinc=xscale;//dist*angx;
  1.3662 +      var yinc=yscale/ty;//dist*angy;   
  1.3663 +
  1.3664 +   if(scaleType== 'n')
  1.3665 +    {
  1.3666 +       tx=box.x+(box.width/2);
  1.3667 +       ty=box.y+box.height; 
  1.3668 +       var xinc=1;
  1.3669 +       var yinc=box.y/toY;//dist*angy;   
  1.3670 +
  1.3671 +    } 
  1.3672 +   if(scaleType== 's')
  1.3673 +    {
  1.3674 +       tx=box.x+(box.width/2);
  1.3675 +       ty=box.y; 
  1.3676 +       var xinc=1;
  1.3677 +       var yinc=toY/(box.y+box.height);//dist*angy;   
  1.3678 +    }    
  1.3679 +   if(scaleType== 'e')
  1.3680 +    {
  1.3681 +       tx=box.x;
  1.3682 +       ty=box.y+(box.height/2);  
  1.3683 +       var xinc=toX/(box.x+box.width);
  1.3684 +       var yinc=1;   
  1.3685 +
  1.3686 +    }         
  1.3687 +   if(scaleType== 'w')
  1.3688 +    {
  1.3689 +       tx=box.x+box.width;
  1.3690 +       ty=box.y+(box.height/2); 
  1.3691 +       var xinc=box.x/toX;
  1.3692 +       var yinc=1;   
  1.3693 +
  1.3694 +    }
  1.3695 +   if(scaleType== 'ne')
  1.3696 +    {
  1.3697 +       tx=box.x;
  1.3698 +       ty=box.y+box.height; 
  1.3699 +       var xinc=toX/(box.x+box.width);
  1.3700 +       var yinc=xinc;   
  1.3701 +    }  
  1.3702 +  if(scaleType== 'nw')
  1.3703 +    {
  1.3704 +       tx=box.x+box.width;
  1.3705 +       ty=box.y+box.height; 
  1.3706 +       var xinc=box.x/toX;
  1.3707 +       var yinc=xinc;   
  1.3708 +    } 
  1.3709 +   if(scaleType== 'se')
  1.3710 +    {
  1.3711 +       tx=box.x;
  1.3712 +       ty=box.y; 
  1.3713 +       var xinc=toX/(box.x+box.width);
  1.3714 +       var yinc=xinc;   
  1.3715 +    }    
  1.3716 +   if(scaleType== 'sw')
  1.3717 +    {
  1.3718 +       tx=(box.x+box.width);
  1.3719 +       ty=box.y; 
  1.3720 +       var xinc=box.x/toX;
  1.3721 +       var yinc=xinc;   
  1.3722 +    }        
  1.3723 +      if(xinc==0){ xinc= 0.0000001;}
  1.3724 +      if(yinc==0){ yinc= 0.0000001; }
  1.3725 +      var prevpath=previus.getAttributeNS(null, 'd');
  1.3726 +     var path=shape.getAttributeNS(null, 'd');
  1.3727 +////////////
  1.3728 +
  1.3729 +
  1.3730 +      //xshe=left;
  1.3731 +      //yshe=top;
  1.3732 +       
  1.3733 + path=path.replace(/, /g, ','); 
  1.3734 + path=path.replace(/ ,/g, ',');
  1.3735 + var ps =path.split(" ")
  1.3736 + var pcc = "";
  1.3737 + var point =ps[0].split(","); 
  1.3738 +
  1.3739 +
  1.3740 + var num0= parseFloat(point[0].substring(1));
  1.3741 + var num1= parseFloat(point[1]);     
  1.3742 + 
  1.3743 +
  1.3744 + var ang= ang2v(box.x,box.y,tx,ty) ;
  1.3745 + var angle = Math.round((ang/Math.PI* 2)* 360);
  1.3746 + var angx = Math.cos(ang); 
  1.3747 + var angy = Math.sin(ang);          
  1.3748 + var dist= dist2p(tx,ty,box.x,box.y);
  1.3749 + //var xinc=xscale;//dist*angx;
  1.3750 + //var yinc=yscale;//dist*angy;   
  1.3751 +    var re = /^[-]?\d*\.?\d*$/; 
  1.3752 +    var axis = $V([tx,ty]);
  1.3753 + for(var i = 0; i < ps.length; i++)
  1.3754 +  { 
  1.3755 +   if(ps[i].indexOf(',')>0){  
  1.3756 +     
  1.3757 +      var point =ps[i].split(","); 
  1.3758 +       var char1=point[0].substring(0,1); 
  1.3759 +       if(char1=='A' || char1=='a'){isArc=true; contArc=0;}
  1.3760 +       if(isArc==true){contArc++}
  1.3761 +       if(contArc==4){contArc=0; isArc=false}
  1.3762 +       
  1.3763 +       //if (isNaN(valnum)) 
  1.3764 +      if (!char1.match(re))        
  1.3765 +       { 
  1.3766 +           var num0= parseFloat(point[0].substring(1));
  1.3767 +           var text=char1;
  1.3768 +       }else{ 
  1.3769 +         if(isArc==true && contArc==2  )
  1.3770 +          {
  1.3771 +            var num0= point[0];
  1.3772 +          }else{  
  1.3773 +            var num0= parseFloat(point[0]);
  1.3774 +          }  
  1.3775 +         var text='';
  1.3776 +
  1.3777 +       }
  1.3778 + 
  1.3779 +       
  1.3780 +       if(isArc==true && contArc==2)
  1.3781 +        {   
  1.3782 +           point[1]= point[1].toString() ;
  1.3783 +        }
  1.3784 +        else
  1.3785 +        {    
  1.3786 +         
  1.3787 +          //num0*=xinc;    
  1.3788 +          point[1]= parseFloat(point[1]);
  1.3789 +          //point[1]*=yinc;
  1.3790 +          var pointIni=$V([num0,point[1],1]);
  1.3791 +          var matrT = $M([[1,0,-tx],[0,1,-ty],[0,0,1]]);
  1.3792 +          var matrS = $M([[xinc,0,0],[0,yinc,0],[0,0,1]]); 
  1.3793 +          var matrR = $M([[1,0,tx],[0,1,ty],[0,0,1]]);
  1.3794 +          var matr1= matrT.x(pointIni);  
  1.3795 +          var matr2= matrS.x(matr1);
  1.3796 +          //var pointR=pointIni.Random(1) 
  1.3797 +          //var pointR=pointIni.rotate(Math.PI/180,axis);
  1.3798 +          //var pointRc=pointIni.cross(axis); 
  1.3799 +          //var pointR=matr2;
  1.3800 +          var pointR=matrR.x(matr2);  
  1.3801 +          num0=pointR.elements[0];
  1.3802 +           point[1]=pointR.elements[1];
  1.3803 +           $('code').value=pointIni.elements[0]+','+pointR.elements[1]+' ';
  1.3804 +        }  
  1.3805 +       var cx=num0; 
  1.3806 +        var cy=point[1];   
  1.3807 +        pcc+=text+cx+','+cy+' ';
  1.3808 +        //pcc+=text+cx+','+cy+' '; 
  1.3809 +       
  1.3810 +   }else{
  1.3811 +      pcc+=ps[i]+' ';
  1.3812 +   }
  1.3813 +  }
  1.3814 +  
  1.3815 +  shape.setAttributeNS(null,'d', pcc);
  1.3816 +
  1.3817 +
  1.3818 +
  1.3819 +//////////////
  1.3820 +/*
  1.3821 + path=path.replace(/, /g, ','); 
  1.3822 + path=path.replace(/ ,/g, ',');
  1.3823 + var ps =path.split(" ")
  1.3824 + var pcc = "";
  1.3825 +
  1.3826 + var xinc=tx-prevbox.x;
  1.3827 + var yinc=ty-prevbox.y;
  1.3828 +  
  1.3829 +    var re = /^[-]?\d*\.?\d*$/;
  1.3830 + for(var i = 0; i < ps.length; i++)
  1.3831 +  { 
  1.3832 +   if(ps[i].indexOf(',')>0){  
  1.3833 +     
  1.3834 +      var point =ps[i].split(","); 
  1.3835 +       var char1=point[0].substring(0,1);
  1.3836 +       point[1]= parseFloat(point[1]); 
  1.3837 +       
  1.3838 +       // var valnum =char1.charAt(0); 
  1.3839 +       //if (isNaN(valnum))
  1.3840 +       if (!char1.match(re)) 
  1.3841 +        
  1.3842 +       {
  1.3843 +         var num0= parseFloat(point[0].substring(1));
  1.3844 +         var text=char1;
  1.3845 +       }else{
  1.3846 +         var num0= parseFloat(point[0]);
  1.3847 +         var text='';
  1.3848 +
  1.3849 +       }
  1.3850 +       //num0+=dist*angx;
  1.3851 +       //point[1]+=dist*angy;
  1.3852 +         num0*=xscale;
  1.3853 +        point[1]*=yscale;   
  1.3854 +        
  1.3855 +      // num0+=xinc;
  1.3856 +      // point[1]+=yinc;
  1.3857 +       
  1.3858 +      
  1.3859 +        
  1.3860 +        var cx=num0;
  1.3861 +        var cy=point[1]; 
  1.3862 +        pcc+=text+cx+','+cy+' ';
  1.3863 +   }else{
  1.3864 +      pcc+=ps[i]+' ';
  1.3865 +   }
  1.3866 +  }
  1.3867 +
  1.3868 +
  1.3869 +   
  1.3870 +    
  1.3871 +  
  1.3872 +   // $('code').value=dist+' '+ ang+' '+'__'+x+'= '+left+'/ '+y+'= ' +top+'';
  1.3873 +    
  1.3874 +       //shape.setAttributeNS(null,'transform', "rotate("+left+")");
  1.3875 +       
  1.3876 +       // shape.setAttributeNS(null,'transform', "translate("+trax+","+tray+") rotate("+0+") scale(1,1)");
  1.3877 +         shape.setAttributeNS(null,'d', pcc);
  1.3878 +
  1.3879 +    
  1.3880 +    
  1.3881 +    
  1.3882 +    
  1.3883 +    
  1.3884 +    
  1.3885 +       //document.forms[0].code.value='';
  1.3886 +       //shape.setAttributeNS(null,'transform', "scale("+trans_ShareScale+")"); 
  1.3887 + */      
  1.3888 +
  1.3889 +  }  
  1.3890 +   	                             
  1.3891 +
  1.3892 +
  1.3893 +
  1.3894 +
  1.3895 +
  1.3896 +
  1.3897 +
  1.3898 +	
  1.3899 +	
  1.3900 +	
  1.3901 +	
  1.3902 +	
  1.3903 +//$('status').innerHTML=typeTransform+': '+shareScale;  
  1.3904 +       
  1.3905 +  
  1.3906 +};
  1.3907 +
  1.3908 +
  1.3909 +SVGRenderer.prototype.rotateShape = function(shape, previus, toX, toY) {
  1.3910 +      
  1.3911 +    //document.getElementById('richdraw').style.cursor='e-resize';
  1.3912 +     	 var box = shape.getBBox();  
  1.3913 +	 var prevbox=previus.getBBox();
  1.3914 +	var centerx= box.x+(box.width/2);
  1.3915 +	var centery= box.y+(box.height/2); 
  1.3916 +	var coord=this.editor.viewInputxy;
  1.3917 +
  1.3918 +       var actual_angle=ang2v(centerx,centery,coord[0], coord[1]);
  1.3919 +       
  1.3920 +       if(xrot<toX) { rotatexxx+=1;}else{rotatexxx-=1;}
  1.3921 +       xrot=toX;
  1.3922 +       yrot=toY;  
  1.3923 +       
  1.3924 +	var xtr=0;
  1.3925 +        var ytr=0;
  1.3926 +                
  1.3927 +        var box= shape.getBBox();  
  1.3928 +        var tr1x=  box.x;  
  1.3929 +         var tr1y=  box.y;
  1.3930 +
  1.3931 + 
  1.3932 + 
  1.3933 +    toX+=xtr;
  1.3934 +        toY+=xtr;
  1.3935 +
  1.3936 +      //var trax=parseFloat(toX-box.x);   var tray= parseFloat(toY-box.y);      
  1.3937 +      var trax=parseFloat(box.x/2);   var tray= parseFloat(box.y/2); 
  1.3938 +       var angler=Math.atan2(toX,toY);
  1.3939 +         var angle=angler*180/Math.PI;  
  1.3940 +          var T = shape.getCTM(); 
  1.3941 +          var rotini=T.a*(180 / Math.PI);
  1.3942 +                   var angle=rotini*180/Math.PI;
  1.3943 +          var rot_angle=actual_angle*180/Math.PI;  
  1.3944 +          this.editor.log(centerx+' '+centery+' '+coord[0]+' '+coord[1]+'____ '+rot_angle+' '+actual_angle*180/Math.PI);
  1.3945 +          
  1.3946 +          
  1.3947 +         // matrix( a, b, c, d, e, f )
  1.3948 +         // a c e
  1.3949 +         // b d f
  1.3950 +         // 0 0 1
  1.3951 +         //a scale factor of 2, a rotation of 30 deg and a translation of (500,50)
  1.3952 +         //T     1.732   -1   500     1   1.732   50     0   0   1
  1.3953 +         //T      1  ad-bc      d  -c -de+cf   -b  a  be-df    0   0   1
  1.3954 +         
  1.3955 +         //shape.setAttributeNS(null,'transform', "translate("+(-xshe)+","+(-yshe)+")");
  1.3956 + 
  1.3957 +         // shape.setAttributeNS(null,"transform", "  matrix( a, b, c, d, e, f )");
  1.3958 +          // shape.setAttributeNS(null,'transform', "translate("+(box.x+(box.width/2))+","+(box.y+(box.height/2))+")  rotate("+rotatexxx+") ");
  1.3959 +           //shape.setAttributeNS(null,'transform', "translate("+(box.x+(box.width/2))+","+(box.y+(box.height/2))+") rotate("+rotatexxx+") translate("+(-box.x-(box.width/2))+","+(-box.y-(box.height/2))+") ");
  1.3960 +         //shape.setAttributeNS(null,'transform', "rotate("+rotatexxx+","+(box.x+(box.width/2))+","+(box.y+(box.height/2))+")");
  1.3961 +         //shape.setAttributeNS(null,'transform', "rotate("+rotatexxx+","+(prevbox.x+(prevbox.width/2))+","+(prevbox.y+(prevbox.height/2))+")");
  1.3962 +         shape.setAttributeNS(null,'transform', "rotate("+rot_angle+","+(prevbox.x+(prevbox.width/2))+","+(prevbox.y+(prevbox.height/2))+")");
  1.3963 +                          
  1.3964 +         
  1.3965 +         //alert('[  ['+T.a+'  '+T.c+'  '+T.e+']  ['+T.b+'  '+T.d+'  '+T.f+']  [0  0  1]  ]');
  1.3966 +        //a,b,c,d,e,f  
  1.3967 +           
  1.3968 +          // shape.setAttributeNS(null,'transform', 'matrix('+T.a+', '+T.b+', '+ T.c+', '+ T.d+', '+ T.e+', '+ T.f+')' );
  1.3969 +          
  1.3970 +          var x1=T.e;
  1.3971 +          var y1=T.f;
  1.3972 +          var sp = Math.sin(rotatexxx*(Math.PI / 180));
  1.3973 +          var cp = Math.cos(rotatexxx*(Math.PI / 180));
  1.3974 +          var x2 = 0 + r*rotatexxx*(Math.PI / 180);
  1.3975 +          var y2 = 0;
  1.3976 +          var r=0; 
  1.3977 +           
  1.3978 +          var a=cp;
  1.3979 +          var c=sp;
  1.3980 +          var e=T.e;
  1.3981 +          var b=T.b;
  1.3982 +          var d=(-x1*cp+y1*sp+x2); 
  1.3983 +          var f=(-x1*sp-y1*cp+y2);
  1.3984 +      
  1.3985 +      var inv=T.inverse;  
  1.3986 +      var inv_mat=T.multiply(inv); 
  1.3987 +       //var matrix = "matrix(" + cp +"," + sp + "," + (-sp) + "," + cp + ","+ (-x1*cp+y1*sp+x2) + ","+ (-x1*sp-y1*cp+y2) + ")";
  1.3988 +       //var matrix = "matrix(" + a +"," + c + "," + e + "," + b + ","+ d + ","+ f + ")";
  1.3989 +      var matrix='matrix('+inv_mat.a+' '+inv_mat.b+' '+inv_mat.c+' '+inv_mat.d+' '+inv_mat.e+' '+inv_mat.f+')'
  1.3990 +      
  1.3991 +       //++ shape.setAttributeNS(null,'transform',matrix); 
  1.3992 +        
  1.3993 +        //shape.setAttributeNS(null,'transform', "rotate("+rotatexxx+")"); 
  1.3994 +        // shape.setAttributeNS(null,'transform', "translate("+(box.x)+","+(box.y)+")");
  1.3995 +        
  1.3996 +         //shape.setAttributeNS(null,'transform', "rotate("+rotatexxx+")");
  1.3997 +               //shape.setAttributeNS(null, 'x', -box.width/2 + 'px');
  1.3998 +               //shape.setAttributeNS(null, 'y', -box.height/2 + 'px');
  1.3999 +         //shape.setAttributeNS(null,"transform", "matrix("+Math.cos(angle)+", "+Math.sin(angle)+", "+Math.sin(-angle)+", "+Math.cos(angle)+", 0, 0 )");
  1.4000 +           //shape.setAttributeNS(null,'transform', "rotate("+10+")"); 
  1.4001 +   
  1.4002 +               //shape.setAttributeNS(null, 'x', box.width/2 + 'px');
  1.4003 +               //shape.setAttributeNS(null, 'y', box.height/2 + 'px');
  1.4004 +      
  1.4005 +                
  1.4006 +  
  1.4007 +          //$('status').innerHTML = 'Mode: Draw '+pointshape +'_'+xsh +' '+ ysh+' '+trshape;
  1.4008 +          
  1.4009 +  //$('status').innerHTML=typeTransform+': '+rotatexxx;  
  1.4010 +    
  1.4011 +};
  1.4012 +
  1.4013 +
  1.4014 +
  1.4015 +// x(u) = x0*(1-u) + x1*u = x0 + (x1-x0)*u
  1.4016 +// y(u) = y0*(1-u) + y1*u = y0 + (y1-y0)*u
  1.4017 +      
  1.4018 +
  1.4019 +
  1.4020 +SVGRenderer.prototype.getshapes = function(){ 
  1.4021 +  var shape = document.getElementById('rectDoc');
  1.4022 +  if (shape) {
  1.4023 +    this.remove(shape);
  1.4024 +  }  
  1.4025 +  var shape = document.getElementById('tracker'); 
  1.4026 +  if (shape) {
  1.4027 +    this.remove(shape);
  1.4028 +  } 
  1.4029 + return this.svgRoot.childNodes;
  1.4030 + // return this.container.childNodes
  1.4031 +    //return this.svgRoot
  1.4032 +} 
  1.4033 +
  1.4034 +SVGRenderer.prototype.reflect = function(HorV) {
  1.4035 +   var shape= c.selected; 
  1.4036 +   var box = shape.getBBox();  
  1.4037 +    
  1.4038 + if(shape.tagName=="path")
  1.4039 +  {
  1.4040 +  
  1.4041 +      var tx=box.x+(box.width/2);
  1.4042 +      var ty=box.y+(box.height/2);  
  1.4043 +    
  1.4044 +    if(HorV=='V'){  
  1.4045 +       var xinc=-1;
  1.4046 +       var yinc=1;   
  1.4047 +     }
  1.4048 +    if(HorV=='H'){  
  1.4049 +       var xinc=1;
  1.4050 +       var yinc=-1;   
  1.4051 +     }
  1.4052 +
  1.4053 +
  1.4054 +   var path=shape.getAttributeNS(null, 'd');
  1.4055 +   path=path.replace(/, /g, ','); 
  1.4056 +   path=path.replace(/ ,/g, ',');
  1.4057 +   var ps =path.split(" ")
  1.4058 +   var pcc = "";
  1.4059 +   var point =ps[0].split(","); 
  1.4060 +
  1.4061 +
  1.4062 +   var num0= parseFloat(point[0].substring(1));
  1.4063 +   var num1= parseFloat(point[1]);     
  1.4064 + 
  1.4065 +    var re = /^[-]?\d*\.?\d*$/; 
  1.4066 +    var axis = $V([tx,ty]);
  1.4067 +
  1.4068 +   for(var i = 0; i < ps.length; i++)
  1.4069 +    { 
  1.4070 +     if(ps[i].indexOf(',')>0){  
  1.4071 +     
  1.4072 +      var point =ps[i].split(","); 
  1.4073 +       var char1=point[0].substring(0,1); 
  1.4074 +       if(char1=='A' || char1=='a'){isArc=true; contArc=0;}
  1.4075 +       if(isArc==true){contArc++}
  1.4076 +       if(contArc==4){contArc=0; isArc=false}
  1.4077 +       
  1.4078 +       //if (isNaN(valnum)) 
  1.4079 +      if (!char1.match(re))        
  1.4080 +       { 
  1.4081 +           var num0= parseFloat(point[0].substring(1));
  1.4082 +           var text=char1;
  1.4083 +       }else{ 
  1.4084 +         if(isArc==true && contArc==2  )
  1.4085 +          {
  1.4086 +            var num0= point[0];
  1.4087 +          }else{  
  1.4088 +            var num0= parseFloat(point[0]);
  1.4089 +          }  
  1.4090 +         var text='';
  1.4091 +
  1.4092 +       }
  1.4093 + 
  1.4094 +       
  1.4095 +       if(isArc==true && contArc==2)
  1.4096 +        {   
  1.4097 +           point[1]= point[1].toString() ;
  1.4098 +        }
  1.4099 +        else
  1.4100 +        {    
  1.4101 +         
  1.4102 +          //num0*=xinc;    
  1.4103 +          point[1]= parseFloat(point[1]);
  1.4104 +          //point[1]*=yinc;
  1.4105 +          var pointIni=$V([num0,point[1],1]);
  1.4106 +          var matrT = $M([[1,0,-tx],[0,1,-ty],[0,0,1]]);
  1.4107 +          var matrS = $M([[xinc,0,0],[0,yinc,0],[0,0,1]]); 
  1.4108 +          var matrR = $M([[1,0,tx],[0,1,ty],[0,0,1]]);
  1.4109 +          var matr1= matrT.x(pointIni);  
  1.4110 +          var matr2= matrS.x(matr1);
  1.4111 +          //var pointR=pointIni.Random(1) 
  1.4112 +          //var pointR=pointIni.rotate(Math.PI/180,axis);
  1.4113 +          //var pointRc=pointIni.cross(axis); 
  1.4114 +          //var pointR=matr2;
  1.4115 +          var pointR=matrR.x(matr2);  
  1.4116 +          num0=pointR.elements[0];
  1.4117 +           point[1]=pointR.elements[1];
  1.4118 +           $('code').value=pointIni.elements[0]+','+pointR.elements[1]+' ';
  1.4119 +        }  
  1.4120 +       var cx=num0; 
  1.4121 +        var cy=point[1];   
  1.4122 +        pcc+=text+cx+','+cy+' ';
  1.4123 +        //pcc+=text+cx+','+cy+' '; 
  1.4124 +       
  1.4125 +     }else{
  1.4126 +       pcc+=ps[i]+' ';
  1.4127 +     }
  1.4128 +    } 
  1.4129 +    var svg =shape.cloneNode(false); 
  1.4130 +    svg.setAttributeNS(null,'d', pcc);  
  1.4131 +    this.svgRoot.appendChild(svg); 
  1.4132 +    return svg;
  1.4133 + }
  1.4134 +  else
  1.4135 + { 
  1.4136 +  if(shape.tagName=="text" || shape.tagName=="image" )
  1.4137 +  {
  1.4138 +
  1.4139 +  
  1.4140 +    var tr='';  
  1.4141 +    var turn0='';
  1.4142 +    var svg =shape.cloneNode(false); 
  1.4143 +    var x= shape.getAttributeNS(null, 'x');
  1.4144 +    var y= shape.getAttributeNS(null, 'y');  
  1.4145 +    x+=box.width/2;
  1.4146 +    y+=box.height/2;
  1.4147 +    if(HorV=='V')
  1.4148 +     {  
  1.4149 +       svg.setAttributeNS(null,'x',-parseFloat(x));  
  1.4150 +       var scaleSim='-1, 1';
  1.4151 +       svg.setAttributeNS(null,'transform','scale('+scaleSim+')');  
  1.4152 +       //svg.setAttributeNS(null,'y',parseFloat(x));  
  1.4153 +       svg.setAttributeNS(null,'x',-parseFloat(x));  
  1.4154 +
  1.4155 +
  1.4156 +     }
  1.4157 +    if(HorV=='H')
  1.4158 +     {  
  1.4159 +       var scaleSim='1, -1';
  1.4160 +       svg.setAttributeNS(null,'y',-parseFloat(y));  
  1.4161 +       svg.setAttributeNS(null,'transform','scale('+scaleSim+')');  
  1.4162 +       //svg.setAttributeNS(null,'x',parseFloat(x));  
  1.4163 +       svg.setAttributeNS(null,'y',-parseFloat(y));  
  1.4164 +
  1.4165 +
  1.4166 +     } 
  1.4167 +
  1.4168 +    if(shape.hasAttributeNS(null, 'transform'))
  1.4169 +     { 
  1.4170 +      tr=shape.getAttributeNS(null, 'transform');  
  1.4171 +      turn0=GetString(tr,'rotate(',')');
  1.4172 +
  1.4173 +      svg.setAttributeNS(null,'transform','rotate('+turn+'),scale('+scaleSim+')');  
  1.4174 +      svg.setAttributeNS(null,'x',parseFloat(x));  
  1.4175 +      svg.setAttributeNS(null,'y',parseFloat(y));  
  1.4176 +      
  1.4177 +      //svg.setAttributeNS(null,'transform','rotate('+turn+'),scale('+'');  
  1.4178 +     }else{
  1.4179 +       
  1.4180 +     }   
  1.4181 +     
  1.4182 +    
  1.4183 +    
  1.4184 +     if(shape.tagName=="text"){  
  1.4185 +        var text=shape.textContent ; 
  1.4186 +        svg.textContent=text;     
  1.4187 +     }
  1.4188 +     //svg.setAttributeNS(null,'writing-mode',mode); 
  1.4189 +     //svg.setAttributeNS(null,'glyph-orientation-horizontal','0deg');
  1.4190 +     //
  1.4191 +     //svg.appendChild(text); 
  1.4192 +   
  1.4193 +     this.svgRoot.appendChild(svg); 
  1.4194 +     return svg;
  1.4195 +  }
  1.4196 +  else
  1.4197 +  {
  1.4198 +  if(shape.hasAttributeNS(null, 'transform'))
  1.4199 +   { 
  1.4200 +   
  1.4201 +     
  1.4202 +     var tr=shape.getAttributeNS(null, 'transform');  
  1.4203 +     var turn0=GetString(tr, 'rotate(',',');
  1.4204 +     turn0=parseFloat(turn0); 
  1.4205 +     //alert(turn0);
  1.4206 +     
  1.4207 +     if(HorV=='V'){  
  1.4208 +       var angle=180;
  1.4209 +       //var turn=(turn0+angle)-(turn0-90);  
  1.4210 +       var turn=turn0+((angle-turn0)*2); 
  1.4211 +     }
  1.4212 +    if(HorV=='H'){  
  1.4213 +       var angle=90;
  1.4214 +       var turn=turn0+((angle-turn0)*2);   
  1.4215 +     }       
  1.4216 +     var centerx= box.x+(box.width/2);
  1.4217 +     var centery= box.y+(box.height/2); 
  1.4218 +     //this.editor.log(centerx+' '+centery+' '+coord[0]+' '+coord[1]+'____ '+rot_angle+' '+actual_angle*180/Math.PI);
  1.4219 +     var svg =shape.cloneNode(false); 
  1.4220 +     svg.setAttributeNS(null,'transform', "rotate("+turn+","+centerx+","+centery+")");
  1.4221 +     this.svgRoot.appendChild(svg); 
  1.4222 +    return svg;
  1.4223 +   }
  1.4224 +    else
  1.4225 +   {  
  1.4226 +     var centerx= box.x+(box.width/2);
  1.4227 +     var centery= box.y+(box.height/2); 
  1.4228 +     shape.setAttributeNS(null,'transform', "rotate("+180+","+centerx+","+centery+")");
  1.4229 +
  1.4230 +   }
  1.4231 +  } 
  1.4232 + }
  1.4233 +};
  1.4234 +//http://dev.opera.com/articles/view/svg-evolution-2-our-first-steps-into-sv/?page=3
  1.4235 +//http://www.w3.org/TR/2000/03/WD-SVG-20000303/exchange.html#StylingAttributes
  1.4236 +//http://www.xml.com/lpt/a/1390
  1.4237 +
  1.4238 +
  1.4239 +
  1.4240 +
  1.4241 +
  1.4242 +
  1.4243 +
  1.4244 +//http://xml-utils.com/conferencia-svg.html#d0e527
  1.4245 +//http://www.xml.com/lpt/a/1321
  1.4246 +//http://phrogz.net/objjob/object.asp?id=101
  1.4247 +//http://admisource.gouv.fr/plugins/scmcvs/cvsweb.php/Cassini-ihm/js-yosemite/mapApp.js?rev=1.1;cvsroot=cassini
  1.4248 +//http://groups.google.com/group/prototype-graphic/msg/0547c0caea8869c6 
  1.4249 +//http://sylvester.jcoglan.com/ 
  1.4250 \ No newline at end of file