Code

First GSoC node tool commit to Bazaar
[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>
16 #include <stdlib.h>
17 #include <string.h>
19 char* pattern2dasharray(ltype info, int precision, double scaling, char* out){
20         std::vector< double > pattern = info.ret_pattern();
21         char temp[50];
22         char *out_ptr;
23         
24         
25         if (pattern.size() > 0){
26                 strcat(out," stroke-dasharray=\"");     
27                 for(int i = 0; i < pattern.size()-1;i++){
28                         strcat(out,gcvt(scaling*sqrt(pow(pattern[i],2)),precision,temp) );
29                         strcat(out,",");
30                 }
31                 strcat( out,gcvt(scaling*sqrt(pow(pattern[pattern.size()-1],2)),precision,temp) );
32                 strcat(out,"\" ");
33         }
34         
35         out_ptr = out;
36         return out_ptr;
37 }