source: git/src/labelinfo.h @ 3cfb265

RELEASE/1.2debug-cidebug-ci-sanitisersfaster-cavernlogstereowalls-datawalls-data-hanging-as-warning
Last change on this file since 3cfb265 was 381ae6e, checked in by Olly Betts <olly@…>, 10 years ago

lib/survex.pot,src/: Make measuring line work from anonymous
stations properly. (Fixes #44)

  • Property mode set to 100644
File size: 3.0 KB
Line 
1//
2//  labelinfo.h
3//
4//  Main frame handling for Aven.
5//
6//  Copyright (C) 2000-2003,2005 Mark R. Shinwell
7//  Copyright (C) 2001-2003,2004,2005,2006,2010,2011,2012,2013,2014 Olly Betts
8//
9//  This program is free software; you can redistribute it and/or modify
10//  it under the terms of the GNU General Public License as published by
11//  the Free Software Foundation; either version 2 of the License, or
12//  (at your option) any later version.
13//
14//  This program is distributed in the hope that it will be useful,
15//  but WITHOUT ANY WARRANTY; without even the implied warranty of
16//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17//  GNU General Public License for more details.
18//
19//  You should have received a copy of the GNU General Public License
20//  along with this program; if not, write to the Free Software
21//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22//
23
24#ifndef labelinfo_h
25#define labelinfo_h
26
27#include "vector3.h"
28#include "wx.h"
29
30// Mac OS X headers pollute the global namespace with generic names like
31// "class Point", which clashes with our "class Point".  So for __WXMAC__
32// put our class in a namespace and define Point as a macro.
33#ifdef __WXMAC__
34namespace svx {
35#endif
36
37class Point : public Vector3 {
38  public:
39    Point() {}
40    Point(const Vector3 & v) : Vector3(v) { }
41    Point(const img_point & pt) : Vector3(pt.x, pt.y, pt.z) { }
42    double GetX() const { return x; }
43    double GetY() const { return y; }
44    double GetZ() const { return z; }
45};
46
47#ifdef __WXMAC__
48}
49#define Point svx::Point
50#endif
51
52#define LFLAG_NOT_ANON          0x01
53#define LFLAG_NOT_WALL          0x02
54#define LFLAG_SURFACE           0x04
55#define LFLAG_UNDERGROUND       0x08
56#define LFLAG_EXPORTED          0x10
57#define LFLAG_FIXED             0x20
58#define LFLAG_ENTRANCE          0x40
59#define LFLAG_HIGHLIGHTED       0x80
60
61class LabelInfo : public Point {
62    wxString text;
63    unsigned width;
64    int flags;
65
66public:
67    wxTreeItemId tree_id;
68
69    LabelInfo() : Point(), text(), flags(0) { }
70    LabelInfo(const img_point &pt, const wxString &text_, int flags_)
71        : Point(pt), text(text_), flags(flags_) {
72        if (text.empty())
73            flags &= ~LFLAG_NOT_ANON;
74    }
75    const wxString & GetText() const { return text; }
76    int get_flags() const { return flags; }
77    void set_flags(int mask) { flags |= mask; }
78    void clear_flags(int mask) { flags &= ~mask; }
79    unsigned get_width() const { return width; }
80    void set_width(unsigned width_) { width = width_; }
81
82    bool IsEntrance() const { return (flags & LFLAG_ENTRANCE) != 0; }
83    bool IsFixedPt() const { return (flags & LFLAG_FIXED) != 0; }
84    bool IsExportedPt() const { return (flags & LFLAG_EXPORTED) != 0; }
85    bool IsUnderground() const { return (flags & LFLAG_UNDERGROUND) != 0; }
86    bool IsSurface() const { return (flags & LFLAG_SURFACE) != 0; }
87    bool IsHighLighted() const { return (flags & LFLAG_HIGHLIGHTED) != 0; }
88    bool IsAnon() const { return (flags & LFLAG_NOT_ANON) == 0; }
89    bool IsWall() const { return (flags & LFLAG_NOT_WALL) == 0; }
90};
91
92#endif
Note: See TracBrowser for help on using the repository browser.