3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // (C) 2010 Underground Software
8 // JLH = James L. Hammons <jlhamm@acm.org>
11 // --- ---------- -----------------------------------------------------------
12 // JLH 06/01/2010 Added this text. :-)
23 RS_Layer::RS_Layer(const QString & name)
27 data.pen.setLineType(RS2::SolidLine);
28 data.pen.setWidth(RS2::Width00);
29 data.pen.setColor(Qt::black);
34 RS_Layer * RS_Layer::clone()
36 return new RS_Layer(*this);
39 /** sets a new name for this layer. */
40 void RS_Layer::setName(const QString & name)
45 /** @return the name of this layer. */
46 QString RS_Layer::getName() const
51 /** sets the default pen for this layer. */
52 void RS_Layer::setPen(const RS_Pen & pen)
57 /** @return default pen for this layer. */
58 RS_Pen RS_Layer::getPen() const
64 * @retval true if this layer is frozen (invisible)
65 * @retval false if this layer isn't frozen (visible)
67 bool RS_Layer::isFrozen() const
70 //getFlag(RS2::FlagFrozen);
74 * @retval true the layer has been converted already
75 * @retval false the layer still needs to be converted
77 bool RS_Layer::isConverted() const
79 return data.converted;
83 * Sets the converted flag
85 void RS_Layer::setConverted(bool c)
91 * Toggles the visibility of this layer.
92 * Freezes the layer if it's not frozen, thaws the layer otherwise
94 void RS_Layer::toggle()
96 //toggleFlag(RS2::FlagFrozen);
97 data.frozen = !data.frozen;
101 * (De-)freezes this layer.
103 * @param freeze true: freeze, false: defreeze
105 void RS_Layer::freeze(bool freeze)
107 data.frozen = freeze;
109 setFlag(RS2::FlagFrozen);
111 delFlag(RS2::FlagFrozen);
116 * Toggles the lock of this layer.
118 void RS_Layer::toggleLock()
120 //toggleFlag(RS2::FlagFrozen);
121 data.locked = !data.locked;
125 * Locks/Unlocks this layer.
127 * @param l true: lock, false: unlock
129 void RS_Layer::lock(bool l)
135 * return the LOCK state of the Layer
137 bool RS_Layer::isLocked()
143 * Copies all attributes (pen) and the name of the layer.
146 RS_Layer & RS_Layer::operator=(const RS_Layer & l)
148 setName(l.getName());
150 setFrozen(l.isFrozen());
156 * Dumps the layers data to stdout.
158 std::ostream & operator<<(std::ostream & os, const RS_Layer & l)
160 os << " name: " << l.getName().toLatin1().data()
161 << " pen: " << l.getPen()
162 << " frozen: " << (int)l.isFrozen()
163 << " address: " << (int)(&l)