1 // Copyright 2008, Google Inc. All rights reserved. 2 // 3 // Redistribution and use in source and binary forms, with or without 4 // modification, are permitted provided that the following conditions are met: 5 // 6 // 1. Redistributions of source code must retain the above copyright notice, 7 // this list of conditions and the following disclaimer. 8 // 2. Redistributions in binary form must reproduce the above copyright notice, 9 // this list of conditions and the following disclaimer in the documentation 10 // and/or other materials provided with the distribution. 11 // 3. Neither the name of Google Inc. nor the names of its contributors may be 12 // used to endorse or promote products derived from this software without 13 // specific prior written permission. 14 // 15 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 16 // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 17 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 18 // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 26 #ifndef KML_DOM_LINESTYLE_H__ 27 #define KML_DOM_LINESTYLE_H__ 28 29 #include "kml/dom/colorstyle.h" 30 #include "kml/dom/kml22.h" 31 #include "kml/base/util.h" 32 33 namespace kmldom { 34 35 class Visitor; 36 37 // <LineStyle> 38 class LineStyle : public ColorStyle { 39 public: 40 virtual ~LineStyle(); Type()41 virtual KmlDomType Type() const { return Type_LineStyle; } IsA(KmlDomType type)42 virtual bool IsA(KmlDomType type) const { 43 return type == Type_LineStyle || ColorStyle::IsA(type); 44 } 45 46 // <width> get_width()47 double get_width() const { 48 return width_; 49 } has_width()50 bool has_width() const { 51 return has_width_; 52 } set_width(double width)53 void set_width(double width) { 54 width_ = width; 55 has_width_ = true; 56 } clear_width()57 void clear_width() { 58 width_ = 1.0; 59 has_width_ = false; 60 } 61 62 // Visitor API methods, see visitor.h. 63 virtual void Accept(Visitor* visitor); 64 65 private: 66 friend class KmlFactory; 67 LineStyle(); 68 friend class KmlHandler; 69 virtual void AddElement(const ElementPtr& element); 70 friend class Serializer; 71 virtual void Serialize(Serializer& serialize) const; 72 double width_; 73 bool has_width_; 74 LIBKML_DISALLOW_EVIL_CONSTRUCTORS(LineStyle); 75 }; 76 77 } // end namespace kmldom 78 79 #endif // KML_DOM_LINESTYLE_H__ 80