Code

17bc47beb003a4fc6cd20f98e57adf940626f788
[inkscape.git] / src / extension / dxf2svg / tables2svg_info.cpp
1 /*
2  * Convert DXF table information to a format that is recognized by SVG
3  *
4  * Author:
5  *   Matt Squires <squiresm@colorado.edu>
6  *
7  * Copyright (C) 2005 Matt Squires
8  *
9  * Released under GNU GPL and LGPL, read the file 'GPL.txt' and 'LGPL.txt' for details
10  */
13 #include"tables2svg_info.h"
14 #include<math.h>
15 #include<iostream>
17 char* pattern2dasharray(ltype info, int precision, double scaling, char* out){
18         std::vector< double > pattern = info.ret_pattern();
19         char temp[50];
20         char *out_ptr;
21         
22         
23         if (pattern.size() > 0){
24                 strcat(out," stroke-dasharray=\"");     
25                 for(int i = 0; i < pattern.size()-1;i++){
26                         strcat(out,gcvt(scaling*sqrt(pow(pattern[i],2)),precision,temp) );
27                         strcat(out,",");
28                 }
29                 strcat( out,gcvt(scaling*sqrt(pow(pattern[pattern.size()-1],2)),precision,temp) );
30                 strcat(out,"\" ");
31         }
32         
33         out_ptr = out;
34         return out_ptr;
35 }