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 // This file contains the declarations for the abstract Overlay element 27 // and the concrete GroundOverlay, ScreenOverlay, and PhotoOverlay elements 28 // and their child elements LatLonBox, OverlayXY, ScreenXY, RotationXY, 29 // Size, ViewVolume, and ImagePyramid. 30 31 #ifndef KML_DOM_OVERLAY_H__ 32 #define KML_DOM_OVERLAY_H__ 33 34 #include "kml/base/color32.h" 35 #include "kml/dom/abstractlatlonbox.h" 36 #include "kml/dom/feature.h" 37 #include "kml/dom/geometry.h" 38 #include "kml/dom/kml22.h" 39 #include "kml/dom/kml_ptr.h" 40 #include "kml/dom/link.h" 41 #include "kml/dom/object.h" 42 #include "kml/dom/vec2.h" 43 44 namespace kmldom { 45 46 class Serializer; 47 class Visitor; 48 class VisitorDriver; 49 50 // OGC KML 2.2 Standard: 11.1 kml:AbstractOverlayGroup 51 // OGC KML 2.2 XSD: <element name="AbstractOverlayGroup"... 52 class Overlay : public Feature { 53 public: 54 virtual ~Overlay(); Type()55 virtual KmlDomType Type() const { return Type_Overlay; } IsA(KmlDomType type)56 virtual bool IsA(KmlDomType type) const { 57 return type == Type_Overlay || Feature::IsA(type); 58 } 59 60 // <color> get_color()61 const kmlbase::Color32& get_color() const { 62 return color_; 63 } has_color()64 bool has_color() const { 65 return has_color_; 66 } set_color(const kmlbase::Color32 & color)67 void set_color(const kmlbase::Color32& color) { 68 color_ = color; 69 has_color_ = true; 70 } clear_color()71 void clear_color() { 72 color_ = kmlbase::Color32(0xffffffff); 73 has_color_ = false; 74 } 75 76 // <drawOrder> get_draworder()77 int get_draworder() const { 78 return draworder_; 79 } has_draworder()80 bool has_draworder() const { 81 return has_draworder_; 82 } set_draworder(int draworder)83 void set_draworder(int draworder) { 84 draworder_ = draworder; 85 has_draworder_ = true; 86 } clear_draworder()87 void clear_draworder() { 88 draworder_ = 0; 89 has_draworder_ = false; 90 } 91 92 // <Icon> get_icon()93 const IconPtr& get_icon() const { return icon_; } has_icon()94 bool has_icon() const { return icon_ != NULL; } set_icon(const IconPtr & icon)95 void set_icon(const IconPtr& icon) { 96 SetComplexChild(icon, &icon_); 97 } clear_icon()98 void clear_icon() { 99 set_icon(NULL); 100 } 101 102 // Visitor API methods, see visitor.h. 103 virtual void AcceptChildren(VisitorDriver* driver); 104 105 protected: 106 // Overlay is abstract. 107 Overlay(); 108 virtual void AddElement(const ElementPtr& element); 109 virtual void Serialize(Serializer& serializer) const; 110 111 private: 112 kmlbase::Color32 color_; 113 bool has_color_; 114 int draworder_; 115 bool has_draworder_; 116 IconPtr icon_; 117 LIBKML_DISALLOW_EVIL_CONSTRUCTORS(Overlay); 118 }; 119 120 // <LatLonBox> 121 class LatLonBox : public AbstractLatLonBox { 122 public: 123 virtual ~LatLonBox(); Type()124 virtual KmlDomType Type() const { return Type_LatLonBox; } IsA(KmlDomType type)125 virtual bool IsA(KmlDomType type) const { 126 return type == Type_LatLonBox || AbstractLatLonBox::IsA(type); 127 } 128 129 // <rotation> get_rotation()130 double get_rotation() const { 131 return rotation_; 132 } has_rotation()133 bool has_rotation() const { 134 return has_rotation_; 135 } set_rotation(double rotation)136 void set_rotation(double rotation) { 137 rotation_ = rotation; 138 has_rotation_ = true; 139 } clear_rotation()140 void clear_rotation() { 141 rotation_ = 0.0; 142 has_rotation_ = false; 143 } 144 145 // Visitor API methods, see visitor.h. 146 virtual void Accept(Visitor* visitor); 147 148 private: 149 friend class KmlFactory; 150 LatLonBox(); 151 friend class KmlHandler; 152 virtual void AddElement(const ElementPtr& element); 153 friend class Serializer; 154 virtual void Serialize(Serializer& serializer) const; 155 156 private: 157 double rotation_; 158 bool has_rotation_; 159 160 LIBKML_DISALLOW_EVIL_CONSTRUCTORS(LatLonBox); 161 }; 162 163 // <gx:LatLonQuad> 164 class GxLatLonQuad : public Object { 165 public: 166 virtual ~GxLatLonQuad(); ElementType()167 static KmlDomType ElementType() { return Type_GxLatLonQuad; } Type()168 virtual KmlDomType Type() const { return ElementType(); } IsA(KmlDomType type)169 virtual bool IsA(KmlDomType type) const { 170 return type == ElementType() || Object::IsA(type); 171 } 172 173 // <coordinates> get_coordinates()174 const CoordinatesPtr& get_coordinates() const { return coordinates_; } has_coordinates()175 bool has_coordinates() const { return coordinates_ != NULL; } set_coordinates(const CoordinatesPtr & coordinates)176 void set_coordinates(const CoordinatesPtr& coordinates) { 177 SetComplexChild(coordinates, &coordinates_); 178 } clear_coordinates()179 void clear_coordinates() { 180 set_coordinates(NULL); 181 } 182 183 // Visitor API methods, see visitor.h. 184 virtual void Accept(Visitor* visitor); 185 virtual void AcceptChildren(VisitorDriver* driver); 186 187 private: 188 friend class KmlFactory; 189 GxLatLonQuad(); 190 friend class KmlHandler; 191 virtual void AddElement(const ElementPtr& element); 192 friend class Serializer; 193 virtual void Serialize(Serializer& serializer) const; 194 CoordinatesPtr coordinates_; 195 LIBKML_DISALLOW_EVIL_CONSTRUCTORS(GxLatLonQuad); 196 }; 197 198 // <GroundOverlay> 199 class GroundOverlay : public Overlay { 200 public: 201 virtual ~GroundOverlay(); Type()202 virtual KmlDomType Type() const { return Type_GroundOverlay; } IsA(KmlDomType type)203 virtual bool IsA(KmlDomType type) const { 204 return type == Type_GroundOverlay || Overlay::IsA(type); 205 } 206 207 // <altitude> get_altitude()208 double get_altitude() const { 209 return altitude_; 210 } has_altitude()211 bool has_altitude() const { 212 return has_altitude_; 213 } set_altitude(double altitude)214 void set_altitude(double altitude) { 215 altitude_ = altitude; 216 has_altitude_ = true; 217 } clear_altitude()218 void clear_altitude() { 219 altitude_ = 0.0; 220 has_altitude_ = false; 221 } 222 223 // <altitudeMode> get_altitudemode()224 int get_altitudemode() const { 225 return altitudemode_; 226 } has_altitudemode()227 bool has_altitudemode() const { 228 return has_altitudemode_; 229 } set_altitudemode(int altitudemode)230 void set_altitudemode(int altitudemode) { 231 altitudemode_ = altitudemode; 232 has_altitudemode_ = true; 233 } clear_altitudemode()234 void clear_altitudemode() { 235 altitudemode_ = ALTITUDEMODE_CLAMPTOGROUND; 236 has_altitudemode_ = false; 237 } 238 239 // <gx:altitudeMode> get_gx_altitudemode()240 int get_gx_altitudemode() const { 241 return gx_altitudemode_; 242 } has_gx_altitudemode()243 bool has_gx_altitudemode() const { 244 return has_gx_altitudemode_; 245 } set_gx_altitudemode(int gx_altitudemode)246 void set_gx_altitudemode(int gx_altitudemode) { 247 gx_altitudemode_ = gx_altitudemode; 248 has_gx_altitudemode_ = true; 249 } clear_gx_altitudemode()250 void clear_gx_altitudemode() { 251 gx_altitudemode_ = GX_ALTITUDEMODE_CLAMPTOSEAFLOOR; 252 has_gx_altitudemode_ = false; 253 } 254 255 // <LatLonBox> get_latlonbox()256 const LatLonBoxPtr& get_latlonbox() const { return latlonbox_; } has_latlonbox()257 bool has_latlonbox() const { return latlonbox_ != NULL; } set_latlonbox(const LatLonBoxPtr & latlonbox)258 void set_latlonbox(const LatLonBoxPtr& latlonbox) { 259 SetComplexChild(latlonbox, &latlonbox_); 260 } clear_latlonbox()261 void clear_latlonbox() { 262 set_latlonbox(NULL); 263 } 264 265 // <gx:LatLonQuad> get_gx_latlonquad()266 const GxLatLonQuadPtr& get_gx_latlonquad() const { return gx_latlonquad_; } has_gx_latlonquad()267 bool has_gx_latlonquad() const { return gx_latlonquad_ != NULL; } set_gx_latlonquad(const GxLatLonQuadPtr & gx_latlonquad)268 void set_gx_latlonquad(const GxLatLonQuadPtr& gx_latlonquad) { 269 SetComplexChild(gx_latlonquad, &gx_latlonquad_); 270 } clear_gx_latlonquad()271 void clear_gx_latlonquad() { 272 set_gx_latlonquad(NULL); 273 } 274 275 // Visitor API methods, see visitor.h. 276 virtual void Accept(Visitor* visitor); 277 virtual void AcceptChildren(VisitorDriver* driver); 278 279 private: 280 friend class KmlFactory; 281 GroundOverlay(); 282 friend class KmlHandler; 283 virtual void AddElement(const ElementPtr& element); 284 friend class Serializer; 285 virtual void Serialize(Serializer& serializer) const; 286 287 private: 288 double altitude_; 289 bool has_altitude_; 290 int altitudemode_; 291 bool has_altitudemode_; 292 int gx_altitudemode_; 293 bool has_gx_altitudemode_; 294 LatLonBoxPtr latlonbox_; 295 GxLatLonQuadPtr gx_latlonquad_; 296 LIBKML_DISALLOW_EVIL_CONSTRUCTORS(GroundOverlay); 297 }; 298 299 // <overlayXY> 300 class OverlayXY : public Vec2 { 301 public: 302 virtual ~OverlayXY(); Type()303 virtual KmlDomType Type() const { return Type_overlayXY; } IsA(KmlDomType type)304 virtual bool IsA(KmlDomType type) const { 305 return type == Type_overlayXY || Vec2::IsA(type); 306 } 307 308 // Visitor API methods, see visitor.h. 309 virtual void Accept(Visitor* visitor); 310 311 private: 312 friend class KmlFactory; 313 OverlayXY(); 314 LIBKML_DISALLOW_EVIL_CONSTRUCTORS(OverlayXY); 315 }; 316 317 // <screenXY> 318 class ScreenXY : public Vec2 { 319 public: 320 virtual ~ScreenXY(); Type()321 virtual KmlDomType Type() const { return Type_screenXY; } IsA(KmlDomType type)322 virtual bool IsA(KmlDomType type) const { 323 return type == Type_screenXY || Vec2::IsA(type); 324 } 325 326 // Visitor API methods, see visitor.h. 327 virtual void Accept(Visitor* visitor); 328 329 private: 330 friend class KmlFactory; 331 ScreenXY(); 332 LIBKML_DISALLOW_EVIL_CONSTRUCTORS(ScreenXY); 333 }; 334 335 // <rotationXY> 336 class RotationXY : public Vec2 { 337 public: 338 virtual ~RotationXY(); Type()339 virtual KmlDomType Type() const { return Type_rotationXY; } IsA(KmlDomType type)340 virtual bool IsA(KmlDomType type) const { 341 return type == Type_rotationXY || Vec2::IsA(type); 342 } 343 344 // Visitor API methods, see visitor.h. 345 virtual void Accept(Visitor* visitor); 346 347 private: 348 friend class KmlFactory; 349 RotationXY(); 350 LIBKML_DISALLOW_EVIL_CONSTRUCTORS(RotationXY); 351 }; 352 353 // <size> 354 class Size : public Vec2 { 355 public: 356 virtual ~Size(); Type()357 virtual KmlDomType Type() const { return Type_size; } IsA(KmlDomType type)358 virtual bool IsA(KmlDomType type) const { 359 return type == Type_size || Vec2::IsA(type); 360 } 361 362 // Visitor API methods, see visitor.h. 363 virtual void Accept(Visitor* visitor); 364 365 private: 366 friend class KmlFactory; 367 Size(); 368 LIBKML_DISALLOW_EVIL_CONSTRUCTORS(Size); 369 }; 370 371 // <ScreenOverlay> 372 class ScreenOverlay : public Overlay { 373 public: 374 virtual ~ScreenOverlay(); Type()375 virtual KmlDomType Type() const { return Type_ScreenOverlay; } IsA(KmlDomType type)376 virtual bool IsA(KmlDomType type) const { 377 return type == Type_ScreenOverlay || Overlay::IsA(type); 378 } 379 380 // <overlayXY> get_overlayxy()381 const OverlayXYPtr& get_overlayxy() const { return overlayxy_; } has_overlayxy()382 bool has_overlayxy() const { return overlayxy_ != NULL; } set_overlayxy(const OverlayXYPtr & overlayxy)383 void set_overlayxy(const OverlayXYPtr& overlayxy) { 384 SetComplexChild(overlayxy, &overlayxy_); 385 } clear_overlayxy()386 void clear_overlayxy() { 387 set_overlayxy(NULL); 388 } 389 390 // <screenXY> get_screenxy()391 const ScreenXYPtr& get_screenxy() const { return screenxy_; } has_screenxy()392 bool has_screenxy() const { return screenxy_ != NULL; } set_screenxy(const ScreenXYPtr & screenxy)393 void set_screenxy(const ScreenXYPtr& screenxy) { 394 SetComplexChild(screenxy, &screenxy_); 395 } clear_screenxy()396 void clear_screenxy() { 397 set_screenxy(NULL); 398 } 399 400 // <rotationXY> get_rotationxy()401 const RotationXYPtr& get_rotationxy() const { return rotationxy_; } has_rotationxy()402 bool has_rotationxy() const { return rotationxy_ != NULL; } set_rotationxy(const RotationXYPtr & rotationxy)403 void set_rotationxy(const RotationXYPtr& rotationxy) { 404 SetComplexChild(rotationxy, &rotationxy_); 405 } clear_rotationxy()406 void clear_rotationxy() { 407 set_rotationxy(NULL); 408 } 409 410 // <size> get_size()411 const SizePtr& get_size() const { return size_; } has_size()412 bool has_size() const { return size_ != NULL; } set_size(const SizePtr & size)413 void set_size(const SizePtr& size) { 414 SetComplexChild(size, &size_); 415 } clear_size()416 void clear_size() { 417 set_size(NULL); 418 } 419 420 // <rotation> get_rotation()421 double get_rotation() const { 422 return rotation_; 423 } has_rotation()424 bool has_rotation() const { 425 return has_rotation_; 426 } set_rotation(double rotation)427 void set_rotation(double rotation) { 428 rotation_ = rotation; 429 has_rotation_ = true; 430 } clear_rotation()431 void clear_rotation() { 432 rotation_ = 0.0; 433 has_rotation_ = false; 434 } 435 436 // Visitor API methods, see visitor.h. 437 virtual void Accept(Visitor* visitor); 438 virtual void AcceptChildren(VisitorDriver* driver); 439 440 private: 441 friend class KmlFactory; 442 ScreenOverlay(); 443 friend class KmlHandler; 444 virtual void AddElement(const ElementPtr& element); 445 friend class Serializer; 446 virtual void Serialize(Serializer& serializer) const; 447 OverlayXYPtr overlayxy_; 448 ScreenXYPtr screenxy_; 449 RotationXYPtr rotationxy_; 450 SizePtr size_; 451 double rotation_; 452 bool has_rotation_; 453 LIBKML_DISALLOW_EVIL_CONSTRUCTORS(ScreenOverlay); 454 }; 455 456 // <ViewVolume> 457 class ViewVolume : public Object { 458 public: 459 virtual ~ViewVolume(); Type()460 virtual KmlDomType Type() const { return Type_ViewVolume; } IsA(KmlDomType type)461 virtual bool IsA(KmlDomType type) const { 462 return type == Type_ViewVolume || Object::IsA(type); 463 } 464 465 // <leftFov> get_leftfov()466 double get_leftfov() const { 467 return leftfov_; 468 } has_leftfov()469 bool has_leftfov() const { 470 return has_leftfov_; 471 } set_leftfov(double leftfov)472 void set_leftfov(double leftfov) { 473 leftfov_ = leftfov; 474 has_leftfov_ = true; 475 } clear_leftfov()476 void clear_leftfov() { 477 leftfov_ = 0.0; 478 has_leftfov_ = false; 479 } 480 481 // <rightFov> get_rightfov()482 double get_rightfov() const { 483 return rightfov_; 484 } has_rightfov()485 bool has_rightfov() const { 486 return has_rightfov_; 487 } set_rightfov(double rightfov)488 void set_rightfov(double rightfov) { 489 rightfov_ = rightfov; 490 has_rightfov_ = true; 491 } clear_rightfov()492 void clear_rightfov() { 493 rightfov_ = 0.0; 494 has_rightfov_ = false; 495 } 496 497 // <bottomFov> get_bottomfov()498 double get_bottomfov() const { 499 return bottomfov_; 500 } has_bottomfov()501 bool has_bottomfov() const { 502 return has_bottomfov_; 503 } set_bottomfov(double altitude)504 void set_bottomfov(double altitude) { 505 bottomfov_ = altitude; 506 has_bottomfov_ = true; 507 } clear_bottomfov()508 void clear_bottomfov() { 509 bottomfov_ = 0.0; 510 has_bottomfov_ = false; 511 } 512 513 // <topFov> get_topfov()514 double get_topfov() const { 515 return topfov_; 516 } has_topfov()517 bool has_topfov() const { 518 return has_topfov_; 519 } set_topfov(double topfov)520 void set_topfov(double topfov) { 521 topfov_ = topfov; 522 has_topfov_ = true; 523 } clear_topfov()524 void clear_topfov() { 525 topfov_ = 0.0; 526 has_topfov_ = false; 527 } 528 529 // <near> get_near()530 double get_near() const { 531 return near_; 532 } has_near()533 bool has_near() const { 534 return has_near_; 535 } set_near(double val)536 void set_near(double val) { 537 near_ = val; 538 has_near_ = true; 539 } clear_near()540 void clear_near() { 541 near_ = 0.0; 542 has_near_ = false; 543 } 544 545 // Visitor API methods, see visitor.h. 546 virtual void Accept(Visitor* visitor); 547 548 private: 549 friend class KmlFactory; 550 ViewVolume(); 551 friend class KmlHandler; 552 virtual void AddElement(const ElementPtr& element); 553 friend class Serializer; 554 virtual void Serialize(Serializer& serializer) const; 555 double leftfov_; 556 bool has_leftfov_; 557 double rightfov_; 558 bool has_rightfov_; 559 double bottomfov_; 560 bool has_bottomfov_; 561 double topfov_; 562 bool has_topfov_; 563 double near_; 564 bool has_near_; 565 LIBKML_DISALLOW_EVIL_CONSTRUCTORS(ViewVolume); 566 }; 567 568 // <ImagePyramid> 569 class ImagePyramid : public Object { 570 public: 571 virtual ~ImagePyramid(); Type()572 virtual KmlDomType Type() const { return Type_ImagePyramid; } IsA(KmlDomType type)573 virtual bool IsA(KmlDomType type) const { 574 return type == Type_ImagePyramid || Object::IsA(type); 575 } 576 577 // <tileSize> get_tilesize()578 int get_tilesize() const { 579 return tilesize_; 580 } has_tilesize()581 bool has_tilesize() const { 582 return has_tilesize_; 583 } set_tilesize(int tilesize)584 void set_tilesize(int tilesize) { 585 tilesize_ = tilesize; 586 has_tilesize_ = true; 587 } clear_tilesize()588 void clear_tilesize() { 589 tilesize_ = 256; 590 has_tilesize_ = false; 591 } 592 593 // <maxWidth> get_maxwidth()594 int get_maxwidth() const { 595 return maxwidth_; 596 } has_maxwidth()597 bool has_maxwidth() const { 598 return has_maxwidth_; 599 } set_maxwidth(int maxwidth)600 void set_maxwidth(int maxwidth) { 601 maxwidth_ = maxwidth; 602 has_maxwidth_ = true; 603 } clear_maxwidth()604 void clear_maxwidth() { 605 maxwidth_ = 0; 606 has_maxwidth_ = false; 607 } 608 609 // <maxHeight> get_maxheight()610 int get_maxheight() const { 611 return maxheight_; 612 } has_maxheight()613 bool has_maxheight() const { 614 return has_maxheight_; 615 } set_maxheight(int altitude)616 void set_maxheight(int altitude) { 617 maxheight_ = altitude; 618 has_maxheight_ = true; 619 } clear_maxheight()620 void clear_maxheight() { 621 maxheight_ = 0; 622 has_maxheight_ = false; 623 } 624 625 // <gridOrigin> get_gridorigin()626 int get_gridorigin() const { 627 return gridorigin_; 628 } has_gridorigin()629 bool has_gridorigin() const { 630 return has_gridorigin_; 631 } set_gridorigin(int gridorigin)632 void set_gridorigin(int gridorigin) { 633 gridorigin_ = gridorigin; 634 has_gridorigin_ = true; 635 } clear_gridorigin()636 void clear_gridorigin() { 637 gridorigin_ = GRIDORIGIN_LOWERLEFT; 638 has_gridorigin_ = false; 639 } 640 641 // Visitor API methods, see visitor.h. 642 virtual void Accept(Visitor* visitor); 643 644 private: 645 friend class KmlFactory; 646 ImagePyramid(); 647 friend class KmlHandler; 648 virtual void AddElement(const ElementPtr& element); 649 friend class Serializer; 650 virtual void Serialize(Serializer& serializer) const; 651 int tilesize_; 652 bool has_tilesize_; 653 int maxwidth_; 654 bool has_maxwidth_; 655 int maxheight_; 656 bool has_maxheight_; 657 int gridorigin_; 658 bool has_gridorigin_; 659 LIBKML_DISALLOW_EVIL_CONSTRUCTORS(ImagePyramid); 660 }; 661 662 // <PhotoOverlay> 663 class PhotoOverlay : public Overlay { 664 public: 665 virtual ~PhotoOverlay(); Type()666 virtual KmlDomType Type() const { return Type_PhotoOverlay; } IsA(KmlDomType type)667 virtual bool IsA(KmlDomType type) const { 668 return type == Type_PhotoOverlay || Overlay::IsA(type); 669 } 670 671 // <rotation> get_rotation()672 double get_rotation() const { 673 return rotation_; 674 } has_rotation()675 bool has_rotation() const { 676 return has_rotation_; 677 } set_rotation(double rotation)678 void set_rotation(double rotation) { 679 rotation_ = rotation; 680 has_rotation_ = true; 681 } clear_rotation()682 void clear_rotation() { 683 rotation_ = 0.0; 684 has_rotation_ = false; 685 } 686 687 // <ViewVolume> get_viewvolume()688 const ViewVolumePtr& get_viewvolume() const { return viewvolume_; } has_viewvolume()689 bool has_viewvolume() const { return viewvolume_ != NULL; } set_viewvolume(const ViewVolumePtr & viewvolume)690 void set_viewvolume(const ViewVolumePtr& viewvolume) { 691 SetComplexChild(viewvolume, &viewvolume_); 692 } clear_viewvolume()693 void clear_viewvolume() { 694 set_viewvolume(NULL); 695 } 696 697 // <ImagePyramid> get_imagepyramid()698 const ImagePyramidPtr& get_imagepyramid() const { return imagepyramid_; } has_imagepyramid()699 bool has_imagepyramid() const { return imagepyramid_ != NULL; } set_imagepyramid(const ImagePyramidPtr & imagepyramid)700 void set_imagepyramid(const ImagePyramidPtr& imagepyramid) { 701 SetComplexChild(imagepyramid, &imagepyramid_); 702 } clear_imagepyramid()703 void clear_imagepyramid() { 704 set_imagepyramid(NULL); 705 } 706 707 // <Point> get_point()708 const PointPtr& get_point() const { return point_; } has_point()709 bool has_point() const { return point_ != NULL; } set_point(const PointPtr & point)710 void set_point(const PointPtr& point) { 711 SetComplexChild(point, &point_); 712 } clear_point()713 void clear_point() { 714 set_point(NULL); 715 } 716 717 // <shape> get_shape()718 int get_shape() const { 719 return shape_; 720 } has_shape()721 bool has_shape() const { 722 return has_shape_; 723 } set_shape(int shape)724 void set_shape(int shape) { 725 shape_ = shape; 726 has_shape_ = true; 727 } clear_shape()728 void clear_shape() { 729 shape_ = SHAPE_RECTANGLE; 730 has_shape_ = false; 731 } 732 733 // Visitor API methods, see visitor.h. 734 virtual void Accept(Visitor* visitor); 735 virtual void AcceptChildren(VisitorDriver* driver); 736 737 private: 738 friend class KmlFactory; 739 PhotoOverlay(); 740 friend class KmlHandler; 741 virtual void AddElement(const ElementPtr& element); 742 friend class Serializer; 743 virtual void Serialize(Serializer& serializer) const; 744 double rotation_; 745 bool has_rotation_; 746 ViewVolumePtr viewvolume_; 747 ImagePyramidPtr imagepyramid_; 748 PointPtr point_; 749 int shape_; 750 bool has_shape_; 751 LIBKML_DISALLOW_EVIL_CONSTRUCTORS(PhotoOverlay); 752 }; 753 754 } // end namespace kmldom 755 756 #endif // KML_DOM_OVERLAY_H__ 757