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