Statistics
| Revision:

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

History | View | Annotate | Download (2.59 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 org.cresques.io.DxfGroup;
27

    
28
import java.awt.Color;
29

    
30

    
31
/**
32
 * Capas de dxf
33
 * jmorell: Actualizaci?n a la versi?n DXF2000.
34
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
35
 */
36
public class DxfLayer extends DxfTableItem {
37
    int colorNumber = 9;
38
    String lType = "CONTINUOUS";
39
    boolean frozen = false;
40
    boolean isOff = false;
41

    
42
    public DxfLayer(String name) {
43
        super(name, 0);
44
        System.out.println("Dxf: Capa '" + name + "'.");
45
        colorNumber = 255;
46
        lType = "CONTINUOUS";
47
    }
48

    
49
    public DxfLayer(String name, int clr) {
50
        super(name, 0);
51
        colorNumber = clr;
52
        lType = "CONTINUOUS";
53
        System.out.println("DxfLayer name=" + name + ", color=" + colorNumber);
54
    }
55

    
56
    public DxfLayer(String name, int clr, String lType) {
57
        super(name, 0);
58
        colorNumber = clr;
59
        this.lType = lType;
60
    }
61

    
62
    public Color getColor() {
63
        return AcadColor.getColor(colorNumber);
64
    }
65

    
66
    public String toDxfString() {
67
        /*5
68
        10
69
        330
70
        2
71
        100
72
        AcDbSymbolTableRecord
73
        100
74
        AcDbLayerTableRecord
75
          2
76
        0
77
         70
78
             0
79
         62
80
             7
81
          6
82
        Continuous
83
        370
84
            -3
85
        390
86
        F*/
87
        StringBuffer sb = new StringBuffer(LAYER.toString() +
88
                                           super.toDxfString());
89
        sb.append(DxfGroup.toString(5, 10));
90
        sb.append(DxfGroup.toString(100, "AcDbSymbolTableRecord"));
91
        sb.append(DxfGroup.toString(100, "AcDbLayerTableRecord"));
92
        sb.append(DxfGroup.toString(62, colorNumber));
93
        sb.append(DxfGroup.toString(6, lType));
94

    
95
        return sb.toString();
96
    }
97
}