~ubuntu-branches/ubuntu/intrepid/tcm/intrepid

« back to all changes in this revision

Viewing changes to src/tb/linepiece.h

  • Committer: Bazaar Package Importer
  • Author(s): Otavio Salvador
  • Date: 2003-07-03 20:08:21 UTC
  • Revision ID: james.westby@ubuntu.com-20030703200821-se4xtqx25e5miczi
Tags: upstream-2.20
ImportĀ upstreamĀ versionĀ 2.20

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//------------------------------------------------------------------------------
 
2
// 
 
3
// This file is part of Toolkit for Conceptual Modeling (TCM).
 
4
// (c) copyright 1996, Vrije Universiteit Amsterdam.
 
5
// Author: Frank Dehne (frank@cs.vu.nl).
 
6
//
 
7
// TCM is free software; you can redistribute it and/or modify
 
8
// it under the terms of the GNU General Public License as published by
 
9
// the Free Software Foundation; either version 2 of the License, or
 
10
// (at your option) any later version.
 
11
//
 
12
// TCM is distributed in the hope that it will be useful,
 
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
// GNU General Public License for more details.
 
16
//
 
17
// You should have received a copy of the GNU General Public License
 
18
// along with TCM; if not, write to the Free Software
 
19
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 
20
// 02111-1307, USA.
 
21
//-----------------------------------------------------------------------------
 
22
#ifndef _LINEPIECE_H
 
23
#define _LINEPIECE_H
 
24
 
 
25
#include "point.h"
 
26
#include "linestyle.h"
 
27
class InputFile;
 
28
class OutputFile;
 
29
class Grafport;
 
30
 
 
31
/// horizontal or vertical line (cell boundary).
 
32
class LinePiece {
 
33
/*@Doc: {\large {\bf scope:} table} */
 
34
public:                         
 
35
        ///
 
36
        LinePiece(Grafport *g, Point *from, Point *to, 
 
37
                LineStyle::Type style, unsigned width);
 
38
 
 
39
        ///
 
40
        void Draw();
 
41
        ///
 
42
        void Undraw();
 
43
 
 
44
        /// return iff (x,y) is on line piece
 
45
        bool HitLine(int x, int y); 
 
46
 
 
47
        ///
 
48
        void SetLineStyle(LineStyle::Type t) {
 
49
                lineStyle = t;}
 
50
        ///
 
51
        LineStyle::Type GetLineStyle() {return lineStyle;}
 
52
        ///
 
53
        void UpdateLineStyle(LineStyle::Type t);
 
54
 
 
55
        ///
 
56
        void SetLineWidth(unsigned n) {lineWidth = n;}
 
57
        ///
 
58
        unsigned GetLineWidth() {return lineWidth;}
 
59
        ///
 
60
        void UpdateLineWidth(unsigned n);
 
61
 
 
62
        ///
 
63
        void SetBegin(const Point *pt) {beginP = *pt;}
 
64
        ///
 
65
        void SetEnd(const Point *pt) {endP = *pt;}
 
66
 
 
67
        ///
 
68
        void SetPoints(const Point *pt1, const Point *pt2) 
 
69
                {beginP = *pt1; endP = *pt2;}
 
70
        ///
 
71
        void UpdatePoints(const Point *pt1, const Point *pt2);
 
72
        ///
 
73
        void UpdateBegin(const Point *pt);
 
74
        ///
 
75
        void UpdateEnd(const Point *pt);
 
76
        ///
 
77
        void SetGrafport(Grafport *g) {grafport = g;}
 
78
        ///
 
79
        void Write(OutputFile *f);
 
80
        ///
 
81
        bool Read(InputFile *f, double format);
 
82
        ///
 
83
        Point *GetBegin() {return &beginP;}
 
84
        ///
 
85
        Point *GetEnd() {return &endP;}
 
86
        ///
 
87
        bool IsVisible() {return visible;}
 
88
        ///
 
89
        void SetVisible(bool b) {visible=b;}
 
90
private:
 
91
        /// 
 
92
        Point beginP;
 
93
        ///
 
94
        Point endP;
 
95
        ///
 
96
        bool visible;
 
97
        ///
 
98
        LineStyle::Type lineStyle;
 
99
        ///
 
100
        unsigned lineWidth;
 
101
        ///
 
102
        Grafport *grafport;
 
103
};
 
104
#endif