~lorzeteam/lorze/trunk

« back to all changes in this revision

Viewing changes to Scripts/lrzdrawline.py

  • Committer: Andreas Ulrich
  • Date: 2012-12-13 20:54:19 UTC
  • Revision ID: ulrich3110@gmail.com-20121213205419-aucgdskqtqmyrj10
new file structure, new object structure, about dialogue, help dialogue, hep pages in english and german, german translation, ponton5h installer, documentation

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
# -*- coding: utf-8 -*-
3
 
 
4
 
# LORZE erasandcad, a 2D CAD with an intuitive user interface, simple and easy.
5
 
# http://erasand.jimdo.com/python-programme/lorze/
6
 
# (C) 2012, Andreas Ulrich
7
 
 
8
 
# This program is free software: you can redistribute it and/or modify  it under  the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
9
 
 
10
 
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
11
 
 
12
 
# You should have received a copy of the GNU General Public License along with this program.  If not, see <http://www.gnu.org/licenses/>.
13
 
 
14
 
from lrzgeohelp import LorzeGeoHelp
15
 
 
16
 
class DrawLine():
17
 
    # line object of LORZE erasandcad
18
 
 
19
 
    def __init__(self):
20
 
        # id, string
21
 
        self.__lrzid= ''
22
 
 
23
 
        # coordinates, float, x1, y1, x2, y2
24
 
        self.__x1, self.__y1, self.__x2, self.__y2= 0.0, 0.0, 0.0, 0.0
25
 
 
26
 
        # colour, string
27
 
        self.__color= ''
28
 
 
29
 
        # layer, string
30
 
        self.__layer= ''
31
 
 
32
 
        # line style, string
33
 
        self.__style= ''
34
 
 
35
 
        # line width, string
36
 
        self.__width= ''
37
 
 
38
 
 
39
 
    def SetId(self, lrzid):
40
 
        self.__lrzid= lrzid
41
 
 
42
 
 
43
 
    def GetId(self):
44
 
        return(self.__lrzid)
45
 
 
46
 
 
47
 
    def SetCoords(self, x1, y1, x2, y2):
48
 
        self.__x1= float(x1)
49
 
        self.__y1= float(y1)
50
 
        self.__x2= float(x2)
51
 
        self.__y2= float(y2)
52
 
 
53
 
 
54
 
    def GetCoords(self):
55
 
        return(self.__x1, self.__y1, self.__x2, self.__y2)
56
 
 
57
 
 
58
 
    def GetRec(self):
59
 
        # get outline rectangle, x, y, w, h
60
 
        geohelp= LorzeGeoHelp()
61
 
        return(geohelp.RectXYtoWH(self.__x1, self.__y1, self.__x2, self.__y2))
62
 
 
63
 
 
64
 
    def SetColor(self, color):
65
 
        self.__color= (color)
66
 
 
67
 
 
68
 
    def GetColor(self):
69
 
        return(self.__color)
70
 
 
71
 
 
72
 
    def SetLayer(self, layer):
73
 
        self.__layer= layer
74
 
 
75
 
 
76
 
    def GetLayer(self):
77
 
        return(self.__layer)
78
 
 
79
 
 
80
 
    def SetStyle(self, style):
81
 
        self.__style= style
82
 
 
83
 
 
84
 
    def GetStyle(self):
85
 
        return(self.__style)
86
 
 
87
 
 
88
 
    def SetWidth(self, width):
89
 
        self.__width= width
90
 
 
91
 
 
92
 
    def GetWidth(self):
93
 
        return(self.__width)
94
 
 
95
 
 
96
 
    def GetX1(self):
97
 
        return(self.__x1)
98
 
 
99
 
 
100
 
    def GetY1(self):
101
 
        return(self.__y1)
102
 
 
103
 
 
104
 
    def GetX2(self):
105
 
        return(self.__x2)
106
 
 
107
 
 
108
 
    def GetY2(self ):
109
 
        return(self.__y2)
110
 
 
111
 
 
112
 
if __name__== '__main__':
113
 
    line= DrawLine()
114
 
    line.SetId('L123456789')
115
 
    line.SetCoords(-20, -30, 20, 30)
116
 
    line.SetColor('Black')
117
 
    line.SetLayer('Test')
118
 
    line.SetStyle('Solid')
119
 
    line.SetWidth('1 mm')
120
 
 
121
 
    print('Element-ID:', line.GetId())
122
 
    print('coordinates:', line.GetCoords())
123
 
    print('X1:', line.GetX1())
124
 
    print('Y1:', line.GetY1())
125
 
    print('X2:', line.GetX2())
126
 
    print('Y2:', line.GetY2())
127
 
    print('outline rectangle:', line.GetRec())
128
 
    print('colour:', line.GetColor())
129
 
    print('layer:', line.GetLayer())
130
 
    print('penstyle:', line.GetStyle())
131
 
    print('pensize:', line.GetWidth())