Statistics
| Revision:

svn-gvsig-desktop / branches / CqCMSDvp / libraries / libCq CMS for java.old / src / org / cresques / px / dxf / DxfLwPolyline.java @ 2312

History | View | Annotate | Download (2.51 KB)

1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 * 
4
 * Copyright (C) 2004-5. 
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 * 
22
 * cresques@gmail.com
23
 */
24
package org.cresques.px.dxf;
25

    
26
import java.awt.geom.Point2D;
27
import java.util.Iterator;
28
import java.util.Vector;
29

    
30
import org.cresques.cts.IProjection;
31
import org.cresques.io.DxfGroup;
32

    
33
/**
34
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
35
 * jmorell: Escritura de LwPolylines en formato DXF2000 con arcos.
36
 */
37
public class DxfLwPolyline extends DxfPolyline {
38
        public DxfLwPolyline(IProjection proj, DxfLayer layer) {
39
                super(proj, layer);
40
        }
41
        /**
42
         * jmorell: Escritura de LwPolylines en formato DXF2000 con arcos.
43
         * 050302, jmorell: Si el 90 no est? antes que el 70, Autocad 2004 no cierra
44
         * las polil?neas.
45
         */
46
        public String toDxfString() {
47
                StringBuffer sb = null;
48
                sb = new StringBuffer( DxfGroup.toString(0, "LWPOLYLINE") );
49
                sb.append( DxfGroup.toString(5, getHandle()) );
50
                sb.append( DxfGroup.toString(100, "AcDbEntity") );
51
                sb.append( DxfGroup.toString(8, layer.getName()) );
52
                sb.append( DxfGroup.toString(62, dxfColor) );
53
                sb.append( DxfGroup.toString(100, "AcDbPolyline") );
54
                sb.append( DxfGroup.toString(90, pts.size()) );
55
                sb.append( DxfGroup.toString(70, flags) );
56
                Point2D pt = null;
57
                double bulge;
58
                Vector bulges = getBulges();
59
                /*Iterator iter = pts.iterator();
60
                while (iter.hasNext()) {
61
                        pt = (Point2D) iter.next();
62
                        sb.append( DxfGroup.toString(10, pt.getX(), 6) );
63
                        sb.append( DxfGroup.toString(20, pt.getY(), 6) );
64
                }*/
65
                for (int i=0;i<pts.size();i++) {
66
                        pt = (Point2D)pts.get(i);
67
                        bulge = ((Double)bulges.get(i)).doubleValue();
68
                        sb.append( DxfGroup.toString(10, pt.getX(), 6) );
69
                        sb.append( DxfGroup.toString(20, pt.getY(), 6) );
70
                        sb.append( DxfGroup.toString(42, bulge, 6) );
71
                }
72
                return sb.toString();
73
        }
74
}