20130313
[gdash.git] / src / cave / object / caveobjectline.hpp
blob1c5286dcf184adda5a0bbc170043efc573cdbd78
1 /*
2 * Copyright (c) 2007-2013, Czirkos Zoltan http://code.google.com/p/gdash/
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 #ifndef _GD_CAVEOBJECTLINE
17 #define _GD_CAVEOBJECTLINE
19 #include "config.h"
21 #include "cave/object/caveobject.hpp"
23 /// A line of elements in a cave.
24 class CaveLine: public CaveObject {
25 private:
26 Coordinate p1; ///< Starting coordinate
27 Coordinate p2; ///< Ending coordinate
28 GdElement element; ///< Draw element.
30 public:
31 CaveLine(Coordinate _p1, Coordinate _p2, GdElementEnum _element);
32 CaveLine(): CaveObject(GD_LINE) {}
33 virtual void draw(CaveRendered &cave) const;
34 virtual CaveLine *clone() const { return new CaveLine(*this); }
35 virtual std::string get_bdcff() const;
36 virtual CaveLine* clone_from_bdcff(const std::string &name, std::istream &is) const;
38 private:
39 static PropertyDescription const descriptor[];
41 public:
42 virtual PropertyDescription const* get_description_array() const;
44 virtual void create_drag(Coordinate current, Coordinate displacement);
45 virtual void move(Coordinate current, Coordinate displacement);
46 virtual void move(Coordinate displacement);
47 virtual std::string get_coordinates_text() const;
48 virtual GdElementEnum get_characteristic_element() const { return element; }
49 virtual std::string get_description_markup() const;
52 #endif