root / tags / v1_1_Build_1004 / libraries / libCq CMS for java.old / src / org / cresques / px / dxf / DxfLwPolyline.java @ 12319
History | View | Annotate | Download (3.1 KB)
1 | 2 | luisw | /*
|
---|---|---|---|
2 | 2809 | nacho | * 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 | 2 | luisw | */
|
24 | package org.cresques.px.dxf; |
||
25 | |||
26 | 2809 | nacho | import org.cresques.cts.IProjection; |
27 | 14 | luisw | |
28 | import org.cresques.io.DxfGroup; |
||
29 | 2 | luisw | |
30 | 2809 | nacho | import java.awt.geom.Point2D; |
31 | |||
32 | import java.util.Vector; |
||
33 | |||
34 | |||
35 | 2 | luisw | /**
|
36 | 2809 | nacho | * Entidad LWPOLYLINE de un fichero DXF.
|
37 | 2 | luisw | * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
|
38 | 2809 | nacho | * @author jmorell
|
39 | 2 | luisw | */
|
40 | public class DxfLwPolyline extends DxfPolyline { |
||
41 | 2809 | nacho | |
42 | /**
|
||
43 | * Constructor de DxfLwPolyline.
|
||
44 | * @param proj, proyecci?n cartogr?fica en la que se encuentra la DxfLwPolyline.
|
||
45 | * @param layer, capa del DXF en la que se encuentra la DxfLwPolyline.
|
||
46 | */
|
||
47 | public DxfLwPolyline(IProjection proj, DxfLayer layer) {
|
||
48 | super(proj, layer);
|
||
49 | } |
||
50 | 13 | luisw | |
51 | 2809 | nacho | /**
|
52 | * Permite la escritura de entidades DxfLwPolyline en un fichero DXF2000.
|
||
53 | * @return String, la cadena que se escribir? en el fichero con la informaci?n
|
||
54 | * de la DxfLwPolyline.
|
||
55 | */
|
||
56 | /**
|
||
57 | * 050302, jmorell: Si el 90 no est? antes que el 70, Autocad 2004 no cierra
|
||
58 | * las polil?neas.
|
||
59 | */
|
||
60 | public String toDxfString() { |
||
61 | StringBuffer sb = null; |
||
62 | sb = new StringBuffer(DxfGroup.toString(0, "LWPOLYLINE")); |
||
63 | sb.append(DxfGroup.toString(5, getHandle()));
|
||
64 | sb.append(DxfGroup.toString(100, "AcDbEntity")); |
||
65 | sb.append(DxfGroup.toString(8, layer.getName()));
|
||
66 | sb.append(DxfGroup.toString(62, dxfColor));
|
||
67 | sb.append(DxfGroup.toString(100, "AcDbPolyline")); |
||
68 | sb.append(DxfGroup.toString(90, pts.size()));
|
||
69 | sb.append(DxfGroup.toString(70, flags));
|
||
70 | 3188 | jmorell | sb.append(DxfGroup.toString(38, new Double(getElevation()))); |
71 | 2809 | nacho | |
72 | Point2D pt = null; |
||
73 | double bulge;
|
||
74 | Vector bulges = getBulges();
|
||
75 | |||
76 | /*Iterator iter = pts.iterator();
|
||
77 | while (iter.hasNext()) {
|
||
78 | pt = (Point2D) iter.next();
|
||
79 | sb.append( DxfGroup.toString(10, pt.getX(), 6) );
|
||
80 | sb.append( DxfGroup.toString(20, pt.getY(), 6) );
|
||
81 | }*/
|
||
82 | for (int i = 0; i < pts.size(); i++) { |
||
83 | pt = (Point2D) pts.get(i);
|
||
84 | bulge = ((Double) bulges.get(i)).doubleValue();
|
||
85 | sb.append(DxfGroup.toString(10, pt.getX(), 6)); |
||
86 | sb.append(DxfGroup.toString(20, pt.getY(), 6)); |
||
87 | sb.append(DxfGroup.toString(42, bulge, 6)); |
||
88 | } |
||
89 | |||
90 | return sb.toString();
|
||
91 | } |
||
92 | 2 | luisw | } |