[libkml] 01/11: Add patches to build swig bindings.
Sebastiaan Couwenberg
sebastic at moszumanska.debian.org
Sun Jul 26 22:22:49 UTC 2015
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository libkml.
commit fc5af4453a3fc89dc526bc8d83bc8520e9319b1d
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Sun Jul 26 17:29:16 2015 +0200
Add patches to build swig bindings.
---
cmake/.#FindMiniZip.cmake | 1 -
debian/changelog | 6 +
debian/control | 47 +
debian/libkml-java.install | 2 +
debian/patches/java-install-path.patch | 21 +
debian/patches/series | 2 +
debian/patches/swig-bindings.patch | 8522 ++++++++++++++++++++++++++++++++
debian/python-kml.install | 1 +
debian/rules | 13 +-
9 files changed, 8609 insertions(+), 6 deletions(-)
diff --git a/cmake/.#FindMiniZip.cmake b/cmake/.#FindMiniZip.cmake
deleted file mode 120000
index d334906..0000000
--- a/cmake/.#FindMiniZip.cmake
+++ /dev/null
@@ -1 +0,0 @@
-rashad at heisenbug.21398:1415096103
\ No newline at end of file
diff --git a/debian/changelog b/debian/changelog
index 19771c8..12624a0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+libkml (1.3.0~r864+git20150723-0fa2f22-1~exp3) UNRELEASED; urgency=medium
+
+ * Add patches to build swig bindings.
+
+ -- Bas Couwenberg <sebastic at debian.org> Sun, 26 Jul 2015 17:14:03 +0200
+
libkml (1.3.0~r864+git20150723-0fa2f22-1~exp2) experimental; urgency=medium
* Update install-paths.patch with upstream changes to fix header installation.
diff --git a/debian/control b/debian/control
index 9a7a5cc..4be6417 100644
--- a/debian/control
+++ b/debian/control
@@ -5,7 +5,9 @@ Uploaders: Francesco Paolo Lovergine <frankie at debian.org>,
Section: science
Priority: optional
Build-Depends: debhelper (>= 9),
+ dh-python,
cmake,
+ default-jdk,
g++ (>= 4:5-0),
g++-5 (>= 5.2.1-10),
libboost-dev,
@@ -14,6 +16,9 @@ Build-Depends: debhelper (>= 9),
libminizip-dev,
liburiparser-dev (>= 0.7.1),
pkg-kde-tools,
+ python-dev (>= 2.6.6-3~),
+ python-all-dev (>= 2.6.6-3~),
+ swig,
zlib1g-dev
Standards-Version: 3.9.6
Vcs-Browser: http://anonscm.debian.org/cgit/pkg-grass/libkml.git
@@ -133,3 +138,45 @@ Description: Library to manipulate KML 2.2 OGC standard files - development file
This package contains files required to build C/C++ programs which use
the KML library.
+
+Package: libkml-java
+Architecture: any
+Section: java
+Depends: libkmlbase1 (= ${binary:Version}),
+ libkmlconvenience1 (= ${binary:Version}),
+ libkmldom1 (= ${binary:Version}),
+ libkmlengine1 (= ${binary:Version}),
+ libkmlregionator1 (= ${binary:Version}),
+ libkmlxsd1 (= ${binary:Version}),
+ ${shlibs:Depends},
+ ${misc:Depends}
+Pre-Depends: ${misc:Pre-Depends}
+Description: Library to manipulate KML 2.2 OGC standard files - Java package
+ This is a library for use with applications that want to parse,
+ generate and operate on KML, a geo-data XML variant. It is an
+ implementation of the OGC KML 2.2 standard. It is written in C++ and
+ bindings are available via SWIG to Java and Python.
+ .
+ This package contains the required packages for Java applications.
+
+Package: python-kml
+Architecture: any
+Section: python
+Depends: libkmlbase1 (= ${binary:Version}),
+ libkmlconvenience1 (= ${binary:Version}),
+ libkmldom1 (= ${binary:Version}),
+ libkmlengine1 (= ${binary:Version}),
+ libkmlregionator1 (= ${binary:Version}),
+ libkmlxsd1 (= ${binary:Version}),
+ ${python:Depends},
+ ${shlibs:Depends},
+ ${misc:Depends}
+Provides: ${python:Provides}
+Description: Library to manipulate KML 2.2 OGC standard files - Python extension
+ This is a library for use with applications that want to parse,
+ generate and operate on KML, a geo-data XML variant. It is an
+ implementation of the OGC KML 2.2 standard. It is written in C++ and
+ bindings are available via SWIG to Java and Python.
+ .
+ This package contains required extensions for Python applications.
+
diff --git a/debian/libkml-java.install b/debian/libkml-java.install
new file mode 100644
index 0000000..a3db66f
--- /dev/null
+++ b/debian/libkml-java.install
@@ -0,0 +1,2 @@
+usr/share/java
+usr/lib/*/libkml*_swig_java.so.*
diff --git a/debian/patches/java-install-path.patch b/debian/patches/java-install-path.patch
new file mode 100644
index 0000000..cce49c9
--- /dev/null
+++ b/debian/patches/java-install-path.patch
@@ -0,0 +1,21 @@
+From 55e0c8f83149e898fdb5e72b5e007f96f693ddc1 Mon Sep 17 00:00:00 2001
+From: Bas Couwenberg <sebastic at xs4all.nl>
+Date: Sun, 26 Jul 2015 17:49:04 +0200
+Subject: [PATCH] Fix Java JAR installation directory, /usr/share/java instead
+ of /usr/lib/java.
+
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -53,7 +53,7 @@ if(NOT DEFINED PYTHON_INSTALL_DIR)
+ set(PYTHON_INSTALL_DIR "${LIB_INSTALL_DIR}/python")
+ endif(NOT DEFINED PYTHON_INSTALL_DIR)
+ if(NOT DEFINED JAVA_INSTALL_DIR)
+- set(JAVA_INSTALL_DIR "${LIB_INSTALL_DIR}/java")
++ set(JAVA_INSTALL_DIR "${DATA_INSTALL_DIR}/java")
+ endif(NOT DEFINED JAVA_INSTALL_DIR)
+
+ # Path to additional CMake modules
diff --git a/debian/patches/series b/debian/patches/series
index ae67119..0f79c0a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,5 @@ compiler-flags.patch
soversion.patch
install-paths.patch
include-path.patch
+swig-bindings.patch
+java-install-path.patch
diff --git a/debian/patches/swig-bindings.patch b/debian/patches/swig-bindings.patch
new file mode 100644
index 0000000..e9b81c5
--- /dev/null
+++ b/debian/patches/swig-bindings.patch
@@ -0,0 +1,8522 @@
+From d05d79a84387bfa96c3bd066fbc5b52bb146b522 Mon Sep 17 00:00:00 2001
+From: Rashad Kanavath <mohammedrashadkm at gmail.com>
+Date: Sun, 26 Jul 2015 02:18:24 +0200
+Subject: [PATCH 1/7] building python bindings
+
+---
+ CMakeLists.txt | 6 +-
+ cmake/pycompile.py | 3 +
+ src/CMakeLists.txt | 2 +-
+ src/swig/CMakeLists.txt | 52 ++
+ src/swig/kmldom.i | 14 +-
+ src/swig/kmlelements.i | 1750 -----------------------------------------
+ src/swig/libkml_kmlelements.i | 1750 +++++++++++++++++++++++++++++++++++++++++
+ 7 files changed, 1816 insertions(+), 1761 deletions(-)
+ create mode 100755 cmake/pycompile.py
+ create mode 100644 src/swig/CMakeLists.txt
+ delete mode 100644 src/swig/kmlelements.i
+ create mode 100644 src/swig/libkml_kmlelements.i
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -11,9 +11,9 @@ option(BUILD_EXAMPLES "Build examples."
+ option(INSTALL_EXAMPLES "Install examples sources and executables" OFF)
+ option(BUILD_SHARED_LIBS "Build shared libs." ON)
+
+-option(BUILD_SWIG "Build swig bindings" OFF)
+-option(BUILD_SWIG_PYTHON "Build python bindings" OFF)
+-option(BUILD_SWIG_JAVA "Build java bindings" OFF)
++option(WITH_SWIG "Build all swig bindings" ON)
++option(WITH_PYTHON "Build python bindings" ON)
++option(WITH_JAVA "Build java bindings" ON)
+
+ set(LIBKML_DATA_DIR ${CMAKE_SOURCE_DIR}/testdata CACHE "Directory containing test data" PATH)
+
+@@ -29,32 +29,32 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMA
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+
+ if(NOT DEFINED BIN_INSTALL_DIR)
+- set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
++ set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
+ endif(NOT DEFINED BIN_INSTALL_DIR)
+ if(NOT DEFINED LIB_INSTALL_DIR)
+- set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib")
++ set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib")
+ endif(NOT DEFINED LIB_INSTALL_DIR)
+ if(NOT DEFINED DATA_INSTALL_DIR)
+- set(DATA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share")
++ set(DATA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share")
+ endif(NOT DEFINED DATA_INSTALL_DIR)
+ if(NOT DEFINED INCLUDE_INSTALL_DIR)
+- set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/kml")
++ set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/kml")
+ endif(NOT DEFINED INCLUDE_INSTALL_DIR)
+ if(NOT DEFINED MAN_INSTALL_DIR)
+- set(MAN_INSTALL_DIR "${DATA_INSTALL_DIR}/man")
++ set(MAN_INSTALL_DIR "${DATA_INSTALL_DIR}/man")
+ endif(NOT DEFINED MAN_INSTALL_DIR)
+ if(NOT DEFINED RESOURCE_INSTALL_DIR)
+- set(RESOURCE_INSTALL_DIR "${DATA_INSTALL_DIR}/libkml${VERSION_MAJOR}/resource/")
++ set(RESOURCE_INSTALL_DIR "${DATA_INSTALL_DIR}/libkml${VERSION_MAJOR}/resource/")
+ endif(NOT DEFINED RESOURCE_INSTALL_DIR)
+ if(NOT DEFINED LOCALE_INSTALL_DIR)
+- set(LOCALE_INSTALL_DIR "${DATA_INSTALL_DIR}/locale/")
++ set(LOCALE_INSTALL_DIR "${DATA_INSTALL_DIR}/locale/")
+ endif(NOT DEFINED LOCALE_INSTALL_DIR)
+-
+-set(HAVE_SYSTEM_ZLIB CACHE INTERNAL FALSE)
+-set(HAVE_SYSTEM_MINIZIP CACHE INTERNAL FALSE)
+-set(HAVE_SYSTEM_EXPAT CACHE INTERNAL FALSE)
+-set(HAVE_SYSTEM_BOOST CACHE INTERNAL FALSE)
+-set(HAVE_SYSTEM_URIPARSER CACHE INTERNAL FALSE)
++if(NOT DEFINED PYTHON_INSTALL_DIR)
++ set(PYTHON_INSTALL_DIR "${LIB_INSTALL_DIR}/python")
++endif(NOT DEFINED PYTHON_INSTALL_DIR)
++if(NOT DEFINED JAVA_INSTALL_DIR)
++ set(JAVA_INSTALL_DIR "${LIB_INSTALL_DIR}/java")
++endif(NOT DEFINED JAVA_INSTALL_DIR)
+
+ # Path to additional CMake modules
+ set(CMAKE_MODULE_PATH
+@@ -63,8 +63,6 @@ set(CMAKE_MODULE_PATH
+
+ include(LibKMLHelper)
+
+-set(KMLBASE_DEPENDS)
+-
+ if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Release")
+ endif()
+@@ -72,23 +70,23 @@ endif()
+ include(ExternalProject)
+
+ if(NOT INSTALL_DIR)
+- set(INSTALL_DIR "${CMAKE_INSTALL_PREFIX}")
++ set(INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE "install directory " PATH)
+ endif()
+
+-set(KMLBASE_LINK_LIBS)
+-set(KMLBASE_DEPENDS)
+-set(MINIZIP_DEPENDS)
++set(KMLBASE_LINK_LIBS "" CACHE INTERNAL "KMLBASE_LINK_LIBS")
++set(KMLBASE_DEPENDS "" CACHE INTERNAL "KMLBASE_DEPENDS")
++set(MINIZIP_DEPENDS "" CACHE INTERNAL "MINIZIP_DEPENDS")
+
+-include(ImportEXPAT)
+-if(HAVE_SYSTEM_EXPAT)
++find_package(EXPAT)
++if(EXPAT_FOUND)
+ include_directories(${EXPAT_INCLUDE_DIR})
+ else()
+ include(External_expat)
+ list(APPEND KMLBASE_DEPENDS EXPAT)
+ endif()
+
+-include(ImportZLIB)
+-if(HAVE_SYSTEM_ZLIB)
++find_package(ZLIB 1.2.8)
++if(ZLIB_FOUND)
+ include_directories(${ZLIB_INCLUDE_DIR})
+ else()
+ include(External_zlib)
+@@ -96,24 +94,24 @@ else()
+ list(APPEND MINIZIP_DEPENDS ZLIB)
+ endif()
+
+-include(ImportMinizip)
+-if(HAVE_SYSTEM_MINIZIP)
++find_package(MiniZip)
++if(MINIZIP_FOUND)
+ include_directories(${MINIZIP_INCLUDE_DIR})
+ else()
+ include(External_minizip)
+ list(APPEND KMLBASE_DEPENDS MINIZIP)
+ endif()
+
+-include(ImportUriParser)
+-if(HAVE_SYSTEM_URIPARSER)
++find_package(UriParser)
++if(URIPARSER_FOUND)
+ include_directories(${URIPARSER_INCLUDE_DIR})
+ else()
+ include(External_uriparser)
+ list(APPEND KMLBASE_DEPENDS URIPARSER)
+ endif()
+
+-include(ImportBoost)
+-if(HAVE_SYSTEM_BOOST)
++find_package(Boost)
++if(Boost_FOUND)
+ message(STATUS "Found Boost: ${Boost_VERSION}")
+ else()
+ include(External_boost)
+@@ -134,7 +132,7 @@ add_subdirectory(src)
+
+ if(BUILD_TESTING)
+ enable_testing()
+- include(ImportGoogleTest)
++ find_package(GoogleTest REQUIRED)
+ include_directories(${GTEST_INCLUDE_DIR})
+ include_directories(${CMAKE_SOURCE_DIR}/tests)
+ add_definitions("-DDATADIR=\"${LIBKML_DATA_DIR}\"")
+--- /dev/null
++++ b/cmake/pycompile.py
+@@ -0,0 +1,3 @@
++import compileall
++from sys import argv
++compileall.compile_file(argv[1])
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -1,4 +1,4 @@
+ add_subdirectory(kml)
+-if(BUILD_SWIG)
++if(WITH_SWIG)
+ add_subdirectory(swig)
+ endif()
+\ No newline at end of file
+--- /dev/null
++++ b/src/swig/CMakeLists.txt
+@@ -0,0 +1,95 @@
++find_package(SWIG REQUIRED)
++include(${SWIG_USE_FILE})
++
++if(WITH_PYTHON)
++ find_package(PythonLibs REQUIRED)
++ if(NOT PYTHONLIBS_FOUND)
++ message(FATAL_ERROR "Python Libraries not found.")
++ endif()
++
++ find_package(PythonInterp REQUIRED)
++
++ include_directories(${PYTHON_INCLUDE_PATH})
++
++ # execute_process(COMMAND
++ # python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True)"
++ # OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
++ # OUTPUT_STRIP_TRAILING_WHITESPACE )
++
++ file(GLOB IFILES "kml*.i")
++ foreach(INTERFACE_FILE ${IFILES})
++ get_filename_component(MODULE_NAME ${INTERFACE_FILE} NAME_WE)
++ set_source_files_properties(${INTERFACE_FILE} PROPERTIES CPLUSPLUS ON )
++ set_source_files_properties(${INTERFACE_FILE} PROPERTIES CMAKE_SWIG_FLAGS "-includeall -DSWIGPYTHON")
++ set_source_files_properties( ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}PYTHON_wrap.cxx COMPILE_FLAGS "-Wno-long-long" )
++ swig_add_module(${MODULE_NAME} python ${INTERFACE_FILE})
++ swig_link_libraries(${MODULE_NAME} kmlbase kmlengine kmldom ${PYTHON_LIBRARIES})
++ add_custom_command(
++ TARGET _${MODULE_NAME}
++ POST_BUILD
++ COMMAND ${CMAKE_COMMAND} -E echo "Byte-compiling ${MODULE_NAME}.py"
++ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/cmake/pycompile.py ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}.py
++ DEPENDS kmlbase kmlengine kmldom)
++
++ install(TARGETS
++ _${MODULE_NAME}
++ DESTINATION ${PYTHON_INSTALL_DIR})
++
++ install(FILES
++ ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}.py
++ ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}.pyc
++ DESTINATION ${PYTHON_INSTALL_DIR})
++
++ endforeach()
++
++endif(WITH_PYTHON)
++
++if(WITH_JAVA)
++ find_package(Java REQUIRED)
++ find_package(JNI REQUIRED)
++ mark_as_advanced(JAVA_HOME)
++
++ include_directories(${JAVA_INCLUDE_PATH}
++ ${JNI_INCLUDE_DIRS})
++ include_directories ( ${JAVA_INCLUDE_PATH} ${JNI_INCLUDE_DIRS} )
++
++ # Make sure the nested directory structure exists
++ set(JAVA_SOURCE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/com/google/libkml)
++ set(JAVA_BINARY_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/build)
++ if(NOT EXISTS "${JAVA_SOURCE_DIRECTORY}")
++ file(MAKE_DIRECTORY ${JAVA_SOURCE_DIRECTORY})
++ endif()
++ if(NOT EXISTS "${JAVA_BINARY_DIRECTORY}")
++ file(MAKE_DIRECTORY ${JAVA_BINARY_DIRECTORY})
++ endif()
++ # java_package_dir = com/googlecode/libkml
++ file(GLOB IFILES "kml*.i")
++ set(LIBKML_JAVA_PACKAGE "com.googlecode.libkml")
++ set(CMAKE_SWIG_OUTDIR ${JAVA_SOURCE_DIRECTORY})
++ set(CMAKE_SWIG_FLAGS -package "${LIBKML_JAVA_PACKAGE}" ${CMAKE_SWIG_GLOBAL_FLAGS})
++
++ foreach(INTERFACE_FILE ${IFILES})
++ get_filename_component(MODULE_NAME ${INTERFACE_FILE} NAME_WE)
++ set_source_files_properties(${INTERFACE_FILE} PROPERTIES CPLUSPLUS ON)
++ set_source_files_properties(${INTERFACE_FILE} PROPERTIES CMAKE_SWIG_FLAGS "-includeall -DSWIGJAVA")
++ set_source_files_properties( ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}JAVA_wrap.cxx COMPILE_FLAGS "-w")
++ swig_add_module(${MODULE_NAME}_java java ${INTERFACE_FILE})
++ swig_link_libraries(${MODULE_NAME}_java kmlbase kmlengine kmldom)
++ endforeach()
++
++ add_custom_target(LibKML_jar ALL DEPENDS LibKML.jar)
++
++ add_custom_command(
++ OUTPUT LibKML.jar
++ COMMENT "Creating jar file..."
++ COMMAND ${Java_JAVAC_EXECUTABLE} -d ${JAVA_BINARY_DIRECTORY} ${JAVA_SOURCE_DIRECTORY}/*.java
++ COMMAND ${Java_JAR_EXECUTABLE} cf ${CMAKE_CURRENT_BINARY_DIR}/LibKML.jar -C ${JAVA_BINARY_DIRECTORY} com
++ DEPENDS LibKML_jar kmlbase_java kmldom_java kmlengine_java kmlengine kmlbase kmldom)
++
++ # Get the location of the extension directory
++ string(REGEX REPLACE "include" "jre/lib/ext" JAVA_EXTENSION_DIR ${JAVA_INCLUDE_PATH})
++
++ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/LibKML.jar
++ DESTINATION ${JAVA_INSTALL_DIR})
++
++endif(WITH_JAVA)
+--- a/src/swig/kmldom.i
++++ b/src/swig/kmldom.i
+@@ -1,9 +1,9 @@
+ // Copyright 2008, Google Inc. All rights reserved.
+ //
+-// Redistribution and use in source and binary forms, with or without
++// Redistribution and use in source and binary forms, with or without
+ // modification, are permitted provided that the following conditions are met:
+ //
+-// 1. Redistributions of source code must retain the above copyright notice,
++// 1. Redistributions of source code must retain the above copyright notice,
+ // this list of conditions and the following disclaimer.
+ // 2. Redistributions in binary form must reproduce the above copyright notice,
+ // this list of conditions and the following disclaimer in the documentation
+@@ -13,14 +13,14 @@
+ // specific prior written permission.
+ //
+ // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+-// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
++// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+-// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+-// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+-// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
++// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
++// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ // This is the SWIG interface file for the KML DOM.
+@@ -33,6 +33,7 @@
+ // Include the headers needed to build kmldom_wrap.cc.
+ %{
+ #include "kml/dom.h"
++#include "kml/dom/xsd.h"
+ %}
+
+ // Tell SWIG about boost::intrusive_ptr and the inheritance hierarchy
+@@ -176,7 +177,11 @@ SWIG_INTRUSIVE_PTR_DERIVED(GxWait, kmldo
+ // Tell SWIG about C++ Standard Library std::string.
+ %include "std_string.i"
+
++
++%include "kml/dom/xsd.h"
++
+ // Tell SWIG about the kmldom type ids (Type_Placemark, etc).
++
+ %include "kml/dom/kml22.h"
+
+ // Tell SWIG about the intrusive_ptr typedefs.
+@@ -249,7 +254,7 @@ public:
+ void clear_yunits();
+ };
+
+-%include "kmlelements.i"
++%include "libkml_kmlelements.i"
+
+ %nodefaultctor KmlFactory;
+ class KmlFactory {
+--- a/src/swig/kmlelements.i
++++ /dev/null
+@@ -1,1750 +0,0 @@
+-// Copyright 2008, Google Inc. All rights reserved.
+-//
+-// Redistribution and use in source and binary forms, with or without
+-// modification, are permitted provided that the following conditions are met:
+-//
+-// 1. Redistributions of source code must retain the above copyright notice,
+-// this list of conditions and the following disclaimer.
+-// 2. Redistributions in binary form must reproduce the above copyright notice,
+-// this list of conditions and the following disclaimer in the documentation
+-// and/or other materials provided with the distribution.
+-// 3. Neither the name of Google Inc. nor the names of its contributors may be
+-// used to endorse or promote products derived from this software without
+-// specific prior written permission.
+-//
+-// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+-// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+-// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+-// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+-// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+-// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+-// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+-// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-
+-// Generated from the KML 2.2 XSD.
+-
+-// This is the SWIG interface file for the public API to the KML DOM.
+-// In addition to serving the needs of SWIG this also serves to document the
+-// public C++ API separate from the present implementation found in the
+-// private sections of the present C++ .h files.
+-
+-// This is AbstractObjectType in the KML 2.2 XSD.
+-%nodefaultctor Object;
+-class Object : public Element {
+-public:
+- // id=
+- const std::string& get_id();
+- void set_id(const std::string& id);
+- bool has_id();
+- void clear_id();
+-
+- // targetId=
+- const std::string& get_targetid();
+- void set_targetid(const std::string& targetid);
+- bool has_targetid();
+- void clear_targetid();
+-};
+-
+-%nodefaultctor SubStyle;
+-class SubStyle : public Object {
+-};
+-
+-%nodefaultctor ColorStyle;
+-class ColorStyle : public SubStyle {
+-public:
+- // <color>
+- const kmlbase::Color32& get_color();
+- void set_color(const kmlbase::Color32& color);
+- bool has_color();
+- void clear_color();
+-
+- // <colorMode>
+- int get_colormode();
+- void set_colormode(int colormode);
+- bool has_colormode();
+- void clear_colormode();
+-};
+-
+-%nodefaultctor SnippetCommon;
+-class SnippetCommon : public Element {
+-public:
+- // Content.
+- const std::string& get_text();
+- void set_text(const std::string& text);
+- bool has_text();
+- void clear_text();
+-
+- // maxLines=
+- int get_maxlines();
+- void set_maxlines(int maxlines);
+- bool has_maxlines();
+- void clear_maxlines();
+-};
+-
+-%nodefaultctor Snippet;
+-class Snippet : public SnippetCommon {
+-};
+-
+-%nodefaultctor LinkSnippet;
+-class LinkSnippet : public SnippetCommon {
+-};
+-
+-%nodefaultctor AbstractView;
+-class AbstractView : public Object {
+- public:
+- // gx:TimeStamp and gx:TimeSpan.
+- const TimePrimitivePtr get_gx_timeprimitive();
+- bool has_gx_timeprimitive();
+- void set_gx_timeprimitive(const TimePrimitivePtr& gx_timeprimitive);
+- void clear_gx_timeprimitive();
+-};
+-
+-%nodefaultctor TimePrimitive;
+-class TimePrimitive : public Object {
+-};
+-
+-%nodefaultctor StyleSelector;
+-class StyleSelector : public Object {
+-};
+-
+-%nodefaultctor AbstractLatLonBox;
+-class AbstractLatLonBox : public Object {
+-public:
+- // <north>
+- double get_north();
+- bool has_north();
+- void set_north(double north);
+- void clear_north();
+-
+- // <south>
+- double get_south();
+- bool has_south();
+- void set_south(double south);
+- void clear_south();
+-
+- // <east>
+- double get_east();
+- bool has_east();
+- void set_east(double east);
+- void clear_east();
+-
+- // <west>
+- double get_west();
+- bool has_west();
+- void set_west(double west);
+- void clear_west();
+-};
+-
+-%nodefaultctor LatLonAltBox;
+-class LatLonAltBox : public AbstractLatLonBox {
+-public:
+- // <minAltitude>
+- double get_minaltitude();
+- void set_minaltitude(double minaltitude);
+- bool has_minaltitude();
+- void clear_minaltitude();
+-
+- // <maxAltitude>
+- double get_maxaltitude();
+- void set_maxaltitude(double maxaltitude);
+- bool has_maxaltitude();
+- void clear_maxaltitude();
+-
+- // <altitudeMode>
+- int get_altitudemode();
+- void set_altitudemode(int altitudemode);
+- bool has_altitudemode();
+- void clear_altitudemode();
+-
+- // <gx:altitudeMode>
+- int get_gx_altitudemode();
+- bool has_gx_altitudemode();
+- void set_gx_altitudemode(int gx_altitudemode);
+- void clear_gx_altitudemode();
+-};
+-
+-%nodefaultctor Lod;
+-class Lod : public Object {
+-public:
+- // <minLodPixels>
+- double get_minlodpixels();
+- void set_minlodpixels(double minlodpixels);
+- bool has_minlodpixels();
+- void clear_minlodpixels();
+-
+- // <maxLodPixels>
+- double get_maxlodpixels();
+- void set_maxlodpixels(double maxlodpixels);
+- bool has_maxlodpixels();
+- void clear_maxlodpixels();
+-
+- // <minFadeExtent>
+- double get_minfadeextent();
+- void set_minfadeextent(double minfadeextent);
+- bool has_minfadeextent();
+- void clear_minfadeextent();
+-
+- // <maxFadeExtent>
+- double get_maxfadeextent();
+- void set_maxfadeextent(double maxfadeextent);
+- bool has_maxfadeextent();
+- void clear_maxfadeextent();
+-};
+-
+-%nodefaultctor Region;
+-class Region : public Object {
+-public:
+- // <LatLonAltBox>
+- const LatLonAltBoxPtr get_latlonaltbox();
+- void set_latlonaltbox(LatLonAltBoxPtr latlonaltbox);
+- bool has_latlonaltbox();
+- void clear_latlonaltbox();
+-
+- // <Lod>
+- const LodPtr get_lod();
+- void set_lod(LodPtr lod);
+- bool has_lod();
+- void clear_lod();
+-};
+-
+-%nodefaultctor ExtendedData;
+-class ExtendedData : public Element {
+-public:
+- // <Data>.
+- void add_data(DataPtr data);
+- const size_t get_data_array_size();
+- const DataPtr get_data_array_at(unsigned int index);
+- // <SchemaData>.
+- void add_schemadata(SchemaDataPtr schemadata);
+- const size_t get_schemadata_array_size();
+- const SchemaDataPtr get_schemadata_array_at(unsigned int index);
+-};
+-
+-%nodefaultctor Feature;
+-class Feature : public Object {
+-public:
+- // <name>
+- const std::string& get_name();
+- void set_name(const std::string& name);
+- bool has_name();
+- void clear_name();
+-
+- // <visibility>
+- bool get_visibility();
+- void set_visibility(bool visibility);
+- bool has_visibility();
+- void clear_visibility();
+-
+- // <open>
+- bool get_open();
+- void set_open(bool open);
+- bool has_open();
+- void clear_open();
+-
+- // <atom:author>
+- const AtomAuthorPtr get_atomauthor();
+- bool has_atomauthor();
+- void set_atomauthor(AtomAuthorPtr atomauthor);
+- void clear_atomauthor();
+-
+- // <atom:link>
+- const AtomLinkPtr get_atomlink();
+- bool has_atomlink();
+- void set_atomlink(AtomLinkPtr atomlink);
+- void clear_atomlink();
+-
+- // <address>
+- const std::string& get_address();
+- void set_address(const std::string& address);
+- bool has_address();
+- void clear_address();
+-
+- // <phoneNumber>
+- const std::string& get_phonenumber();
+- void set_phonenumber(const std::string& phonenumber);
+- bool has_phonenumber();
+- void clear_phonenumber();
+-
+- // <Snippet>
+- const SnippetPtr get_snippet();
+- void set_snippet(SnippetPtr snippet);
+- bool has_snippet();
+- void clear_snippet();
+-
+- // <description>
+- const std::string& get_description();
+- void set_description(const std::string& description);
+- bool has_description();
+- void clear_description();
+-
+- // AbstractView
+- const AbstractViewPtr get_abstractview();
+- void set_abstractview(AbstractViewPtr abstractview);
+- bool has_abstractview();
+- void clear_abstractview();
+-
+- // TimePrimitive
+- const TimePrimitivePtr get_timeprimitive();
+- void set_timeprimitive(TimePrimitivePtr timeprimitive);
+- bool has_timeprimitive();
+- void clear_timeprimitive();
+-
+- // <styleUrl>
+- const std::string& get_styleurl();
+- void set_styleurl(const std::string& styleurl);
+- bool has_styleurl();
+- void clear_styleurl();
+-
+- // StyleSelector
+- const StyleSelectorPtr get_styleselector();
+- void set_styleselector(StyleSelectorPtr styleselector);
+- bool has_styleselector();
+- void clear_styleselector();
+-
+- // <Region>
+- const RegionPtr get_region();
+- void set_region(RegionPtr region);
+- bool has_region();
+- void clear_region();
+-
+- // <ExtendedData>
+- const ExtendedDataPtr get_extendeddata();
+- void set_extendeddata(ExtendedDataPtr extendeddata);
+- bool has_extendeddata();
+- void clear_extendeddata();
+-
+- // <gx:balloonVisibility>
+- bool get_gx_balloonvisibility();
+- void set_gx_balloonvisibility(bool balloonvisibility);
+- bool has_gx_balloonvisibility();
+- void clear_gx_balloonvisibility();
+-};
+-
+-%nodefaultctor Container;
+-class Container : public Feature {
+-public:
+- // Feature...
+- void add_feature(FeaturePtr feature);
+- const size_t get_feature_array_size();
+- const FeaturePtr get_feature_array_at(unsigned int index);
+-};
+-
+-%nodefaultctor Geometry;
+-class Geometry : public Object {
+-};
+-
+-%nodefaultctor BasicLink;
+-class BasicLink : public Object {
+-public:
+- // <href>
+- const std::string& get_href();
+- bool has_href();
+- void set_href(const std::string& href);
+- void clear_href();
+-};
+-
+-%nodefaultctor Icon;
+-class Icon : public BasicLink {
+-public:
+- // <refreshMode>
+- int get_refreshmode();
+- void set_refreshmode(int refreshmode);
+- bool has_refreshmode();
+- void clear_refreshmode();
+-
+- // <refreshInterval>
+- double get_refreshinterval();
+- void set_refreshinterval(double refreshinterval);
+- bool has_refreshinterval();
+- void clear_refreshinterval();
+-
+- // <viewRefreshMode>
+- int get_viewrefreshmode();
+- void set_viewrefreshmode(int viewrefreshmode);
+- bool has_viewrefreshmode();
+- void clear_viewrefreshmode();
+-
+- // <viewRefreshTime>
+- double get_viewrefreshtime();
+- void set_viewrefreshtime(double viewrefreshtime);
+- bool has_viewrefreshtime();
+- void clear_viewrefreshtime();
+-
+- // <viewBoundScale>
+- double get_viewboundscale();
+- void set_viewboundscale(double viewboundscale);
+- bool has_viewboundscale();
+- void clear_viewboundscale();
+-
+- // <viewFormat>
+- const std::string& get_viewformat();
+- void set_viewformat(const std::string& viewformat);
+- bool has_viewformat();
+- void clear_viewformat();
+-
+- // <httpQuery>
+- const std::string& get_httpquery();
+- void set_httpquery(const std::string& httpquery);
+- bool has_httpquery();
+- void clear_httpquery();
+-};
+-
+-%nodefaultctor IconStyleIcon;
+-class IconStyleIcon : public BasicLink {
+-public:
+- // <href>
+- const std::string& get_href();
+- bool has_href();
+- void set_href(const std::string& href);
+- void clear_href();
+-};
+-
+-%nodefaultctor Overlay;
+-class Overlay : public Feature {
+-public:
+- // <color>
+- const kmlbase::Color32& get_color();
+- void set_color(const kmlbase::Color32& color);
+- bool has_color();
+- void clear_color();
+-
+- // <drawOrder>
+- int get_draworder();
+- void set_draworder(int draworder);
+- bool has_draworder();
+- void clear_draworder();
+-
+- // <Icon>
+- const IconPtr get_icon();
+- void set_icon(IconPtr icon);
+- bool has_icon();
+- void clear_icon();
+-};
+-
+-%nodefaultctor BalloonStyle;
+-class BalloonStyle : public SubStyle {
+-public:
+- // <bgColor>
+- const kmlbase::Color32& get_bgcolor();
+- void set_bgcolor(const kmlbase::Color32& bgcolor);
+- bool has_bgcolor();
+- void clear_bgcolor();
+-
+- // <textColor>
+- const kmlbase::Color32& get_textcolor();
+- void set_textcolor(const kmlbase::Color32& textcolor);
+- bool has_textcolor();
+- void clear_textcolor();
+-
+- // <text>
+- const std::string& get_text();
+- void set_text(const std::string& text);
+- bool has_text();
+- void clear_text();
+-
+- // <displayMode>
+- int get_displaymode();
+- void set_displaymode(int displaymode);
+- bool has_displaymode();
+- void clear_displaymode();
+-};
+-
+-%nodefaultctor Camera;
+-class Camera : public AbstractView {
+-public:
+- // <longitude>
+- double get_longitude();
+- void set_longitude(double longitude);
+- bool has_longitude();
+- void clear_longitude();
+-
+- // <latitude>
+- double get_latitude();
+- void set_latitude(double latitude);
+- bool has_latitude();
+- void clear_latitude();
+-
+- // <altitude>
+- double get_altitude();
+- void set_altitude(double altitude);
+- bool has_altitude();
+- void clear_altitude();
+-
+- // <heading>
+- double get_heading();
+- void set_heading(double heading);
+- bool has_heading();
+- void clear_heading();
+-
+- // <tilt>
+- double get_tilt();
+- void set_tilt(double tilt);
+- bool has_tilt();
+- void clear_tilt();
+-
+- // <roll>
+- double get_roll();
+- void set_roll(double roll);
+- bool has_roll();
+- void clear_roll();
+-
+- // <altitudeMode>
+- int get_altitudemode();
+- void set_altitudemode(int altitudemode);
+- bool has_altitudemode();
+- void clear_altitudemode();
+-
+- // <gx:altitudeMode>
+- int get_gx_altitudemode();
+- bool has_gx_altitudemode();
+- void set_gx_altitudemode(int gx_altitudemode);
+- void clear_gx_altitudemode();
+-};
+-
+-%nodefaultctor UpdateOperation;
+-class UpdateOperation : public Element {
+-};
+-
+-%nodefaultctor Change;
+-class Change : public UpdateOperation {
+-public:
+- // Object...
+- void add_object(ObjectPtr object);
+- const size_t get_object_array_size();
+- const ObjectPtr get_object_array_at(unsigned int index);
+-};
+-
+-%nodefaultctor Create;
+-class Create : public UpdateOperation {
+-public:
+- // Container...
+- void add_container(ContainerPtr container);
+- const size_t get_container_array_size();
+- const ContainerPtr get_container_array_at(unsigned int index);
+-};
+-
+-%nodefaultctor Data;
+-class Data : public Object {
+-public:
+- // name=
+- const std::string& get_name();
+- bool has_name();
+- void set_name(const std::string& name);
+- void clear_name();
+-
+- // <displayname>
+- const std::string& get_displayname();
+- bool has_displayname();
+- void set_displayname(const std::string& displayname);
+- void clear_displayname();
+-
+- // <value>
+- const std::string& get_value();
+- bool has_value();
+- void set_value(const std::string& value);
+- void clear_value();
+-};
+-
+-%nodefaultctor Delete;
+-class Delete : public UpdateOperation {
+-public:
+- // Feature...
+- void add_feature(FeaturePtr feature);
+- const size_t get_feature_array_size();
+- const FeaturePtr get_feature_array_at(unsigned int index);
+-};
+-
+-%nodefaultctor SimpleField;
+-class SimpleField : public Element {
+-public:
+- // type=
+- const std::string& get_type();
+- bool has_type();
+- void set_type(const std::string& value);
+- void clear_type();
+-
+- // name=
+- const std::string& get_name();
+- bool has_name();
+- void set_name(const std::string& value);
+- void clear_name();
+-
+- // <displayName>
+- const std::string& get_displayname();
+- void set_displayname(const std::string& displayname);
+- bool has_displayname();
+- void clear_displayname();
+-};
+-
+-%nodefaultctor Schema;
+-class Schema : public Object {
+-public:
+- // name=
+- const std::string& get_name();
+- bool has_name();
+- void set_name(const std::string& value);
+- void clear_name();
+-
+- // <SimpleField>...
+- void add_simplefield(SimpleFieldPtr simplefield);
+- const size_t get_simplefield_array_size();
+- const SimpleFieldPtr get_simplefield_array_at(unsigned int index);
+-};
+-
+-%nodefaultctor Document;
+-class Document : public Container {
+-public:
+- // <Schema>...
+- void add_schema(SchemaPtr schema);
+- const size_t get_schema_array_size();
+- const SchemaPtr get_schema_array_at(unsigned int index);
+-
+- // <Style>,<StyleMap>...
+- void add_styleselector(StyleSelectorPtr styleselector);
+- const size_t get_styleselector_array_size();
+- const StyleSelectorPtr get_styleselector_array_at(unsigned int index);
+-};
+-
+-%nodefaultctor Folder;
+-class Folder : public Container {
+-};
+-
+-%nodefaultctor LatLonBox;
+-class LatLonBox : public AbstractLatLonBox {
+-public:
+- // <rotation>
+- double get_rotation();
+- void set_rotation(double rotation);
+- bool has_rotation();
+- void clear_rotation();
+-};
+-
+-%nodefaultctor GxLatLonQuad;
+-class GxLatLonQuad : public Object {
+-public:
+- // <coordinates>
+- const CoordinatesPtr get_coordinates();
+- bool has_coordinates();
+- void set_coordinates(const CoordinatesPtr& coordinates);
+- void clear_coordinates();
+-};
+-
+-%nodefaultctor GroundOverlay;
+-class GroundOverlay : public Overlay {
+-public:
+- // <altitude>
+- double get_altitude();
+- void set_altitude(double altitude);
+- bool has_altitude();
+- void clear_altitude();
+-
+- // <altitudeMode>
+- int get_altitudemode();
+- void set_altitudemode(int altitudemode);
+- bool has_altitudemode();
+- void clear_altitudemode();
+-
+- // <gx:altitudeMode>
+- int get_gx_altitudemode();
+- bool has_gx_altitudemode();
+- void set_gx_altitudemode(int gx_altitudemode);
+- void clear_gx_altitudemode();
+-
+- // <LatLonBox>
+- const LatLonBoxPtr get_latlonbox();
+- void set_latlonbox(LatLonBoxPtr latlonbox);
+- bool has_latlonbox();
+- void clear_latlonbox();
+-
+- // <gx:LatLonQuad>
+- const GxLatLonQuadPtr get_gx_latlonquad();
+- bool has_gx_latlonquad();
+- void set_gx_latlonquad(GxLatLonQuadPtr gx_latlonquad);
+- void clear_gx_latlonquad();
+-};
+-
+-%nodefaultctor HotSpot;
+-class HotSpot : public Vec2 {
+-};
+-
+-%nodefaultctor IconStyle;
+-class IconStyle : public ColorStyle {
+-public:
+- // <scale>
+- double get_scale();
+- void set_scale(double scale);
+- bool has_scale();
+- void clear_scale();
+-
+- // <Icon> (different from Overlay Icon)
+- const IconStyleIconPtr get_icon();
+- void set_icon(IconStyleIconPtr icon);
+- bool has_icon();
+- void clear_icon();
+-
+- // <heading>
+- double get_heading();
+- void set_heading(double heading);
+- bool has_heading();
+- void clear_heading();
+-
+- // <hotSpot>
+- const HotSpotPtr get_hotspot();
+- void set_hotspot(HotSpotPtr hotspot);
+- bool has_hotspot();
+- void clear_hotspot();
+-};
+-
+-%nodefaultctor ImagePyramid;
+-class ImagePyramid : public Object {
+-public:
+- // <tileSize>
+- int get_tilesize();
+- void set_tilesize(int tilesize);
+- bool has_tilesize();
+- void clear_tilesize();
+-
+- // <maxWidth>
+- int get_maxwidth();
+- void set_maxwidth(int maxwidth);
+- bool has_maxwidth();
+- void clear_maxwidth();
+-
+- // <maxHeight>
+- int get_maxheight();
+- void set_maxheight(int maxheight);
+- bool has_maxheight();
+- void clear_maxheight();
+-
+- // <gridOrigin>
+- int get_gridorigin();
+- void set_gridorigin(int gridorigin);
+- bool has_gridorigin();
+- void clear_gridorigin();
+-};
+-
+-%nodefaultctor ItemIcon;
+-class ItemIcon : public Object {
+-public:
+- // <state>
+- int get_state_array_at(unsigned int index);
+- const size_t get_state_array_size();
+- bool has_state();
+- void add_state(int state);
+- void clear_state();
+-
+- // <href>
+- const std::string& get_href();
+- void set_href(const std::string& href);
+- bool has_href();
+- void clear_href();
+-};
+-
+-%nodefaultctor LabelStyle;
+-class LabelStyle : public ColorStyle {
+-public:
+- // <scale>
+- double get_scale();
+- void set_scale(double scale);
+- bool has_scale();
+- void clear_scale();
+-};
+-
+-%nodefaultctor LineString;
+-class LineString : public Geometry {
+-public:
+- // <extrude>
+- bool get_extrude();
+- void set_extrude(bool extrude);
+- bool has_extrude();
+- void clear_extrude();
+-
+- // <tessellate>
+- bool get_tessellate();
+- void set_tessellate(bool tessellate);
+- bool has_tessellate();
+- void clear_tessellate();
+-
+- // <altitudeMode>
+- int get_altitudemode();
+- void set_altitudemode(int altitudemode);
+- bool has_altitudemode();
+- void clear_altitudemode();
+-
+- // <gx:altitudeMode>
+- int get_gx_altitudemode();
+- bool has_gx_altitudemode();
+- void set_gx_altitudemode(int gx_altitudemode);
+- void clear_gx_altitudemode();
+-
+- // <coordinates>
+- const CoordinatesPtr get_coordinates();
+- void set_coordinates(CoordinatesPtr coordinates);
+- bool has_coordinates();
+- void clear_coordinates();
+-};
+-
+-%nodefaultctor LineStyle;
+-class LineStyle : public ColorStyle {
+-public:
+- // <width>
+- double get_width();
+- void set_width(double width);
+- bool has_width();
+- void clear_width();
+-};
+-
+-%nodefaultctor LinearRing;
+-class LinearRing : public Geometry {
+-public:
+- // <extrude>
+- bool get_extrude();
+- void set_extrude(bool extrude);
+- bool has_extrude();
+- void clear_extrude();
+-
+- // <tessellate>
+- bool get_tessellate();
+- void set_tessellate(bool tessellate);
+- bool has_tessellate();
+- void clear_tessellate();
+-
+- // <altitudeMode>
+- int get_altitudemode();
+- void set_altitudemode(int altitudemode);
+- bool has_altitudemode();
+- void clear_altitudemode();
+-
+- // <gx:altitudeMode>
+- int get_gx_altitudemode();
+- bool has_gx_altitudemode();
+- void set_gx_altitudemode(int gx_altitudemode);
+- void clear_gx_altitudemode();
+-
+- // <coordinates>
+- const CoordinatesPtr get_coordinates();
+- void set_coordinates(CoordinatesPtr coordinates);
+- bool has_coordinates();
+- void clear_coordinates();
+-};
+-
+-%nodefaultctor Link;
+-class Link : public BasicLink {
+-public:
+- // <refreshMode>
+- int get_refreshmode();
+- void set_refreshmode(int refreshmode);
+- bool has_refreshmode();
+- void clear_refreshmode();
+-
+- // <refreshInterval>
+- double get_refreshinterval();
+- void set_refreshinterval(double refreshinterval);
+- bool has_refreshinterval();
+- void clear_refreshinterval();
+-
+- // <viewRefreshMode>
+- int get_viewrefreshmode();
+- void set_viewrefreshmode(int viewrefreshmode);
+- bool has_viewrefreshmode();
+- void clear_viewrefreshmode();
+-
+- // <viewRefreshTime>
+- double get_viewrefreshtime();
+- void set_viewrefreshtime(double viewrefreshtime);
+- bool has_viewrefreshtime();
+- void clear_viewrefreshtime();
+-
+- // <viewBoundScale>
+- double get_viewboundscale();
+- void set_viewboundscale(double viewboundscale);
+- bool has_viewboundscale();
+- void clear_viewboundscale();
+-
+- // <viewFormat>
+- const std::string& get_viewformat();
+- void set_viewformat(const std::string& viewformat);
+- bool has_viewformat();
+- void clear_viewformat();
+-
+- // <httpQuery>
+- const std::string& get_httpquery();
+- void set_httpquery(const std::string& httpquery);
+- bool has_httpquery();
+- void clear_httpquery();
+-};
+-
+-%nodefaultctor ListStyle;
+-class ListStyle : public SubStyle {
+-public:
+- // <listItemType>
+- int get_listitemtype();
+- void set_listitemtype(int listitemtype);
+- bool has_listitemtype();
+- void clear_listitemtype();
+-
+- // <bgColor>
+- const kmlbase::Color32& get_bgcolor();
+- void set_bgcolor(const kmlbase::Color32& bgcolor);
+- bool has_bgcolor();
+- void clear_bgcolor();
+-
+- // <ItemIcon>...
+- void add_itemicon(ItemIconPtr itemicon);
+- const size_t get_itemicon_array_size();
+- const ItemIconPtr get_itemicon_array_at(unsigned int index);
+-};
+-
+-%nodefaultctor Location;
+-class Location : public Object {
+-public:
+- // <longitude>
+- double get_longitude();
+- void set_longitude(double longitude);
+- bool has_longitude();
+- void clear_longitude();
+-
+- // <latitude>
+- double get_latitude();
+- void set_latitude(double latitude);
+- bool has_latitude();
+- void clear_latitude();
+-
+- // <altitude>
+- double get_altitude();
+- void set_altitude(double altitude);
+- bool has_altitude();
+- void clear_altitude();
+-};
+-
+-%nodefaultctor LookAt;
+-class LookAt : public AbstractView {
+-public:
+- // <longitude>
+- double get_longitude();
+- void set_longitude(double longitude);
+- bool has_longitude();
+- void clear_longitude();
+-
+- // <latitude>
+- double get_latitude();
+- void set_latitude(double latitude);
+- bool has_latitude();
+- void clear_latitude();
+-
+- // <altitude>
+- double get_altitude();
+- void set_altitude(double altitude);
+- bool has_altitude();
+- void clear_altitude();
+-
+- // <heading>
+- double get_heading();
+- void set_heading(double heading);
+- bool has_heading();
+- void clear_heading();
+-
+- // <tilt>
+- double get_tilt();
+- void set_tilt(double tilt);
+- bool has_tilt();
+- void clear_tilt();
+-
+- // <range>
+- double get_range();
+- void set_range(double range);
+- bool has_range();
+- void clear_range();
+-
+- // <altitudeMode>
+- int get_altitudemode();
+- void set_altitudemode(int altitudemode);
+- bool has_altitudemode();
+- void clear_altitudemode();
+-
+- // <gx:altitudeMode>
+- int get_gx_altitudemode();
+- bool has_gx_altitudemode();
+- void set_gx_altitudemode(int gx_altitudemode);
+- void clear_gx_altitudemode();
+-};
+-
+-%nodefaultctor Orientation;
+-class Orientation : public Object {
+-public:
+- // <heading>
+- double get_heading();
+- void set_heading(double heading);
+- bool has_heading();
+- void clear_heading();
+-
+- // <tilt>
+- double get_tilt();
+- void set_tilt(double tilt);
+- bool has_tilt();
+- void clear_tilt();
+-
+- // <roll>
+- double get_roll();
+- void set_roll(double roll);
+- bool has_roll();
+- void clear_roll();
+-};
+-
+-%nodefaultctor Scale;
+-class Scale : public Object {
+-public:
+- // <x>
+- double get_x();
+- void set_x(double x);
+- bool has_x();
+- void clear_x();
+-
+- // <y>
+- double get_y();
+- void set_y(double y);
+- bool has_y();
+- void clear_y();
+-
+- // <z>
+- double get_z();
+- void set_z(double z);
+- bool has_z();
+- void clear_z();
+-};
+-
+-%nodefaultctor Alias;
+-class Alias : public Object {
+-public:
+- // <targetHref>
+- const std::string& get_targethref();
+- void set_targethref(const std::string& targethref);
+- bool has_targethref();
+- void clear_targethref();
+-
+- // <sourceHref>
+- const std::string& get_sourcehref();
+- void set_sourcehref(const std::string& sourcehref);
+- bool has_sourcehref();
+- void clear_sourcehref();
+-};
+-
+-%nodefaultctor ResourceMap;
+-class ResourceMap : public Object {
+-public:
+- // <Alias>...
+- void add_alias(AliasPtr alias);
+- const size_t get_alias_array_size();
+- const AliasPtr get_alias_array_at(unsigned int index);
+-};
+-
+-%nodefaultctor Model;
+-class Model : public Geometry {
+-public:
+- // <altitudeMode>
+- int get_altitudemode();
+- void set_altitudemode(int altitudemode);
+- bool has_altitudemode();
+- void clear_altitudemode();
+-
+- // <gx:altitudeMode>
+- int get_gx_altitudemode();
+- bool has_gx_altitudemode();
+- void set_gx_altitudemode(int gx_altitudemode);
+- void clear_gx_altitudemode();
+-
+- // <Location>
+- const LocationPtr get_location();
+- void set_location(LocationPtr location);
+- bool has_location();
+- void clear_location();
+-
+- // <Orientation>
+- const OrientationPtr get_orientation();
+- void set_orientation(OrientationPtr orientation);
+- bool has_orientation();
+- void clear_orientation();
+-
+- // <Scale>
+- const ScalePtr get_scale();
+- void set_scale(ScalePtr scale);
+- bool has_scale();
+- void clear_scale();
+-
+- // <Link>
+- const LinkPtr get_link();
+- void set_link(LinkPtr link);
+- bool has_link();
+- void clear_link();
+-
+- // <ResourceMap>
+- const ResourceMapPtr get_resourcemap();
+- void set_resourcemap(ResourceMapPtr resourcemap);
+- bool has_resourcemap();
+- void clear_resourcemap();
+-};
+-
+-%nodefaultctor MultiGeometry;
+-class MultiGeometry : public Geometry {
+-public:
+- // Geometry...
+- void add_geometry(GeometryPtr geometry);
+- const size_t get_geometry_array_size();
+- const GeometryPtr get_geometry_array_at(unsigned int index);
+-};
+-
+-%nodefaultctor NetworkLink;
+-class NetworkLink : public Feature {
+-public:
+- // <refreshVisibility>
+- bool get_refreshvisibility();
+- void set_refreshvisibility(bool refreshvisibility);
+- bool has_refreshvisibility();
+- void clear_refreshvisibility();
+-
+- // <flyToView>
+- bool get_flytoview();
+- void set_flytoview(bool flytoview);
+- bool has_flytoview();
+- void clear_flytoview();
+-
+- // <Link>
+- const LinkPtr get_link();
+- void set_link(LinkPtr link);
+- bool has_link();
+- void clear_link();
+-};
+-
+-%nodefaultctor Update;
+-class Update : public Element {
+-public:
+- // <targetHref>
+- const std::string& get_targethref();
+- bool has_targethref();
+- void set_targethref(const std::string& targethref);
+- void clear_targethref();
+-
+- // <Change>,<Create>,<Delete>...
+- void add_updateoperation(UpdateOperationPtr updateoperation);
+- const size_t get_updateoperation_array_size();
+- const UpdateOperationPtr get_updateoperation_array_at(unsigned int index);
+-};
+-
+-%nodefaultctor NetworkLinkControl;
+-class NetworkLinkControl : public Element {
+-public:
+- // <minRefreshPeriod>
+- double get_minrefreshperiod();
+- void set_minrefreshperiod(double minrefreshperiod);
+- bool has_minrefreshperiod();
+- void clear_minrefreshperiod();
+-
+- // <maxSessionLength>
+- double get_maxsessionlength();
+- void set_maxsessionlength(double maxsessionlength);
+- bool has_maxsessionlength();
+- void clear_maxsessionlength();
+-
+- // <cookie>
+- const std::string& get_cookie();
+- void set_cookie(const std::string& cookie);
+- bool has_cookie();
+- void clear_cookie();
+-
+- // <message>
+- const std::string& get_message();
+- void set_message(const std::string& message);
+- bool has_message();
+- void clear_message();
+-
+- // <linkName>
+- const std::string& get_linkname();
+- void set_linkname(const std::string& linkname);
+- bool has_linkname();
+- void clear_linkname();
+-
+- // <linkDescription>
+- const std::string& get_linkdescription();
+- void set_linkdescription(const std::string& linkdescription);
+- bool has_linkdescription();
+- void clear_linkdescription();
+-
+- // <linkSnippet>
+- const LinkSnippetPtr get_linksnippet();
+- void set_linksnippet(LinkSnippetPtr linksnippet);
+- bool has_linksnippet();
+- void clear_linksnippet();
+-
+- // <expires>
+- const std::string& get_expires();
+- void set_expires(const std::string& expires);
+- bool has_expires();
+- void clear_expires();
+-
+- // <Update>
+- const UpdatePtr get_update();
+- void set_update(UpdatePtr update);
+- bool has_update();
+- void clear_update();
+-
+- // AbstractView
+- const AbstractViewPtr get_abstractview();
+- void set_abstractview(AbstractViewPtr abstractview);
+- bool has_abstractview();
+- void clear_abstractview();
+-};
+-
+-%nodefaultctor Pair;
+-class Pair : public Object {
+-public:
+- // <key>
+- int get_key();
+- void set_key(int key);
+- bool has_key();
+- void clear_key();
+-
+- // <styleUrl>
+- const std::string& get_styleurl();
+- void set_styleurl(const std::string& styleurl);
+- bool has_styleurl();
+- void clear_styleurl();
+-
+- // <StyleSelector>
+- const StyleSelectorPtr get_styleselector();
+- void set_styleselector(StyleSelectorPtr styleselector);
+- bool has_styleselector();
+- void clear_styleselector();
+-};
+-
+-%nodefaultctor ViewVolume;
+-class ViewVolume : public Object {
+-public:
+- // <leftFov>
+- double get_leftfov();
+- void set_leftfov(double leftfov);
+- bool has_leftfov();
+- void clear_leftfov();
+-
+- // <rightFov>
+- double get_rightfov();
+- void set_rightfov(double rightfov);
+- bool has_rightfov();
+- void clear_rightfov();
+-
+- // <bottomFov>
+- double get_bottomfov();
+- void set_bottomfov(double bottomfov);
+- bool has_bottomfov();
+- void clear_bottomfov();
+-
+- // <topFov>
+- double get_topfov();
+- void set_topfov(double topfov);
+- bool has_topfov();
+- void clear_topfov();
+-
+- // <near>
+- double get_near();
+- void set_near(double val);
+- bool has_near();
+- void clear_near();
+-};
+-
+-%nodefaultctor Point;
+-class Point : public Geometry {
+-public:
+- // <extrude>
+- bool get_extrude();
+- void set_extrude(bool extrude);
+- bool has_extrude();
+- void clear_extrude();
+-
+- // <altitudeMode>
+- int get_altitudemode();
+- void set_altitudemode(int altitudemode);
+- bool has_altitudemode();
+- void clear_altitudemode();
+-
+- // <gx:altitudeMode>
+- int get_gx_altitudemode();
+- bool has_gx_altitudemode();
+- void set_gx_altitudemode(int gx_altitudemode);
+- void clear_gx_altitudemode();
+-
+- // <coordinates>
+- const CoordinatesPtr get_coordinates();
+- void set_coordinates(CoordinatesPtr coordinates);
+- bool has_coordinates();
+- void clear_coordinates();
+-};
+-
+-%nodefaultctor PhotoOverlay;
+-class PhotoOverlay : public Overlay {
+-public:
+- // <rotation>
+- double get_rotation();
+- void set_rotation(double rotation);
+- bool has_rotation();
+- void clear_rotation();
+-
+- // <ViewVolume>
+- const ViewVolumePtr get_viewvolume();
+- void set_viewvolume(ViewVolumePtr viewvolume);
+- bool has_viewvolume();
+- void clear_viewvolume();
+-
+- // <ImagePyramid>
+- const ImagePyramidPtr get_imagepyramid();
+- void set_imagepyramid(ImagePyramidPtr imagepyramid);
+- bool has_imagepyramid();
+- void clear_imagepyramid();
+-
+- // <Point>
+- const PointPtr get_point();
+- void set_point(PointPtr point);
+- bool has_point();
+- void clear_point();
+-
+- // <shape>
+- int get_shape();
+- bool has_shape();
+- void set_shape(int shape);
+- void clear_shape();
+-};
+-
+-%nodefaultctor Placemark;
+-class Placemark : public Feature {
+-public:
+- // Geometry
+- const GeometryPtr get_geometry();
+- void set_geometry(GeometryPtr geometry);
+- bool has_geometry();
+- void clear_geometry();
+-};
+-
+-%nodefaultctor PolyStyle;
+-class PolyStyle : public ColorStyle {
+-public:
+- // <fill>
+- bool get_fill();
+- void set_fill(bool fill);
+- bool has_fill();
+- void clear_fill();
+-
+- // <outline>
+- bool get_outline();
+- void set_outline(bool outline);
+- bool has_outline();
+- void clear_outline();
+-};
+-
+-%nodefaultctor OuterBoundaryIs;
+-class OuterBoundaryIs : public Element {
+-public:
+- // <LinearRing>
+- const LinearRingPtr get_linearring();
+- void set_linearring(LinearRingPtr linearring);
+- bool has_linearring();
+- void clear_linearring();
+-};
+-
+-%nodefaultctor InnerBoundaryIs;
+-class InnerBoundaryIs : public Element {
+-public:
+- // <LinearRing>
+- const LinearRingPtr get_linearring();
+- void set_linearring(LinearRingPtr linearring);
+- bool has_linearring();
+- void clear_linearring();
+-};
+-
+-%nodefaultctor Polygon;
+-class Polygon : public Geometry {
+-public:
+- // <extrude>
+- bool get_extrude();
+- void set_extrude(bool extrude);
+- bool has_extrude();
+- void clear_extrude();
+-
+- // <tessellate>
+- bool get_tessellate();
+- void set_tessellate(bool tessellate);
+- bool has_tessellate();
+- void clear_tessellate();
+-
+- // <altitudeMode>
+- int get_altitudemode();
+- void set_altitudemode(int altitudemode);
+- bool has_altitudemode();
+- void clear_altitudemode();
+-
+- // <gx:altitudeMode>
+- int get_gx_altitudemode();
+- bool has_gx_altitudemode();
+- void set_gx_altitudemode(int gx_altitudemode);
+- void clear_gx_altitudemode();
+-
+- // <outerBoundaryIs>
+- const OuterBoundaryIsPtr get_outerboundaryis();
+- void set_outerboundaryis(OuterBoundaryIsPtr outerboundaryis);
+- bool has_outerboundaryis();
+- void clear_outerboundaryis();
+-
+- // <innerBoundaryIs>...
+- void add_innerboundaryis(InnerBoundaryIsPtr innerboundaryis);
+- const size_t get_innerboundaryis_array_size();
+- const InnerBoundaryIsPtr get_innerboundaryis_array_at(unsigned int index);
+-};
+-
+-%nodefaultctor SimpleData;
+-class SimpleData : public Element {
+-public:
+- // name=
+- const std::string& get_name();
+- bool has_name();
+- void set_name(const std::string& value);
+- void clear_name();
+-
+- // char data
+- const std::string& get_text();
+- bool has_text();
+- void set_text(const std::string& value);
+- void clear_text();
+-};
+-
+-%nodefaultctor SchemaData;
+-class SchemaData : public Object {
+-public:
+- // schemaUrl=
+- const std::string& get_schemaurl();
+- bool has_schemaurl();
+- void set_schemaurl(const std::string& value);
+- void clear_schemaurl();
+- // <SimpleData>...
+- void add_simpledata(SimpleDataPtr simpledata);
+- const size_t get_simpledata_array_size();
+- const SimpleDataPtr get_simpledata_array_at(unsigned int index);
+-};
+-
+-%nodefaultctor OverlayXY;
+-class OverlayXY : public Vec2 {
+-};
+-
+-%nodefaultctor ScreenXY;
+-class ScreenXY : public Vec2 {
+-};
+-
+-%nodefaultctor RotationXY;
+-class RotationXY : public Vec2 {
+-};
+-
+-%nodefaultctor Size;
+-class Size : public Vec2 {
+-};
+-
+-%nodefaultctor ScreenOverlay;
+-class ScreenOverlay : public Overlay {
+-public:
+- // <OverlayXY>
+- const OverlayXYPtr get_overlayxy();
+- void set_overlayxy(OverlayXYPtr overlayxy);
+- bool has_overlayxy();
+- void clear_overlayxy();
+-
+- // <ScreenXY>
+- const ScreenXYPtr get_screenxy();
+- void set_screenxy(ScreenXYPtr screenxy);
+- bool has_screenxy();
+- void clear_screenxy();
+-
+- // <RotationXY>
+- const RotationXYPtr get_rotationxy();
+- void set_rotationxy(RotationXYPtr rotationxy);
+- bool has_rotationxy();
+- void clear_rotationxy();
+-
+- // <size>
+- const SizePtr get_size();
+- void set_size(SizePtr size);
+- bool has_size();
+- void clear_size();
+-
+- // <rotation>
+- double get_rotation();
+- void set_rotation(double rotation);
+- bool has_rotation();
+- void clear_rotation();
+-};
+-
+-%nodefaultctor Style;
+-class Style : public StyleSelector {
+-public:
+- // <IconStyle>
+- const IconStylePtr get_iconstyle();
+- void set_iconstyle(IconStylePtr iconstyle);
+- bool has_iconstyle();
+- void clear_iconstyle();
+-
+- // <LabelStyle>
+- const LabelStylePtr get_labelstyle();
+- void set_labelstyle(LabelStylePtr labelstyle);
+- bool has_labelstyle();
+- void clear_labelstyle();
+-
+- // <LineStyle>
+- const LineStylePtr get_linestyle();
+- void set_linestyle(LineStylePtr linestyle);
+- bool has_linestyle();
+- void clear_linestyle();
+-
+- // <PolyStyle>
+- const PolyStylePtr get_polystyle();
+- void set_polystyle(PolyStylePtr polystyle);
+- bool has_polystyle();
+- void clear_polystyle();
+-
+- // <BalloonStyle>
+- const BalloonStylePtr get_balloonstyle();
+- void set_balloonstyle(BalloonStylePtr balloonstyle);
+- bool has_balloonstyle();
+- void clear_balloonstyle();
+-
+- // <ListStyle>
+- const ListStylePtr get_liststyle();
+- void set_liststyle(ListStylePtr liststyle);
+- bool has_liststyle();
+- void clear_liststyle();
+-};
+-
+-%nodefaultctor StyleMap;
+-class StyleMap : public StyleSelector {
+-public:
+- // <Pair>...
+- void add_pair(PairPtr pair);
+- const size_t get_pair_array_size();
+- const PairPtr get_pair_array_at(unsigned int index);
+-};
+-
+-%nodefaultctor TimeSpan;
+-class TimeSpan : public TimePrimitive {
+-public:
+- // <begin>
+- const std::string& get_begin();
+- void set_begin(const std::string& begin);
+- bool has_begin();
+- void clear_begin();
+-
+- // <end>
+- const std::string& get_end();
+- void set_end(const std::string& end);
+- bool has_end();
+- void clear_end();
+-};
+-
+-%nodefaultctor GxTimeSpan;
+-class GxTimeSpan : public TimeSpan {
+-};
+-
+-%nodefaultctor TimeStamp;
+-class TimeStamp : public TimePrimitive {
+-public:
+- // <when>
+- const std::string& get_when();
+- void set_when(const std::string& when);
+- bool has_when();
+- void clear_when();
+-};
+-
+-%nodefaultctor GxTimeStamp;
+-class GxTimeStamp : public TimeStamp {
+-};
+-
+-%nodefaultctor Kml;
+-class Kml : public Element {
+-public:
+- // hint=
+- const std::string& get_hint();
+- void set_hint(const std::string& hint);
+- bool has_hint();
+- void clear_hint();
+-
+- // <NetworkLinkControl>
+- const NetworkLinkControlPtr get_networklinkcontrol();
+- void set_networklinkcontrol(NetworkLinkControlPtr networklinkcontrol);
+- bool has_networklinkcontrol();
+- void clear_networklinkcontrol();
+-
+- // Feature
+- const FeaturePtr get_feature();
+- void set_feature(FeaturePtr feature);
+- bool has_feature();
+- void clear_feature();
+-};
+-
+-// <atom:author>
+-%nodefaultctor AtomAuthor;
+-class AtomAuthor : public Element {
+-public:
+- // <atom:name>
+- const std::string& get_name();
+- void set_name(const std::string& name);
+- bool has_name();
+- void clear_name();
+-
+- // <atom:uri>
+- const std::string& get_uri();
+- void set_uri(const std::string& uri);
+- bool has_uri();
+- void clear_uri();
+-
+- // <atom:email>
+- const std::string& get_email();
+- void set_email(const std::string& email);
+- bool has_email();
+- void clear_email();
+-};
+-
+-// <atom:link>
+-%nodefaultctor AtomLink;
+-class AtomLink : public Element {
+-public:
+- // href=, RFC 4287 4.2.7.1, RFC 3987
+- const std::string& get_href();
+- bool has_href();
+- void set_href(const std::string& value);
+- void clear_href();
+-
+- // rel=, RFC 4287 4.2.7.2, RFC 3987
+- const std::string& get_rel();
+- bool has_rel();
+- void set_rel(const std::string& value);
+- void clear_rel();
+-
+- // type=, RFC 4287 4.2.7.3, MIME
+- const std::string& get_type();
+- bool has_type();
+- void set_type(const std::string& value);
+- void clear_type();
+-
+- // hreflang=, RFC 4287 4.2.7.4, RFC 3066
+- const std::string& get_hreflang();
+- bool has_hreflang();
+- void set_hreflang(const std::string& value);
+- void clear_hreflang();
+-
+- // title=, RFC 4287 4.2.7.5
+- const std::string& get_title();
+- bool has_title();
+- void set_title(const std::string& value);
+- void clear_title();
+-
+- // length=, RFC 4287 4.2.7.6
+- const int get_length();
+- bool has_length();
+- void set_length(int value);
+- void clear_length();
+-};
+-
+-// GxTourPrimitive is an abstract base type. This corresponds to
+-// gx:AbstractGxTourPrimitiveType/Group in KML 2.2 gx.
+-%nodefaultctor GxTourPrimitive;
+-class GxTourPrimitive : public Object {
+-};
+-
+-// <gx:Playlist>
+-%nodefaultctor GxPlaylist;
+-class GxPlaylist : public Object {
+- // GxTourPrimitive...
+- public:
+- void add_gx_tourprimitive(GxTourPrimitivePtr tourprimitive);
+- const size_t get_gx_tourprimitive_array_size();
+- const GxTourPrimitivePtr get_gx_tourprimitive_array_at(unsigned int index);
+-};
+-
+-// <gx:Tour>
+-%nodefaultctor GxTour;
+-class GxTour : public Feature {
+- public:
+- // <gx:Playlist>
+- const GxPlaylistPtr get_gx_playlist();
+- bool has_gx_playlist();
+- void set_gx_playlist(GxPlaylistPtr gx_playlist);
+- void clear_gx_playlist();
+-};
+-
+-// <gx:AnimatedUpdate>
+-%nodefaultctor GxAnimatedUpdate;
+-class GxAnimatedUpdate : public GxTourPrimitive {
+-public:
+- // <gx:duration>
+- double get_gx_duration();
+- bool has_gx_duration();
+- void set_gx_duration(double gx_duration);
+- void clear_gx_duration();
+-
+- // <Update>
+- const UpdatePtr get_update();
+- bool has_update();
+- void set_update(UpdatePtr update);
+- void clear_update();
+-};
+-
+-// <gx:FlyTo>
+-%nodefaultctor GxFlyTo;
+-class GxFlyTo : public GxTourPrimitive {
+- public:
+- // <gx:duration>
+- double get_gx_duration();
+- bool has_gx_duration();
+- void set_gx_duration(double gx_duration);
+- void clear_gx_duration();
+-
+- // <gx:flyToMode>.
+- int get_gx_flytomode();
+- bool has_gx_flytomode();
+- void set_gx_flytomode(int value);
+- void clear_gx_flytomode();
+-
+- // AbstractView
+- const AbstractViewPtr get_abstractview();
+- bool has_abstractview();
+- void set_abstractview(AbstractViewPtr abstractview);
+- void clear_abstractview();
+-};
+-
+-// <gx:Wait>
+-%nodefaultctor GxWait;
+-class GxWait : public GxTourPrimitive {
+-public:
+- // <gx:duration>
+- double get_gx_duration();
+- bool has_gx_duration();
+- void set_gx_duration(double gx_duration);
+- void clear_gx_duration();
+-};
+-
+-// <gx:SoundCue>
+-%nodefaultctor GxSoundCue;
+-class GxSoundCue : public GxTourPrimitive {
+-public:
+- // <href>
+- const std::string& get_href();
+- bool has_href();
+- void set_href(const std::string& href);
+- void clear_href();
+-};
+-
+-// <gx:TourControl>
+-%nodefaultctor GxTourControl;
+-class GxTourControl : public GxTourPrimitive {
+-public:
+- // <gx:playMode>
+- int get_gx_playmode();
+- bool has_gx_playmode();
+- void set_gx_playmode(int value);
+- void clear_gx_playmode();
+-};
+-
+--- /dev/null
++++ b/src/swig/libkml_kmlelements.i
+@@ -0,0 +1,1750 @@
++// Copyright 2008, Google Inc. All rights reserved.
++//
++// Redistribution and use in source and binary forms, with or without
++// modification, are permitted provided that the following conditions are met:
++//
++// 1. Redistributions of source code must retain the above copyright notice,
++// this list of conditions and the following disclaimer.
++// 2. Redistributions in binary form must reproduce the above copyright notice,
++// this list of conditions and the following disclaimer in the documentation
++// and/or other materials provided with the distribution.
++// 3. Neither the name of Google Inc. nor the names of its contributors may be
++// used to endorse or promote products derived from this software without
++// specific prior written permission.
++//
++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
++// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
++// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
++// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
++// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
++// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
++// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
++// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
++// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++
++// Generated from the KML 2.2 XSD.
++
++// This is the SWIG interface file for the public API to the KML DOM.
++// In addition to serving the needs of SWIG this also serves to document the
++// public C++ API separate from the present implementation found in the
++// private sections of the present C++ .h files.
++
++// This is AbstractObjectType in the KML 2.2 XSD.
++%nodefaultctor Object;
++class Object : public Element {
++public:
++ // id=
++ const std::string& get_id();
++ void set_id(const std::string& id);
++ bool has_id();
++ void clear_id();
++
++ // targetId=
++ const std::string& get_targetid();
++ void set_targetid(const std::string& targetid);
++ bool has_targetid();
++ void clear_targetid();
++};
++
++%nodefaultctor SubStyle;
++class SubStyle : public Object {
++};
++
++%nodefaultctor ColorStyle;
++class ColorStyle : public SubStyle {
++public:
++ // <color>
++ const kmlbase::Color32& get_color();
++ void set_color(const kmlbase::Color32& color);
++ bool has_color();
++ void clear_color();
++
++ // <colorMode>
++ int get_colormode();
++ void set_colormode(int colormode);
++ bool has_colormode();
++ void clear_colormode();
++};
++
++%nodefaultctor SnippetCommon;
++class SnippetCommon : public Element {
++public:
++ // Content.
++ const std::string& get_text();
++ void set_text(const std::string& text);
++ bool has_text();
++ void clear_text();
++
++ // maxLines=
++ int get_maxlines();
++ void set_maxlines(int maxlines);
++ bool has_maxlines();
++ void clear_maxlines();
++};
++
++%nodefaultctor Snippet;
++class Snippet : public SnippetCommon {
++};
++
++%nodefaultctor LinkSnippet;
++class LinkSnippet : public SnippetCommon {
++};
++
++%nodefaultctor AbstractView;
++class AbstractView : public Object {
++ public:
++ // gx:TimeStamp and gx:TimeSpan.
++ const TimePrimitivePtr get_gx_timeprimitive();
++ bool has_gx_timeprimitive();
++ void set_gx_timeprimitive(const TimePrimitivePtr& gx_timeprimitive);
++ void clear_gx_timeprimitive();
++};
++
++%nodefaultctor TimePrimitive;
++class TimePrimitive : public Object {
++};
++
++%nodefaultctor StyleSelector;
++class StyleSelector : public Object {
++};
++
++%nodefaultctor AbstractLatLonBox;
++class AbstractLatLonBox : public Object {
++public:
++ // <north>
++ double get_north();
++ bool has_north();
++ void set_north(double north);
++ void clear_north();
++
++ // <south>
++ double get_south();
++ bool has_south();
++ void set_south(double south);
++ void clear_south();
++
++ // <east>
++ double get_east();
++ bool has_east();
++ void set_east(double east);
++ void clear_east();
++
++ // <west>
++ double get_west();
++ bool has_west();
++ void set_west(double west);
++ void clear_west();
++};
++
++%nodefaultctor LatLonAltBox;
++class LatLonAltBox : public AbstractLatLonBox {
++public:
++ // <minAltitude>
++ double get_minaltitude();
++ void set_minaltitude(double minaltitude);
++ bool has_minaltitude();
++ void clear_minaltitude();
++
++ // <maxAltitude>
++ double get_maxaltitude();
++ void set_maxaltitude(double maxaltitude);
++ bool has_maxaltitude();
++ void clear_maxaltitude();
++
++ // <altitudeMode>
++ int get_altitudemode();
++ void set_altitudemode(int altitudemode);
++ bool has_altitudemode();
++ void clear_altitudemode();
++
++ // <gx:altitudeMode>
++ int get_gx_altitudemode();
++ bool has_gx_altitudemode();
++ void set_gx_altitudemode(int gx_altitudemode);
++ void clear_gx_altitudemode();
++};
++
++%nodefaultctor Lod;
++class Lod : public Object {
++public:
++ // <minLodPixels>
++ double get_minlodpixels();
++ void set_minlodpixels(double minlodpixels);
++ bool has_minlodpixels();
++ void clear_minlodpixels();
++
++ // <maxLodPixels>
++ double get_maxlodpixels();
++ void set_maxlodpixels(double maxlodpixels);
++ bool has_maxlodpixels();
++ void clear_maxlodpixels();
++
++ // <minFadeExtent>
++ double get_minfadeextent();
++ void set_minfadeextent(double minfadeextent);
++ bool has_minfadeextent();
++ void clear_minfadeextent();
++
++ // <maxFadeExtent>
++ double get_maxfadeextent();
++ void set_maxfadeextent(double maxfadeextent);
++ bool has_maxfadeextent();
++ void clear_maxfadeextent();
++};
++
++%nodefaultctor Region;
++class Region : public Object {
++public:
++ // <LatLonAltBox>
++ const LatLonAltBoxPtr get_latlonaltbox();
++ void set_latlonaltbox(LatLonAltBoxPtr latlonaltbox);
++ bool has_latlonaltbox();
++ void clear_latlonaltbox();
++
++ // <Lod>
++ const LodPtr get_lod();
++ void set_lod(LodPtr lod);
++ bool has_lod();
++ void clear_lod();
++};
++
++%nodefaultctor ExtendedData;
++class ExtendedData : public Element {
++public:
++ // <Data>.
++ void add_data(DataPtr data);
++ const size_t get_data_array_size();
++ const DataPtr get_data_array_at(unsigned int index);
++ // <SchemaData>.
++ void add_schemadata(SchemaDataPtr schemadata);
++ const size_t get_schemadata_array_size();
++ const SchemaDataPtr get_schemadata_array_at(unsigned int index);
++};
++
++%nodefaultctor Feature;
++class Feature : public Object {
++public:
++ // <name>
++ const std::string& get_name();
++ void set_name(const std::string& name);
++ bool has_name();
++ void clear_name();
++
++ // <visibility>
++ bool get_visibility();
++ void set_visibility(bool visibility);
++ bool has_visibility();
++ void clear_visibility();
++
++ // <open>
++ bool get_open();
++ void set_open(bool open);
++ bool has_open();
++ void clear_open();
++
++ // <atom:author>
++ const AtomAuthorPtr get_atomauthor();
++ bool has_atomauthor();
++ void set_atomauthor(AtomAuthorPtr atomauthor);
++ void clear_atomauthor();
++
++ // <atom:link>
++ const AtomLinkPtr get_atomlink();
++ bool has_atomlink();
++ void set_atomlink(AtomLinkPtr atomlink);
++ void clear_atomlink();
++
++ // <address>
++ const std::string& get_address();
++ void set_address(const std::string& address);
++ bool has_address();
++ void clear_address();
++
++ // <phoneNumber>
++ const std::string& get_phonenumber();
++ void set_phonenumber(const std::string& phonenumber);
++ bool has_phonenumber();
++ void clear_phonenumber();
++
++ // <Snippet>
++ const SnippetPtr get_snippet();
++ void set_snippet(SnippetPtr snippet);
++ bool has_snippet();
++ void clear_snippet();
++
++ // <description>
++ const std::string& get_description();
++ void set_description(const std::string& description);
++ bool has_description();
++ void clear_description();
++
++ // AbstractView
++ const AbstractViewPtr get_abstractview();
++ void set_abstractview(AbstractViewPtr abstractview);
++ bool has_abstractview();
++ void clear_abstractview();
++
++ // TimePrimitive
++ const TimePrimitivePtr get_timeprimitive();
++ void set_timeprimitive(TimePrimitivePtr timeprimitive);
++ bool has_timeprimitive();
++ void clear_timeprimitive();
++
++ // <styleUrl>
++ const std::string& get_styleurl();
++ void set_styleurl(const std::string& styleurl);
++ bool has_styleurl();
++ void clear_styleurl();
++
++ // StyleSelector
++ const StyleSelectorPtr get_styleselector();
++ void set_styleselector(StyleSelectorPtr styleselector);
++ bool has_styleselector();
++ void clear_styleselector();
++
++ // <Region>
++ const RegionPtr get_region();
++ void set_region(RegionPtr region);
++ bool has_region();
++ void clear_region();
++
++ // <ExtendedData>
++ const ExtendedDataPtr get_extendeddata();
++ void set_extendeddata(ExtendedDataPtr extendeddata);
++ bool has_extendeddata();
++ void clear_extendeddata();
++
++ // <gx:balloonVisibility>
++ bool get_gx_balloonvisibility();
++ void set_gx_balloonvisibility(bool balloonvisibility);
++ bool has_gx_balloonvisibility();
++ void clear_gx_balloonvisibility();
++};
++
++%nodefaultctor Container;
++class Container : public Feature {
++public:
++ // Feature...
++ void add_feature(FeaturePtr feature);
++ const size_t get_feature_array_size();
++ const FeaturePtr get_feature_array_at(unsigned int index);
++};
++
++%nodefaultctor Geometry;
++class Geometry : public Object {
++};
++
++%nodefaultctor BasicLink;
++class BasicLink : public Object {
++public:
++ // <href>
++ const std::string& get_href();
++ bool has_href();
++ void set_href(const std::string& href);
++ void clear_href();
++};
++
++%nodefaultctor Icon;
++class Icon : public BasicLink {
++public:
++ // <refreshMode>
++ int get_refreshmode();
++ void set_refreshmode(int refreshmode);
++ bool has_refreshmode();
++ void clear_refreshmode();
++
++ // <refreshInterval>
++ double get_refreshinterval();
++ void set_refreshinterval(double refreshinterval);
++ bool has_refreshinterval();
++ void clear_refreshinterval();
++
++ // <viewRefreshMode>
++ int get_viewrefreshmode();
++ void set_viewrefreshmode(int viewrefreshmode);
++ bool has_viewrefreshmode();
++ void clear_viewrefreshmode();
++
++ // <viewRefreshTime>
++ double get_viewrefreshtime();
++ void set_viewrefreshtime(double viewrefreshtime);
++ bool has_viewrefreshtime();
++ void clear_viewrefreshtime();
++
++ // <viewBoundScale>
++ double get_viewboundscale();
++ void set_viewboundscale(double viewboundscale);
++ bool has_viewboundscale();
++ void clear_viewboundscale();
++
++ // <viewFormat>
++ const std::string& get_viewformat();
++ void set_viewformat(const std::string& viewformat);
++ bool has_viewformat();
++ void clear_viewformat();
++
++ // <httpQuery>
++ const std::string& get_httpquery();
++ void set_httpquery(const std::string& httpquery);
++ bool has_httpquery();
++ void clear_httpquery();
++};
++
++%nodefaultctor IconStyleIcon;
++class IconStyleIcon : public BasicLink {
++public:
++ // <href>
++ const std::string& get_href();
++ bool has_href();
++ void set_href(const std::string& href);
++ void clear_href();
++};
++
++%nodefaultctor Overlay;
++class Overlay : public Feature {
++public:
++ // <color>
++ const kmlbase::Color32& get_color();
++ void set_color(const kmlbase::Color32& color);
++ bool has_color();
++ void clear_color();
++
++ // <drawOrder>
++ int get_draworder();
++ void set_draworder(int draworder);
++ bool has_draworder();
++ void clear_draworder();
++
++ // <Icon>
++ const IconPtr get_icon();
++ void set_icon(IconPtr icon);
++ bool has_icon();
++ void clear_icon();
++};
++
++%nodefaultctor BalloonStyle;
++class BalloonStyle : public SubStyle {
++public:
++ // <bgColor>
++ const kmlbase::Color32& get_bgcolor();
++ void set_bgcolor(const kmlbase::Color32& bgcolor);
++ bool has_bgcolor();
++ void clear_bgcolor();
++
++ // <textColor>
++ const kmlbase::Color32& get_textcolor();
++ void set_textcolor(const kmlbase::Color32& textcolor);
++ bool has_textcolor();
++ void clear_textcolor();
++
++ // <text>
++ const std::string& get_text();
++ void set_text(const std::string& text);
++ bool has_text();
++ void clear_text();
++
++ // <displayMode>
++ int get_displaymode();
++ void set_displaymode(int displaymode);
++ bool has_displaymode();
++ void clear_displaymode();
++};
++
++%nodefaultctor Camera;
++class Camera : public AbstractView {
++public:
++ // <longitude>
++ double get_longitude();
++ void set_longitude(double longitude);
++ bool has_longitude();
++ void clear_longitude();
++
++ // <latitude>
++ double get_latitude();
++ void set_latitude(double latitude);
++ bool has_latitude();
++ void clear_latitude();
++
++ // <altitude>
++ double get_altitude();
++ void set_altitude(double altitude);
++ bool has_altitude();
++ void clear_altitude();
++
++ // <heading>
++ double get_heading();
++ void set_heading(double heading);
++ bool has_heading();
++ void clear_heading();
++
++ // <tilt>
++ double get_tilt();
++ void set_tilt(double tilt);
++ bool has_tilt();
++ void clear_tilt();
++
++ // <roll>
++ double get_roll();
++ void set_roll(double roll);
++ bool has_roll();
++ void clear_roll();
++
++ // <altitudeMode>
++ int get_altitudemode();
++ void set_altitudemode(int altitudemode);
++ bool has_altitudemode();
++ void clear_altitudemode();
++
++ // <gx:altitudeMode>
++ int get_gx_altitudemode();
++ bool has_gx_altitudemode();
++ void set_gx_altitudemode(int gx_altitudemode);
++ void clear_gx_altitudemode();
++};
++
++%nodefaultctor UpdateOperation;
++class UpdateOperation : public Element {
++};
++
++%nodefaultctor Change;
++class Change : public UpdateOperation {
++public:
++ // Object...
++ void add_object(ObjectPtr object);
++ const size_t get_object_array_size();
++ const ObjectPtr get_object_array_at(unsigned int index);
++};
++
++%nodefaultctor Create;
++class Create : public UpdateOperation {
++public:
++ // Container...
++ void add_container(ContainerPtr container);
++ const size_t get_container_array_size();
++ const ContainerPtr get_container_array_at(unsigned int index);
++};
++
++%nodefaultctor Data;
++class Data : public Object {
++public:
++ // name=
++ const std::string& get_name();
++ bool has_name();
++ void set_name(const std::string& name);
++ void clear_name();
++
++ // <displayname>
++ const std::string& get_displayname();
++ bool has_displayname();
++ void set_displayname(const std::string& displayname);
++ void clear_displayname();
++
++ // <value>
++ const std::string& get_value();
++ bool has_value();
++ void set_value(const std::string& value);
++ void clear_value();
++};
++
++%nodefaultctor Delete;
++class Delete : public UpdateOperation {
++public:
++ // Feature...
++ void add_feature(FeaturePtr feature);
++ const size_t get_feature_array_size();
++ const FeaturePtr get_feature_array_at(unsigned int index);
++};
++
++%nodefaultctor SimpleField;
++class SimpleField : public Element {
++public:
++ // type=
++ const std::string& get_type();
++ bool has_type();
++ void set_type(const std::string& value);
++ void clear_type();
++
++ // name=
++ const std::string& get_name();
++ bool has_name();
++ void set_name(const std::string& value);
++ void clear_name();
++
++ // <displayName>
++ const std::string& get_displayname();
++ void set_displayname(const std::string& displayname);
++ bool has_displayname();
++ void clear_displayname();
++};
++
++%nodefaultctor Schema;
++class Schema : public Object {
++public:
++ // name=
++ const std::string& get_name();
++ bool has_name();
++ void set_name(const std::string& value);
++ void clear_name();
++
++ // <SimpleField>...
++ void add_simplefield(SimpleFieldPtr simplefield);
++ const size_t get_simplefield_array_size();
++ const SimpleFieldPtr get_simplefield_array_at(unsigned int index);
++};
++
++%nodefaultctor Document;
++class Document : public Container {
++public:
++ // <Schema>...
++ void add_schema(SchemaPtr schema);
++ const size_t get_schema_array_size();
++ const SchemaPtr get_schema_array_at(unsigned int index);
++
++ // <Style>,<StyleMap>...
++ void add_styleselector(StyleSelectorPtr styleselector);
++ const size_t get_styleselector_array_size();
++ const StyleSelectorPtr get_styleselector_array_at(unsigned int index);
++};
++
++%nodefaultctor Folder;
++class Folder : public Container {
++};
++
++%nodefaultctor LatLonBox;
++class LatLonBox : public AbstractLatLonBox {
++public:
++ // <rotation>
++ double get_rotation();
++ void set_rotation(double rotation);
++ bool has_rotation();
++ void clear_rotation();
++};
++
++%nodefaultctor GxLatLonQuad;
++class GxLatLonQuad : public Object {
++public:
++ // <coordinates>
++ const CoordinatesPtr get_coordinates();
++ bool has_coordinates();
++ void set_coordinates(const CoordinatesPtr& coordinates);
++ void clear_coordinates();
++};
++
++%nodefaultctor GroundOverlay;
++class GroundOverlay : public Overlay {
++public:
++ // <altitude>
++ double get_altitude();
++ void set_altitude(double altitude);
++ bool has_altitude();
++ void clear_altitude();
++
++ // <altitudeMode>
++ int get_altitudemode();
++ void set_altitudemode(int altitudemode);
++ bool has_altitudemode();
++ void clear_altitudemode();
++
++ // <gx:altitudeMode>
++ int get_gx_altitudemode();
++ bool has_gx_altitudemode();
++ void set_gx_altitudemode(int gx_altitudemode);
++ void clear_gx_altitudemode();
++
++ // <LatLonBox>
++ const LatLonBoxPtr get_latlonbox();
++ void set_latlonbox(LatLonBoxPtr latlonbox);
++ bool has_latlonbox();
++ void clear_latlonbox();
++
++ // <gx:LatLonQuad>
++ const GxLatLonQuadPtr get_gx_latlonquad();
++ bool has_gx_latlonquad();
++ void set_gx_latlonquad(GxLatLonQuadPtr gx_latlonquad);
++ void clear_gx_latlonquad();
++};
++
++%nodefaultctor HotSpot;
++class HotSpot : public Vec2 {
++};
++
++%nodefaultctor IconStyle;
++class IconStyle : public ColorStyle {
++public:
++ // <scale>
++ double get_scale();
++ void set_scale(double scale);
++ bool has_scale();
++ void clear_scale();
++
++ // <Icon> (different from Overlay Icon)
++ const IconStyleIconPtr get_icon();
++ void set_icon(IconStyleIconPtr icon);
++ bool has_icon();
++ void clear_icon();
++
++ // <heading>
++ double get_heading();
++ void set_heading(double heading);
++ bool has_heading();
++ void clear_heading();
++
++ // <hotSpot>
++ const HotSpotPtr get_hotspot();
++ void set_hotspot(HotSpotPtr hotspot);
++ bool has_hotspot();
++ void clear_hotspot();
++};
++
++%nodefaultctor ImagePyramid;
++class ImagePyramid : public Object {
++public:
++ // <tileSize>
++ int get_tilesize();
++ void set_tilesize(int tilesize);
++ bool has_tilesize();
++ void clear_tilesize();
++
++ // <maxWidth>
++ int get_maxwidth();
++ void set_maxwidth(int maxwidth);
++ bool has_maxwidth();
++ void clear_maxwidth();
++
++ // <maxHeight>
++ int get_maxheight();
++ void set_maxheight(int maxheight);
++ bool has_maxheight();
++ void clear_maxheight();
++
++ // <gridOrigin>
++ int get_gridorigin();
++ void set_gridorigin(int gridorigin);
++ bool has_gridorigin();
++ void clear_gridorigin();
++};
++
++%nodefaultctor ItemIcon;
++class ItemIcon : public Object {
++public:
++ // <state>
++ int get_state_array_at(unsigned int index);
++ const size_t get_state_array_size();
++ bool has_state();
++ void add_state(int state);
++ void clear_state();
++
++ // <href>
++ const std::string& get_href();
++ void set_href(const std::string& href);
++ bool has_href();
++ void clear_href();
++};
++
++%nodefaultctor LabelStyle;
++class LabelStyle : public ColorStyle {
++public:
++ // <scale>
++ double get_scale();
++ void set_scale(double scale);
++ bool has_scale();
++ void clear_scale();
++};
++
++%nodefaultctor LineString;
++class LineString : public Geometry {
++public:
++ // <extrude>
++ bool get_extrude();
++ void set_extrude(bool extrude);
++ bool has_extrude();
++ void clear_extrude();
++
++ // <tessellate>
++ bool get_tessellate();
++ void set_tessellate(bool tessellate);
++ bool has_tessellate();
++ void clear_tessellate();
++
++ // <altitudeMode>
++ int get_altitudemode();
++ void set_altitudemode(int altitudemode);
++ bool has_altitudemode();
++ void clear_altitudemode();
++
++ // <gx:altitudeMode>
++ int get_gx_altitudemode();
++ bool has_gx_altitudemode();
++ void set_gx_altitudemode(int gx_altitudemode);
++ void clear_gx_altitudemode();
++
++ // <coordinates>
++ const CoordinatesPtr get_coordinates();
++ void set_coordinates(CoordinatesPtr coordinates);
++ bool has_coordinates();
++ void clear_coordinates();
++};
++
++%nodefaultctor LineStyle;
++class LineStyle : public ColorStyle {
++public:
++ // <width>
++ double get_width();
++ void set_width(double width);
++ bool has_width();
++ void clear_width();
++};
++
++%nodefaultctor LinearRing;
++class LinearRing : public Geometry {
++public:
++ // <extrude>
++ bool get_extrude();
++ void set_extrude(bool extrude);
++ bool has_extrude();
++ void clear_extrude();
++
++ // <tessellate>
++ bool get_tessellate();
++ void set_tessellate(bool tessellate);
++ bool has_tessellate();
++ void clear_tessellate();
++
++ // <altitudeMode>
++ int get_altitudemode();
++ void set_altitudemode(int altitudemode);
++ bool has_altitudemode();
++ void clear_altitudemode();
++
++ // <gx:altitudeMode>
++ int get_gx_altitudemode();
++ bool has_gx_altitudemode();
++ void set_gx_altitudemode(int gx_altitudemode);
++ void clear_gx_altitudemode();
++
++ // <coordinates>
++ const CoordinatesPtr get_coordinates();
++ void set_coordinates(CoordinatesPtr coordinates);
++ bool has_coordinates();
++ void clear_coordinates();
++};
++
++%nodefaultctor Link;
++class Link : public BasicLink {
++public:
++ // <refreshMode>
++ int get_refreshmode();
++ void set_refreshmode(int refreshmode);
++ bool has_refreshmode();
++ void clear_refreshmode();
++
++ // <refreshInterval>
++ double get_refreshinterval();
++ void set_refreshinterval(double refreshinterval);
++ bool has_refreshinterval();
++ void clear_refreshinterval();
++
++ // <viewRefreshMode>
++ int get_viewrefreshmode();
++ void set_viewrefreshmode(int viewrefreshmode);
++ bool has_viewrefreshmode();
++ void clear_viewrefreshmode();
++
++ // <viewRefreshTime>
++ double get_viewrefreshtime();
++ void set_viewrefreshtime(double viewrefreshtime);
++ bool has_viewrefreshtime();
++ void clear_viewrefreshtime();
++
++ // <viewBoundScale>
++ double get_viewboundscale();
++ void set_viewboundscale(double viewboundscale);
++ bool has_viewboundscale();
++ void clear_viewboundscale();
++
++ // <viewFormat>
++ const std::string& get_viewformat();
++ void set_viewformat(const std::string& viewformat);
++ bool has_viewformat();
++ void clear_viewformat();
++
++ // <httpQuery>
++ const std::string& get_httpquery();
++ void set_httpquery(const std::string& httpquery);
++ bool has_httpquery();
++ void clear_httpquery();
++};
++
++%nodefaultctor ListStyle;
++class ListStyle : public SubStyle {
++public:
++ // <listItemType>
++ int get_listitemtype();
++ void set_listitemtype(int listitemtype);
++ bool has_listitemtype();
++ void clear_listitemtype();
++
++ // <bgColor>
++ const kmlbase::Color32& get_bgcolor();
++ void set_bgcolor(const kmlbase::Color32& bgcolor);
++ bool has_bgcolor();
++ void clear_bgcolor();
++
++ // <ItemIcon>...
++ void add_itemicon(ItemIconPtr itemicon);
++ const size_t get_itemicon_array_size();
++ const ItemIconPtr get_itemicon_array_at(unsigned int index);
++};
++
++%nodefaultctor Location;
++class Location : public Object {
++public:
++ // <longitude>
++ double get_longitude();
++ void set_longitude(double longitude);
++ bool has_longitude();
++ void clear_longitude();
++
++ // <latitude>
++ double get_latitude();
++ void set_latitude(double latitude);
++ bool has_latitude();
++ void clear_latitude();
++
++ // <altitude>
++ double get_altitude();
++ void set_altitude(double altitude);
++ bool has_altitude();
++ void clear_altitude();
++};
++
++%nodefaultctor LookAt;
++class LookAt : public AbstractView {
++public:
++ // <longitude>
++ double get_longitude();
++ void set_longitude(double longitude);
++ bool has_longitude();
++ void clear_longitude();
++
++ // <latitude>
++ double get_latitude();
++ void set_latitude(double latitude);
++ bool has_latitude();
++ void clear_latitude();
++
++ // <altitude>
++ double get_altitude();
++ void set_altitude(double altitude);
++ bool has_altitude();
++ void clear_altitude();
++
++ // <heading>
++ double get_heading();
++ void set_heading(double heading);
++ bool has_heading();
++ void clear_heading();
++
++ // <tilt>
++ double get_tilt();
++ void set_tilt(double tilt);
++ bool has_tilt();
++ void clear_tilt();
++
++ // <range>
++ double get_range();
++ void set_range(double range);
++ bool has_range();
++ void clear_range();
++
++ // <altitudeMode>
++ int get_altitudemode();
++ void set_altitudemode(int altitudemode);
++ bool has_altitudemode();
++ void clear_altitudemode();
++
++ // <gx:altitudeMode>
++ int get_gx_altitudemode();
++ bool has_gx_altitudemode();
++ void set_gx_altitudemode(int gx_altitudemode);
++ void clear_gx_altitudemode();
++};
++
++%nodefaultctor Orientation;
++class Orientation : public Object {
++public:
++ // <heading>
++ double get_heading();
++ void set_heading(double heading);
++ bool has_heading();
++ void clear_heading();
++
++ // <tilt>
++ double get_tilt();
++ void set_tilt(double tilt);
++ bool has_tilt();
++ void clear_tilt();
++
++ // <roll>
++ double get_roll();
++ void set_roll(double roll);
++ bool has_roll();
++ void clear_roll();
++};
++
++%nodefaultctor Scale;
++class Scale : public Object {
++public:
++ // <x>
++ double get_x();
++ void set_x(double x);
++ bool has_x();
++ void clear_x();
++
++ // <y>
++ double get_y();
++ void set_y(double y);
++ bool has_y();
++ void clear_y();
++
++ // <z>
++ double get_z();
++ void set_z(double z);
++ bool has_z();
++ void clear_z();
++};
++
++%nodefaultctor Alias;
++class Alias : public Object {
++public:
++ // <targetHref>
++ const std::string& get_targethref();
++ void set_targethref(const std::string& targethref);
++ bool has_targethref();
++ void clear_targethref();
++
++ // <sourceHref>
++ const std::string& get_sourcehref();
++ void set_sourcehref(const std::string& sourcehref);
++ bool has_sourcehref();
++ void clear_sourcehref();
++};
++
++%nodefaultctor ResourceMap;
++class ResourceMap : public Object {
++public:
++ // <Alias>...
++ void add_alias(AliasPtr alias);
++ const size_t get_alias_array_size();
++ const AliasPtr get_alias_array_at(unsigned int index);
++};
++
++%nodefaultctor Model;
++class Model : public Geometry {
++public:
++ // <altitudeMode>
++ int get_altitudemode();
++ void set_altitudemode(int altitudemode);
++ bool has_altitudemode();
++ void clear_altitudemode();
++
++ // <gx:altitudeMode>
++ int get_gx_altitudemode();
++ bool has_gx_altitudemode();
++ void set_gx_altitudemode(int gx_altitudemode);
++ void clear_gx_altitudemode();
++
++ // <Location>
++ const LocationPtr get_location();
++ void set_location(LocationPtr location);
++ bool has_location();
++ void clear_location();
++
++ // <Orientation>
++ const OrientationPtr get_orientation();
++ void set_orientation(OrientationPtr orientation);
++ bool has_orientation();
++ void clear_orientation();
++
++ // <Scale>
++ const ScalePtr get_scale();
++ void set_scale(ScalePtr scale);
++ bool has_scale();
++ void clear_scale();
++
++ // <Link>
++ const LinkPtr get_link();
++ void set_link(LinkPtr link);
++ bool has_link();
++ void clear_link();
++
++ // <ResourceMap>
++ const ResourceMapPtr get_resourcemap();
++ void set_resourcemap(ResourceMapPtr resourcemap);
++ bool has_resourcemap();
++ void clear_resourcemap();
++};
++
++%nodefaultctor MultiGeometry;
++class MultiGeometry : public Geometry {
++public:
++ // Geometry...
++ void add_geometry(GeometryPtr geometry);
++ const size_t get_geometry_array_size();
++ const GeometryPtr get_geometry_array_at(unsigned int index);
++};
++
++%nodefaultctor NetworkLink;
++class NetworkLink : public Feature {
++public:
++ // <refreshVisibility>
++ bool get_refreshvisibility();
++ void set_refreshvisibility(bool refreshvisibility);
++ bool has_refreshvisibility();
++ void clear_refreshvisibility();
++
++ // <flyToView>
++ bool get_flytoview();
++ void set_flytoview(bool flytoview);
++ bool has_flytoview();
++ void clear_flytoview();
++
++ // <Link>
++ const LinkPtr get_link();
++ void set_link(LinkPtr link);
++ bool has_link();
++ void clear_link();
++};
++
++%nodefaultctor Update;
++class Update : public Element {
++public:
++ // <targetHref>
++ const std::string& get_targethref();
++ bool has_targethref();
++ void set_targethref(const std::string& targethref);
++ void clear_targethref();
++
++ // <Change>,<Create>,<Delete>...
++ void add_updateoperation(UpdateOperationPtr updateoperation);
++ const size_t get_updateoperation_array_size();
++ const UpdateOperationPtr get_updateoperation_array_at(unsigned int index);
++};
++
++%nodefaultctor NetworkLinkControl;
++class NetworkLinkControl : public Element {
++public:
++ // <minRefreshPeriod>
++ double get_minrefreshperiod();
++ void set_minrefreshperiod(double minrefreshperiod);
++ bool has_minrefreshperiod();
++ void clear_minrefreshperiod();
++
++ // <maxSessionLength>
++ double get_maxsessionlength();
++ void set_maxsessionlength(double maxsessionlength);
++ bool has_maxsessionlength();
++ void clear_maxsessionlength();
++
++ // <cookie>
++ const std::string& get_cookie();
++ void set_cookie(const std::string& cookie);
++ bool has_cookie();
++ void clear_cookie();
++
++ // <message>
++ const std::string& get_message();
++ void set_message(const std::string& message);
++ bool has_message();
++ void clear_message();
++
++ // <linkName>
++ const std::string& get_linkname();
++ void set_linkname(const std::string& linkname);
++ bool has_linkname();
++ void clear_linkname();
++
++ // <linkDescription>
++ const std::string& get_linkdescription();
++ void set_linkdescription(const std::string& linkdescription);
++ bool has_linkdescription();
++ void clear_linkdescription();
++
++ // <linkSnippet>
++ const LinkSnippetPtr get_linksnippet();
++ void set_linksnippet(LinkSnippetPtr linksnippet);
++ bool has_linksnippet();
++ void clear_linksnippet();
++
++ // <expires>
++ const std::string& get_expires();
++ void set_expires(const std::string& expires);
++ bool has_expires();
++ void clear_expires();
++
++ // <Update>
++ const UpdatePtr get_update();
++ void set_update(UpdatePtr update);
++ bool has_update();
++ void clear_update();
++
++ // AbstractView
++ const AbstractViewPtr get_abstractview();
++ void set_abstractview(AbstractViewPtr abstractview);
++ bool has_abstractview();
++ void clear_abstractview();
++};
++
++%nodefaultctor Pair;
++class Pair : public Object {
++public:
++ // <key>
++ int get_key();
++ void set_key(int key);
++ bool has_key();
++ void clear_key();
++
++ // <styleUrl>
++ const std::string& get_styleurl();
++ void set_styleurl(const std::string& styleurl);
++ bool has_styleurl();
++ void clear_styleurl();
++
++ // <StyleSelector>
++ const StyleSelectorPtr get_styleselector();
++ void set_styleselector(StyleSelectorPtr styleselector);
++ bool has_styleselector();
++ void clear_styleselector();
++};
++
++%nodefaultctor ViewVolume;
++class ViewVolume : public Object {
++public:
++ // <leftFov>
++ double get_leftfov();
++ void set_leftfov(double leftfov);
++ bool has_leftfov();
++ void clear_leftfov();
++
++ // <rightFov>
++ double get_rightfov();
++ void set_rightfov(double rightfov);
++ bool has_rightfov();
++ void clear_rightfov();
++
++ // <bottomFov>
++ double get_bottomfov();
++ void set_bottomfov(double bottomfov);
++ bool has_bottomfov();
++ void clear_bottomfov();
++
++ // <topFov>
++ double get_topfov();
++ void set_topfov(double topfov);
++ bool has_topfov();
++ void clear_topfov();
++
++ // <near>
++ double get_near();
++ void set_near(double val);
++ bool has_near();
++ void clear_near();
++};
++
++%nodefaultctor Point;
++class Point : public Geometry {
++public:
++ // <extrude>
++ bool get_extrude();
++ void set_extrude(bool extrude);
++ bool has_extrude();
++ void clear_extrude();
++
++ // <altitudeMode>
++ int get_altitudemode();
++ void set_altitudemode(int altitudemode);
++ bool has_altitudemode();
++ void clear_altitudemode();
++
++ // <gx:altitudeMode>
++ int get_gx_altitudemode();
++ bool has_gx_altitudemode();
++ void set_gx_altitudemode(int gx_altitudemode);
++ void clear_gx_altitudemode();
++
++ // <coordinates>
++ const CoordinatesPtr get_coordinates();
++ void set_coordinates(CoordinatesPtr coordinates);
++ bool has_coordinates();
++ void clear_coordinates();
++};
++
++%nodefaultctor PhotoOverlay;
++class PhotoOverlay : public Overlay {
++public:
++ // <rotation>
++ double get_rotation();
++ void set_rotation(double rotation);
++ bool has_rotation();
++ void clear_rotation();
++
++ // <ViewVolume>
++ const ViewVolumePtr get_viewvolume();
++ void set_viewvolume(ViewVolumePtr viewvolume);
++ bool has_viewvolume();
++ void clear_viewvolume();
++
++ // <ImagePyramid>
++ const ImagePyramidPtr get_imagepyramid();
++ void set_imagepyramid(ImagePyramidPtr imagepyramid);
++ bool has_imagepyramid();
++ void clear_imagepyramid();
++
++ // <Point>
++ const PointPtr get_point();
++ void set_point(PointPtr point);
++ bool has_point();
++ void clear_point();
++
++ // <shape>
++ int get_shape();
++ bool has_shape();
++ void set_shape(int shape);
++ void clear_shape();
++};
++
++%nodefaultctor Placemark;
++class Placemark : public Feature {
++public:
++ // Geometry
++ const GeometryPtr get_geometry();
++ void set_geometry(GeometryPtr geometry);
++ bool has_geometry();
++ void clear_geometry();
++};
++
++%nodefaultctor PolyStyle;
++class PolyStyle : public ColorStyle {
++public:
++ // <fill>
++ bool get_fill();
++ void set_fill(bool fill);
++ bool has_fill();
++ void clear_fill();
++
++ // <outline>
++ bool get_outline();
++ void set_outline(bool outline);
++ bool has_outline();
++ void clear_outline();
++};
++
++%nodefaultctor OuterBoundaryIs;
++class OuterBoundaryIs : public Element {
++public:
++ // <LinearRing>
++ const LinearRingPtr get_linearring();
++ void set_linearring(LinearRingPtr linearring);
++ bool has_linearring();
++ void clear_linearring();
++};
++
++%nodefaultctor InnerBoundaryIs;
++class InnerBoundaryIs : public Element {
++public:
++ // <LinearRing>
++ const LinearRingPtr get_linearring();
++ void set_linearring(LinearRingPtr linearring);
++ bool has_linearring();
++ void clear_linearring();
++};
++
++%nodefaultctor Polygon;
++class Polygon : public Geometry {
++public:
++ // <extrude>
++ bool get_extrude();
++ void set_extrude(bool extrude);
++ bool has_extrude();
++ void clear_extrude();
++
++ // <tessellate>
++ bool get_tessellate();
++ void set_tessellate(bool tessellate);
++ bool has_tessellate();
++ void clear_tessellate();
++
++ // <altitudeMode>
++ int get_altitudemode();
++ void set_altitudemode(int altitudemode);
++ bool has_altitudemode();
++ void clear_altitudemode();
++
++ // <gx:altitudeMode>
++ int get_gx_altitudemode();
++ bool has_gx_altitudemode();
++ void set_gx_altitudemode(int gx_altitudemode);
++ void clear_gx_altitudemode();
++
++ // <outerBoundaryIs>
++ const OuterBoundaryIsPtr get_outerboundaryis();
++ void set_outerboundaryis(OuterBoundaryIsPtr outerboundaryis);
++ bool has_outerboundaryis();
++ void clear_outerboundaryis();
++
++ // <innerBoundaryIs>...
++ void add_innerboundaryis(InnerBoundaryIsPtr innerboundaryis);
++ const size_t get_innerboundaryis_array_size();
++ const InnerBoundaryIsPtr get_innerboundaryis_array_at(unsigned int index);
++};
++
++%nodefaultctor SimpleData;
++class SimpleData : public Element {
++public:
++ // name=
++ const std::string& get_name();
++ bool has_name();
++ void set_name(const std::string& value);
++ void clear_name();
++
++ // char data
++ const std::string& get_text();
++ bool has_text();
++ void set_text(const std::string& value);
++ void clear_text();
++};
++
++%nodefaultctor SchemaData;
++class SchemaData : public Object {
++public:
++ // schemaUrl=
++ const std::string& get_schemaurl();
++ bool has_schemaurl();
++ void set_schemaurl(const std::string& value);
++ void clear_schemaurl();
++ // <SimpleData>...
++ void add_simpledata(SimpleDataPtr simpledata);
++ const size_t get_simpledata_array_size();
++ const SimpleDataPtr get_simpledata_array_at(unsigned int index);
++};
++
++%nodefaultctor OverlayXY;
++class OverlayXY : public Vec2 {
++};
++
++%nodefaultctor ScreenXY;
++class ScreenXY : public Vec2 {
++};
++
++%nodefaultctor RotationXY;
++class RotationXY : public Vec2 {
++};
++
++%nodefaultctor Size;
++class Size : public Vec2 {
++};
++
++%nodefaultctor ScreenOverlay;
++class ScreenOverlay : public Overlay {
++public:
++ // <OverlayXY>
++ const OverlayXYPtr get_overlayxy();
++ void set_overlayxy(OverlayXYPtr overlayxy);
++ bool has_overlayxy();
++ void clear_overlayxy();
++
++ // <ScreenXY>
++ const ScreenXYPtr get_screenxy();
++ void set_screenxy(ScreenXYPtr screenxy);
++ bool has_screenxy();
++ void clear_screenxy();
++
++ // <RotationXY>
++ const RotationXYPtr get_rotationxy();
++ void set_rotationxy(RotationXYPtr rotationxy);
++ bool has_rotationxy();
++ void clear_rotationxy();
++
++ // <size>
++ const SizePtr get_size();
++ void set_size(SizePtr size);
++ bool has_size();
++ void clear_size();
++
++ // <rotation>
++ double get_rotation();
++ void set_rotation(double rotation);
++ bool has_rotation();
++ void clear_rotation();
++};
++
++%nodefaultctor Style;
++class Style : public StyleSelector {
++public:
++ // <IconStyle>
++ const IconStylePtr get_iconstyle();
++ void set_iconstyle(IconStylePtr iconstyle);
++ bool has_iconstyle();
++ void clear_iconstyle();
++
++ // <LabelStyle>
++ const LabelStylePtr get_labelstyle();
++ void set_labelstyle(LabelStylePtr labelstyle);
++ bool has_labelstyle();
++ void clear_labelstyle();
++
++ // <LineStyle>
++ const LineStylePtr get_linestyle();
++ void set_linestyle(LineStylePtr linestyle);
++ bool has_linestyle();
++ void clear_linestyle();
++
++ // <PolyStyle>
++ const PolyStylePtr get_polystyle();
++ void set_polystyle(PolyStylePtr polystyle);
++ bool has_polystyle();
++ void clear_polystyle();
++
++ // <BalloonStyle>
++ const BalloonStylePtr get_balloonstyle();
++ void set_balloonstyle(BalloonStylePtr balloonstyle);
++ bool has_balloonstyle();
++ void clear_balloonstyle();
++
++ // <ListStyle>
++ const ListStylePtr get_liststyle();
++ void set_liststyle(ListStylePtr liststyle);
++ bool has_liststyle();
++ void clear_liststyle();
++};
++
++%nodefaultctor StyleMap;
++class StyleMap : public StyleSelector {
++public:
++ // <Pair>...
++ void add_pair(PairPtr pair);
++ const size_t get_pair_array_size();
++ const PairPtr get_pair_array_at(unsigned int index);
++};
++
++%nodefaultctor TimeSpan;
++class TimeSpan : public TimePrimitive {
++public:
++ // <begin>
++ const std::string& get_begin();
++ void set_begin(const std::string& begin);
++ bool has_begin();
++ void clear_begin();
++
++ // <end>
++ const std::string& get_end();
++ void set_end(const std::string& end);
++ bool has_end();
++ void clear_end();
++};
++
++%nodefaultctor GxTimeSpan;
++class GxTimeSpan : public TimeSpan {
++};
++
++%nodefaultctor TimeStamp;
++class TimeStamp : public TimePrimitive {
++public:
++ // <when>
++ const std::string& get_when();
++ void set_when(const std::string& when);
++ bool has_when();
++ void clear_when();
++};
++
++%nodefaultctor GxTimeStamp;
++class GxTimeStamp : public TimeStamp {
++};
++
++%nodefaultctor Kml;
++class Kml : public Element {
++public:
++ // hint=
++ const std::string& get_hint();
++ void set_hint(const std::string& hint);
++ bool has_hint();
++ void clear_hint();
++
++ // <NetworkLinkControl>
++ const NetworkLinkControlPtr get_networklinkcontrol();
++ void set_networklinkcontrol(NetworkLinkControlPtr networklinkcontrol);
++ bool has_networklinkcontrol();
++ void clear_networklinkcontrol();
++
++ // Feature
++ const FeaturePtr get_feature();
++ void set_feature(FeaturePtr feature);
++ bool has_feature();
++ void clear_feature();
++};
++
++// <atom:author>
++%nodefaultctor AtomAuthor;
++class AtomAuthor : public Element {
++public:
++ // <atom:name>
++ const std::string& get_name();
++ void set_name(const std::string& name);
++ bool has_name();
++ void clear_name();
++
++ // <atom:uri>
++ const std::string& get_uri();
++ void set_uri(const std::string& uri);
++ bool has_uri();
++ void clear_uri();
++
++ // <atom:email>
++ const std::string& get_email();
++ void set_email(const std::string& email);
++ bool has_email();
++ void clear_email();
++};
++
++// <atom:link>
++%nodefaultctor AtomLink;
++class AtomLink : public Element {
++public:
++ // href=, RFC 4287 4.2.7.1, RFC 3987
++ const std::string& get_href();
++ bool has_href();
++ void set_href(const std::string& value);
++ void clear_href();
++
++ // rel=, RFC 4287 4.2.7.2, RFC 3987
++ const std::string& get_rel();
++ bool has_rel();
++ void set_rel(const std::string& value);
++ void clear_rel();
++
++ // type=, RFC 4287 4.2.7.3, MIME
++ const std::string& get_type();
++ bool has_type();
++ void set_type(const std::string& value);
++ void clear_type();
++
++ // hreflang=, RFC 4287 4.2.7.4, RFC 3066
++ const std::string& get_hreflang();
++ bool has_hreflang();
++ void set_hreflang(const std::string& value);
++ void clear_hreflang();
++
++ // title=, RFC 4287 4.2.7.5
++ const std::string& get_title();
++ bool has_title();
++ void set_title(const std::string& value);
++ void clear_title();
++
++ // length=, RFC 4287 4.2.7.6
++ const int get_length();
++ bool has_length();
++ void set_length(int value);
++ void clear_length();
++};
++
++// GxTourPrimitive is an abstract base type. This corresponds to
++// gx:AbstractGxTourPrimitiveType/Group in KML 2.2 gx.
++%nodefaultctor GxTourPrimitive;
++class GxTourPrimitive : public Object {
++};
++
++// <gx:Playlist>
++%nodefaultctor GxPlaylist;
++class GxPlaylist : public Object {
++ // GxTourPrimitive...
++ public:
++ void add_gx_tourprimitive(GxTourPrimitivePtr tourprimitive);
++ const size_t get_gx_tourprimitive_array_size();
++ const GxTourPrimitivePtr get_gx_tourprimitive_array_at(unsigned int index);
++};
++
++// <gx:Tour>
++%nodefaultctor GxTour;
++class GxTour : public Feature {
++ public:
++ // <gx:Playlist>
++ const GxPlaylistPtr get_gx_playlist();
++ bool has_gx_playlist();
++ void set_gx_playlist(GxPlaylistPtr gx_playlist);
++ void clear_gx_playlist();
++};
++
++// <gx:AnimatedUpdate>
++%nodefaultctor GxAnimatedUpdate;
++class GxAnimatedUpdate : public GxTourPrimitive {
++public:
++ // <gx:duration>
++ double get_gx_duration();
++ bool has_gx_duration();
++ void set_gx_duration(double gx_duration);
++ void clear_gx_duration();
++
++ // <Update>
++ const UpdatePtr get_update();
++ bool has_update();
++ void set_update(UpdatePtr update);
++ void clear_update();
++};
++
++// <gx:FlyTo>
++%nodefaultctor GxFlyTo;
++class GxFlyTo : public GxTourPrimitive {
++ public:
++ // <gx:duration>
++ double get_gx_duration();
++ bool has_gx_duration();
++ void set_gx_duration(double gx_duration);
++ void clear_gx_duration();
++
++ // <gx:flyToMode>.
++ int get_gx_flytomode();
++ bool has_gx_flytomode();
++ void set_gx_flytomode(int value);
++ void clear_gx_flytomode();
++
++ // AbstractView
++ const AbstractViewPtr get_abstractview();
++ bool has_abstractview();
++ void set_abstractview(AbstractViewPtr abstractview);
++ void clear_abstractview();
++};
++
++// <gx:Wait>
++%nodefaultctor GxWait;
++class GxWait : public GxTourPrimitive {
++public:
++ // <gx:duration>
++ double get_gx_duration();
++ bool has_gx_duration();
++ void set_gx_duration(double gx_duration);
++ void clear_gx_duration();
++};
++
++// <gx:SoundCue>
++%nodefaultctor GxSoundCue;
++class GxSoundCue : public GxTourPrimitive {
++public:
++ // <href>
++ const std::string& get_href();
++ bool has_href();
++ void set_href(const std::string& href);
++ void clear_href();
++};
++
++// <gx:TourControl>
++%nodefaultctor GxTourControl;
++class GxTourControl : public GxTourPrimitive {
++public:
++ // <gx:playMode>
++ int get_gx_playmode();
++ bool has_gx_playmode();
++ void set_gx_playmode(int value);
++ void clear_gx_playmode();
++};
++
+--- a/.travis.yml
++++ b/.travis.yml
+@@ -6,5 +6,7 @@ compiler:
+ before_script:
+ - mkdir build
+ - cd build
++ - sudo apt-get update -qq
++ - sudo apt-get install swig python-dev
+
+ script: cmake -DCMAKE_INSTALL_PREFIX=../../install .. && make
+--- a/cmake/FindMiniZip.cmake
++++ b/cmake/FindMiniZip.cmake
+@@ -7,32 +7,26 @@
+
+
+ if (MINIZIP_INCLUDE_DIR)
+- #check cache
++ #check cache
+ set(MINIZIP_FIND_QUIETLY TRUE)
+ endif ()
+
+
+ if (NOT MINIZIP_INCLUDE_DIR)
+ find_path(MINIZIP_INCLUDE_DIR NAMES unzip.h zip.h PATH_SUFFIXES minizip)
+- set(MINIZIP_INCLUDE_DIR ${MINIZIP_INCLUDE_DIR}/minizip CACHE PATH "MiniZip includes")
+ endif ()
+
+ find_library(MINIZIP_LIBRARY NAMES minizip)
+
+-if (MINIZIP_INCLUDE_DIR AND MINIZIP_LIBRARY)
+- set(MINIZIP_FOUND TRUE)
+-endif ()
+-
+-if (MINIZIP_FOUND)
+- if (NOT MINIZIP_FIND_QUIETLY)
+- message(STATUS "Found MiniZip: ${MINIZIP_LIBRARY}")
+- endif ()
+-else ()
+- if (MINIZIP_FIND_REQUIRED)
+- message(FATAL_ERROR "Could NOT find MiniZip")
+- else ()
+- message(STATUS "Could NOT find MiniZip")
+- endif ()
+-endif ()
++include( FindPackageHandleStandardArgs )
++find_package_handle_standard_args( MINIZIP DEFAULT_MSG MINIZIP_LIBRARY MINIZIP_INCLUDE_DIR )
+
++mark_as_advanced( MINIZIP_INCLUDE_DIR MINIZIP_LIBRARY )
+
++if(MINIZIP_FOUND)
++ set(MINIZIP_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIR})
++ set(MINIZIP_LIBRARIES ${MINIZIP_LIBRARY})
++else()
++ set(MINIZIP_INCLUDE_DIRS)
++ set(MINIZIP_LIBRARIES)
++endif()
+--- a/cmake/FindUriParser.cmake
++++ b/cmake/FindUriParser.cmake
+@@ -6,32 +6,26 @@
+ # URIPARSER_FOUND - TRUE if UriParser is found
+
+ if (URIPARSER_INCLUDE_DIR)
+- #check cache
++ #check cache
+ set(URIPARSER_FIND_QUIETLY TRUE)
+ endif ()
+
+
+ if (NOT URIPARSER_INCLUDE_DIR)
+- find_path(URIPARSER_INCLUDE_DIR NAMES Uri.h UriBase.h PATH_SUFFIXES uriparser)
+- set(URIPARSER_INCLUDE_DIR ${URIPARSER_INCLUDE_DIR}/uriparser CACHE PATH "UriParser includes")
++ find_path(URIPARSER_INCLUDE_DIR NAMES uriparser/Uri.h uriparser/UriBase.h )
+ endif ()
+
+ find_library(URIPARSER_LIBRARY NAMES uriparser)
+
+-if (URIPARSER_INCLUDE_DIR AND URIPARSER_LIBRARY)
+- set(URIPARSER_FOUND TRUE)
+-endif ()
+-
+-if (URIPARSER_FOUND)
+- if (NOT URIPARSER_FIND_QUIETLY)
+- message(STATUS "Found UriParser: ${URIPARSER_LIBRARY}")
+- endif ()
+-else ()
+- if (URIPARSER_FIND_REQUIRED)
+- message(FATAL_ERROR "Could not find UriParser library")
+- else ()
+- message(STATUS "Could not find UriParser library")
+- endif ()
+-endif ()
++include( FindPackageHandleStandardArgs )
++FIND_PACKAGE_HANDLE_STANDARD_ARGS( URIPARSER DEFAULT_MSG URIPARSER_LIBRARY URIPARSER_INCLUDE_DIR )
+
++mark_as_advanced( URIPARSER_INCLUDE_DIR URIPARSER_LIBRARY )
+
++if(URIPARSER_FOUND)
++ set(URIPARSER_INCLUDE_DIRS ${URIPARSER_INCLUDE_DIR})
++ set(URIPARSER_LIBRARIES ${URIPARSER_LIBRARY})
++else()
++ set(URIPARSER_INCLUDE_DIRS)
++ set(URIPARSER_LIBRARIES)
++endif()
+--- a/cmake/ImportBoost.cmake
++++ /dev/null
+@@ -1,7 +0,0 @@
+-find_package(Boost)
+-mark_as_advanced(Boost_DIR)
+-if(Boost_FOUND)
+- set(HAVE_SYSTEM_BOOST TRUE)
+-else()
+- set(HAVE_SYSTEM_BOOST FALSE)
+-endif()
+\ No newline at end of file
+--- a/cmake/ImportEXPAT.cmake
++++ /dev/null
+@@ -1,9 +0,0 @@
+-find_package(EXPAT)
+-mark_as_advanced(EXPAT_INCLUDE_DIR)
+-mark_as_advanced(EXPAT_LIBRARY)
+-if(EXPAT_FOUND)
+- set(HAVE_SYSTEM_EXPAT TRUE)
+- set(EXPAT_LIBRARY ${EXPAT_LIBRARIES})
+-else()
+- set(HAVE_SYSTEM_EXPAT FALSE)
+-endif()
+\ No newline at end of file
+--- a/cmake/ImportGoogleTest.cmake
++++ /dev/null
+@@ -1,8 +0,0 @@
+-find_package(GoogleTest REQUIRED)
+-mark_as_advanced(GTEST_INCLUDE_DIR)
+-mark_as_advanced(GTEST_LIBRARY)
+-if(GTEST_FOUND)
+- set(HAVE_SYSTEM_GTEST TRUE)
+-else()
+- set(HAVE_SYSTEM_GTEST FALSE)
+-endif()
+\ No newline at end of file
+--- a/cmake/ImportMinizip.cmake
++++ /dev/null
+@@ -1,8 +0,0 @@
+-find_package(MiniZip)
+-mark_as_advanced(MINIZIP_INCLUDE_DIR)
+-mark_as_advanced(MINIZIP_LIBRARY)
+-if(MINIZIP_FOUND)
+- set(HAVE_SYSTEM_MINIZIP TRUE)
+-else()
+- set(HAVE_SYSTEM_MINIZIP FALSE)
+-endif()
+\ No newline at end of file
+--- a/cmake/ImportUriParser.cmake
++++ /dev/null
+@@ -1,8 +0,0 @@
+-find_package(UriParser)
+-mark_as_advanced(URIPARSER_INCLUDE_DIR)
+-mark_as_advanced(URIPARSER_LIBRARY)
+-if(URIPARSER_FOUND)
+- set(HAVE_SYSTEM_URIPARSER TRUE)
+-else()
+- set(HAVE_SYSTEM_URIPARSER FALSE)
+-endif()
+\ No newline at end of file
+--- a/cmake/ImportZLIB.cmake
++++ /dev/null
+@@ -1,9 +0,0 @@
+-find_package(ZLIB 1.2.8)
+-mark_as_advanced(ZLIB_INCLUDE_DIR)
+-mark_as_advanced(ZLIB_LIBRARY)
+-if(ZLIB_FOUND)
+- set(HAVE_SYSTEM_ZLIB TRUE)
+- set(ZLIB_LIBRARY ${ZLIB_LIBRARIES})
+-else()
+- set(HAVE_SYSTEM_ZLIB FALSE)
+-endif()
+\ No newline at end of file
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -1,4 +1,4 @@
+ add_subdirectory(kml)
+-if(BUILD_SWIG)
++if(WITH_SWIG)
+ add_subdirectory(swig)
+ endif()
+\ No newline at end of file
+--- /dev/null
++++ b/tests/swig/CMakeLists.txt
+@@ -0,0 +1,19 @@
++if(WITH_PYTHON)
++add_test(NAME test_python_kmlbase
++ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kmlbase_test.py)
++
++add_test(NAME test_python_kmldom
++ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kmldom_test.py)
++
++add_test(NAME test_python_kmlengine
++ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kmlengine_test.py)
++endif()
++
++if(WITH_JAVA)
++add_test( NAME test_java_kmlbase
++ COMMAND
++ ${Java_JAVA_EXECUTABLE}
++ -cp "${CMAKE_JAVA_INCLUDE_PATH}${PATH_SEPARATOR}${CMAKE_BINARY_DIR}/src/swig/LibKML.jar;${CMAKE_CURRENT_BINARY_DIR}"
++ KmlBaseTest )
++
++endif()
+\ No newline at end of file
+--- /dev/null
++++ b/tests/swig/KmlBaseTest.java
+@@ -0,0 +1,92 @@
++// Copyright 2009, Google Inc. All rights reserved.
++//
++// Redistribution and use in source and binary forms, with or without
++// modification, are permitted provided that the following conditions are met:
++//
++// 1. Redistributions of source code must retain the above copyright notice,
++// this list of conditions and the following disclaimer.
++// 2. Redistributions in binary form must reproduce the above copyright notice,
++// this list of conditions and the following disclaimer in the documentation
++// and/or other materials provided with the distribution.
++// 3. Neither the name of Google Inc. nor the names of its contributors may be
++// used to endorse or promote products derived from this software without
++// specific prior written permission.
++//
++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
++// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
++// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
++// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
++// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
++// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
++// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
++// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
++// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++
++// This is a small subset of the python tests to ensure sanity of the basic
++// Java bindings.
++
++import org.junit.*;
++import static org.junit.Assert.*;
++
++import com.googlecode.libkml.*;
++
++public class KmlBaseTest {
++
++ static {
++ try {
++ System.loadLibrary("kmlbase_swig_java");
++ } catch (UnsatisfiedLinkError e) {
++ System.err.println("Failed to load kmlbase. " + e);
++ System.err.println("Make sure you have your classpath set correctly " +
++ "and that LD_LIBRARY_PATH can see " +
++ "libkmldom_swig_java and friends");
++ System.exit(1);
++ }
++ }
++
++ @Test public void testBasicAttributes() {
++ Attributes attributes = new Attributes();
++ assertEquals(0, attributes.GetSize());
++ }
++
++ @Test public void testBasicColor32() {
++ Color32 color = new Color32();
++ long expected = 0xffffffffL;
++ assertEquals(expected, color.get_color_abgr());
++
++ long red = 0xff0000ffL;
++ color = new Color32(red);
++ assertEquals(red, color.get_color_abgr());
++
++ String red_str = "ff0000ff";
++ color = new Color32(red_str);
++ assertEquals(red, color.get_color_abgr());
++ }
++
++ @Test public void testBasicDateTime() {
++ String when = "2008-10-03T09:25:42Z";
++ DateTime datetime = DateTime.Create(when);
++ assertEquals(1223025942, datetime.GetTimeT());
++ assertEquals("09:25:42", datetime.GetXsdTime());
++ assertEquals("2008-10-03", datetime.GetXsdDate());
++ assertEquals(when, datetime.GetXsdDateTime());
++ }
++
++ @Test public void testBasicVec3() {
++ double latitude = 38.12345;
++ double longitude = -121.123123;
++ double altitude = 9876.5432;
++ Vec3 vec3 = new Vec3(longitude, latitude, altitude);
++ assertEquals(latitude, vec3.get_latitude(), 0.000001);
++ assertEquals(longitude, vec3.get_longitude(), 0.000001);
++ assertTrue(vec3.has_altitude());
++ assertEquals(altitude, vec3.get_altitude(), 0.000001);
++ vec3 = new Vec3(longitude, latitude);
++ assertEquals(latitude, vec3.get_latitude(), 0.000001);
++ assertEquals(longitude, vec3.get_longitude(), 0.000001);
++ assertFalse(vec3.has_altitude());
++ }
++
++}
++
+--- /dev/null
++++ b/tests/swig/kmlbase_test.py
+@@ -0,0 +1,161 @@
++#!/usr/bin/env python
++
++# Copyright 2008, Google Inc. All rights reserved.
++#
++# Redistribution and use in source and binary forms, with or without
++# modification, are permitted provided that the following conditions are met:
++#
++# 1. Redistributions of source code must retain the above copyright notice,
++# this list of conditions and the following disclaimer.
++# 2. Redistributions in binary form must reproduce the above copyright notice,
++# this list of conditions and the following disclaimer in the documentation
++# and/or other materials provided with the distribution.
++# 3. Neither the name of Google Inc. nor the names of its contributors may be
++# used to endorse or promote products derived from this software without
++# specific prior written permission.
++#
++# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
++# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
++# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
++# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
++# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
++# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
++# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
++# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
++# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++
++"""
++This file contains unit tests for the KML Base Python SWIG bindings.
++"""
++
++import unittest
++import kmlbase
++
++# These VerySimple tests really only verify that the function/class exists.
++# Based on kml/base/color32_test.cc.
++
++class BasicAttributesTestCase(unittest.TestCase):
++ def runTest(self):
++ attributes = kmlbase.Attributes()
++ assert 0 == attributes.GetSize()
++ found,value = attributes.FindValue("key")
++ assert not found
++ found,key = attributes.FindKey("value")
++ assert not found
++
++class BasicColor32TestCase(unittest.TestCase):
++ """Verify very simple Color32 usage """
++ def runTest(self):
++ # Default construction.
++ color = kmlbase.Color32()
++ assert 0xffffffff == color.get_color_abgr()
++
++ # Construction from specific color.
++ red = 0xff0000ff
++ color = kmlbase.Color32(red)
++ assert red == color.get_color_abgr()
++
++ # Construction from RGBA chars.
++ A = 0xff
++ B = 0x00
++ G = 0x00
++ R = 0xff
++ color = kmlbase.Color32(A, B, G, R)
++ assert red == color.get_color_abgr()
++
++ # Construction from string.
++ red_str = "ff0000ff"
++ color = kmlbase.Color32(red_str)
++ assert red == color.get_color_abgr()
++
++ # Bad construction.
++ nonsense = "This isn't even close to a color value"
++ color = kmlbase.Color32(nonsense)
++ assert "00000000" == color.to_string_abgr()
++
++ # Getters in default state.
++ color = kmlbase.Color32()
++ kFF = 0xff
++
++ assert kFF == color.get_alpha()
++ assert kFF == color.get_blue()
++ assert kFF == color.get_green()
++ assert kFF == color.get_red()
++
++ # Verify getters of newly set state.
++ kAB = 0xab
++ color.set_alpha(kAB)
++ color.set_blue(kAB)
++ color.set_green(kAB)
++ color.set_red(kAB)
++ assert kAB == color.get_alpha()
++ assert kAB == color.get_blue()
++ assert kAB == color.get_green()
++ assert kAB == color.get_red()
++
++ # Verify get_color_abgr and get_color_rgba.
++ kOpaqueGreen = 0xff00ff00
++ color = kmlbase.Color32(kOpaqueGreen)
++ assert kOpaqueGreen == color.get_color_abgr()
++ kOpaqueGreenARGB = 0xff00ff00
++ assert kOpaqueGreenARGB == color.get_color_argb()
++
++ # Verify reconstruction to AABBGGRR string.
++ kOpaqueRedStr = "ff0000ff"
++ color = kmlbase.Color32(kOpaqueRedStr);
++ assert kOpaqueRedStr == color.to_string_abgr()
++
++ # Verify to_argb_string.
++ assert kOpaqueRedStr == color.to_string_abgr()
++ kOpaqueRedStr_argb = "ffff0000"
++ assert kOpaqueRedStr_argb == color.to_string_argb()
++
++ # Equality operator.
++ red = kmlbase.Color32(kOpaqueRedStr)
++ green = kmlbase.Color32(kOpaqueGreen)
++ assert red == red
++ assert green != red
++
++class BasicDateTimeTestCase(unittest.TestCase):
++ def runTest(self):
++ kWhen = "2008-10-03T09:25:42Z"
++ datetime = kmlbase.DateTime_Create(kWhen)
++ assert datetime
++ assert 1223025942 == datetime.GetTimeT()
++ assert "09:25:42" == datetime.GetXsdTime()
++ assert "2008-10-03" == datetime.GetXsdDate()
++ assert kWhen == datetime.GetXsdDateTime()
++
++class BasicVec3TestCase(unittest.TestCase):
++ def runTest(self):
++ kLatitude = 38.12345
++ kLongitude = -121.123123
++ kAltitude = 9876.5432
++ vec3 = kmlbase.Vec3(kLongitude, kLatitude, kAltitude)
++ assert vec3
++ assert kLatitude == vec3.get_latitude()
++ assert kLongitude == vec3.get_longitude()
++ assert vec3.has_altitude()
++ assert kAltitude == vec3.get_altitude()
++ vec3 = kmlbase.Vec3(kLongitude, kLatitude)
++ assert vec3
++ assert kLatitude == vec3.get_latitude()
++ assert kLongitude == vec3.get_longitude()
++ assert not vec3.has_altitude()
++
++class BasicVersionTestCase(unittest.TestCase):
++ def runTest(self):
++ assert "1.3.0" == kmlbase.Version_GetString()
++
++def suite():
++ suite = unittest.TestSuite()
++ suite.addTest(BasicAttributesTestCase())
++ suite.addTest(BasicColor32TestCase())
++ suite.addTest(BasicDateTimeTestCase())
++ suite.addTest(BasicVec3TestCase())
++ suite.addTest(BasicVersionTestCase())
++ return suite
++
++runner = unittest.TextTestRunner()
++runner.run(suite())
+--- /dev/null
++++ b/tests/swig/kmldom_test.py
+@@ -0,0 +1,1655 @@
++#!/usr/bin/env python
++
++# Copyright 2008, Google Inc. All rights reserved.
++#
++# Redistribution and use in source and binary forms, with or without
++# modification, are permitted provided that the following conditions are met:
++#
++# 1. Redistributions of source code must retain the above copyright notice,
++# this list of conditions and the following disclaimer.
++# 2. Redistributions in binary form must reproduce the above copyright notice,
++# this list of conditions and the following disclaimer in the documentation
++# and/or other materials provided with the distribution.
++# 3. Neither the name of Google Inc. nor the names of its contributors may be
++# used to endorse or promote products derived from this software without
++# specific prior written permission.
++#
++# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
++# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
++# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
++# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
++# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
++# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
++# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
++# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
++# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++
++"""
++This file contains unit tests for the KML DOM Python SWIG bindings.
++"""
++
++import unittest
++import kmlbase
++import kmldom
++
++
++class VerySimpleParseTestCase(unittest.TestCase):
++ """ This simply verifies the existence of the binding to ParseKml() """
++
++ def runTest(self):
++ assert kmldom.ParseKml('<kml/>')
++
++
++class VerySimpleSerializeTestCase(unittest.TestCase):
++ """ This verifies the existence of the binding to SerializeRaw() """
++
++ def runTest(self):
++ kml = '<kml/>'
++ assert kml == kmldom.SerializeRaw(kmldom.ParseKml(kml))
++
++
++class SimpleFactoryTestCase(unittest.TestCase):
++ """
++ This verifies the existence of the binding to KmlFactory::GetFactory
++ and the exitence of bindings for all factory methods.
++ """
++
++ def runTest(self):
++ factory = kmldom.KmlFactory_GetFactory()
++ assert factory.CreateElementById(kmldom.Type_Placemark)
++ assert factory.CreateAlias()
++ assert factory.CreateAtomAuthor()
++ assert factory.CreateAtomLink()
++ assert factory.CreateBalloonStyle()
++ assert factory.CreateCamera()
++ assert factory.CreateChange()
++ assert factory.CreateCreate()
++ assert factory.CreateData()
++ assert factory.CreateDelete()
++ assert factory.CreateDocument()
++ assert factory.CreateExtendedData()
++ assert factory.CreateFolder()
++ assert factory.CreateGroundOverlay()
++ assert factory.CreateIcon()
++ assert factory.CreateIconStyle()
++ assert factory.CreateImagePyramid()
++ assert factory.CreateItemIcon()
++ assert factory.CreateLabelStyle()
++ assert factory.CreateLatLonAltBox()
++ assert factory.CreateLatLonBox()
++ assert factory.CreateLineString()
++ assert factory.CreateLineStyle()
++ assert factory.CreateLinearRing()
++ assert factory.CreateLink()
++ assert factory.CreateListStyle()
++ assert factory.CreateLocation()
++ assert factory.CreateLod()
++ assert factory.CreateLookAt()
++ assert factory.CreateModel()
++ assert factory.CreateMultiGeometry()
++ assert factory.CreateNetworkLink()
++ assert factory.CreateNetworkLinkControl()
++ assert factory.CreateOrientation()
++ assert factory.CreatePair()
++ assert factory.CreatePhotoOverlay()
++ assert factory.CreatePlacemark()
++ assert factory.CreatePoint()
++ assert factory.CreatePolyStyle()
++ assert factory.CreatePolygon()
++ assert factory.CreateRegion()
++ assert factory.CreateResourceMap()
++ assert factory.CreateScale()
++ assert factory.CreateSchema()
++ assert factory.CreateSchemaData()
++ assert factory.CreateScreenOverlay()
++ assert factory.CreateSimpleData()
++ assert factory.CreateSimpleField()
++ assert factory.CreateSnippet()
++ assert factory.CreateStyle()
++ assert factory.CreateStyleMap()
++ assert factory.CreateTimeSpan()
++ assert factory.CreateTimeStamp()
++ assert factory.CreateUpdate()
++ assert factory.CreateViewVolume()
++ assert factory.CreateHotSpot()
++ assert factory.CreateInnerBoundaryIs()
++ assert factory.CreateKml()
++ assert factory.CreateLinkSnippet()
++ assert factory.CreateOuterBoundaryIs()
++ assert factory.CreateOverlayXY()
++ assert factory.CreateRotationXY()
++ assert factory.CreateScreenXY()
++ assert factory.CreateSize()
++ assert factory.CreateGxAnimatedUpdate()
++ assert factory.CreateGxFlyTo()
++ assert factory.CreateGxLatLonQuad()
++ assert factory.CreateGxPlaylist()
++ assert factory.CreateGxSoundCue()
++ assert factory.CreateGxTimeSpan()
++ assert factory.CreateGxTimeStamp()
++ assert factory.CreateGxTour()
++ assert factory.CreateGxTourControl()
++ assert factory.CreateGxWait()
++
++class FactoryCreateElementByIdTestCase(unittest.TestCase):
++ def runTest(self):
++ factory = kmldom.KmlFactory_GetFactory()
++ assert factory.CreateElementById(kmldom.Type_Alias)
++ assert factory.CreateElementById(kmldom.Type_AtomAuthor)
++ assert factory.CreateElementById(kmldom.Type_AtomLink)
++ assert factory.CreateElementById(kmldom.Type_BalloonStyle)
++ assert factory.CreateElementById(kmldom.Type_Camera)
++ assert factory.CreateElementById(kmldom.Type_Change)
++ assert factory.CreateElementById(kmldom.Type_coordinates)
++ assert factory.CreateElementById(kmldom.Type_Create)
++ assert factory.CreateElementById(kmldom.Type_Data)
++ assert factory.CreateElementById(kmldom.Type_Delete)
++ assert factory.CreateElementById(kmldom.Type_Document)
++ assert factory.CreateElementById(kmldom.Type_ExtendedData)
++ assert factory.CreateElementById(kmldom.Type_Folder)
++ assert factory.CreateElementById(kmldom.Type_GroundOverlay)
++ assert factory.CreateElementById(kmldom.Type_Icon)
++ assert factory.CreateElementById(kmldom.Type_IconStyle)
++ assert factory.CreateElementById(kmldom.Type_ImagePyramid)
++ assert factory.CreateElementById(kmldom.Type_ItemIcon)
++ assert factory.CreateElementById(kmldom.Type_LabelStyle)
++ assert factory.CreateElementById(kmldom.Type_LatLonAltBox)
++ assert factory.CreateElementById(kmldom.Type_LatLonBox)
++ assert factory.CreateElementById(kmldom.Type_LineString)
++ assert factory.CreateElementById(kmldom.Type_LineStyle)
++ assert factory.CreateElementById(kmldom.Type_LinearRing)
++ assert factory.CreateElementById(kmldom.Type_Link)
++ assert factory.CreateElementById(kmldom.Type_ListStyle)
++ assert factory.CreateElementById(kmldom.Type_Location)
++ assert factory.CreateElementById(kmldom.Type_Lod)
++ assert factory.CreateElementById(kmldom.Type_LookAt)
++ assert factory.CreateElementById(kmldom.Type_Model)
++ assert factory.CreateElementById(kmldom.Type_MultiGeometry)
++ assert factory.CreateElementById(kmldom.Type_NetworkLink)
++ assert factory.CreateElementById(kmldom.Type_NetworkLinkControl)
++ assert factory.CreateElementById(kmldom.Type_Orientation)
++ assert factory.CreateElementById(kmldom.Type_Pair)
++ assert factory.CreateElementById(kmldom.Type_PhotoOverlay)
++ assert factory.CreateElementById(kmldom.Type_Placemark)
++ assert factory.CreateElementById(kmldom.Type_Point)
++ assert factory.CreateElementById(kmldom.Type_PolyStyle)
++ assert factory.CreateElementById(kmldom.Type_Polygon)
++ assert factory.CreateElementById(kmldom.Type_Region)
++ assert factory.CreateElementById(kmldom.Type_ResourceMap)
++ assert factory.CreateElementById(kmldom.Type_Scale)
++ assert factory.CreateElementById(kmldom.Type_Schema)
++ assert factory.CreateElementById(kmldom.Type_SchemaData)
++ assert factory.CreateElementById(kmldom.Type_ScreenOverlay)
++ assert factory.CreateElementById(kmldom.Type_SimpleData)
++ assert factory.CreateElementById(kmldom.Type_SimpleField)
++ assert factory.CreateElementById(kmldom.Type_Snippet)
++ assert factory.CreateElementById(kmldom.Type_Style)
++ assert factory.CreateElementById(kmldom.Type_StyleMap)
++ assert factory.CreateElementById(kmldom.Type_TimeSpan)
++ assert factory.CreateElementById(kmldom.Type_TimeStamp)
++ assert factory.CreateElementById(kmldom.Type_Update)
++ assert factory.CreateElementById(kmldom.Type_ViewVolume)
++ assert factory.CreateElementById(kmldom.Type_hotSpot)
++ assert factory.CreateElementById(kmldom.Type_innerBoundaryIs)
++ assert factory.CreateElementById(kmldom.Type_kml)
++ assert factory.CreateElementById(kmldom.Type_linkSnippet)
++ assert factory.CreateElementById(kmldom.Type_outerBoundaryIs)
++ assert factory.CreateElementById(kmldom.Type_overlayXY)
++ assert factory.CreateElementById(kmldom.Type_rotationXY)
++ assert factory.CreateElementById(kmldom.Type_screenXY)
++ assert factory.CreateElementById(kmldom.Type_size)
++ assert factory.CreateElementById(kmldom.Type_GxAnimatedUpdate)
++ assert factory.CreateElementById(kmldom.Type_GxFlyTo)
++ assert factory.CreateElementById(kmldom.Type_GxLatLonQuad)
++ assert factory.CreateElementById(kmldom.Type_GxPlaylist)
++ assert factory.CreateElementById(kmldom.Type_GxSoundCue)
++ assert factory.CreateElementById(kmldom.Type_GxTimeSpan)
++ assert factory.CreateElementById(kmldom.Type_GxTimeStamp)
++ assert factory.CreateElementById(kmldom.Type_GxTour)
++ assert factory.CreateElementById(kmldom.Type_GxTourControl)
++ assert factory.CreateElementById(kmldom.Type_GxWait)
++
++class VerySimpleCastTestCase(unittest.TestCase):
++ """ This verifies the existence of the bindings to a few of the casts """
++
++ def runTest(self):
++ """ kmldom.ParseKml() returns an ElementPtr """
++ assert kmldom.AsCoordinates(kmldom.ParseKml('<coordinates/>'))
++ assert not kmldom.AsCoordinates(kmldom.ParseKml('<Document/>'))
++ assert kmldom.AsFolder(kmldom.ParseKml('<Folder/>'))
++ assert not kmldom.AsFolder(kmldom.ParseKml('<Document/>'))
++ assert kmldom.AsKml(kmldom.ParseKml('<kml/>'))
++ assert not kmldom.AsKml(kmldom.ParseKml('<Placemark/>'))
++ assert kmldom.AsPlacemark(kmldom.ParseKml('<Placemark/>'))
++ assert not kmldom.AsPlacemark(kmldom.ParseKml('<NetworkLink/>'))
++ assert kmldom.AsPoint(kmldom.ParseKml('<Point/>'))
++ assert not kmldom.AsPoint(kmldom.ParseKml('<LineString/>'))
++ assert kmldom.AsGxAnimatedUpdate(kmldom.ParseKml('<gx:AnimatedUpdate/>'))
++ assert kmldom.AsGxFlyTo(kmldom.ParseKml('<gx:FlyTo/>'))
++ assert kmldom.AsGxLatLonQuad(kmldom.ParseKml('<gx:LatLonQuad/>'))
++ assert kmldom.AsGxPlaylist(kmldom.ParseKml('<gx:Playlist/>'))
++ assert kmldom.AsGxSoundCue(kmldom.ParseKml('<gx:SoundCue/>'))
++ assert kmldom.AsGxTimeSpan(kmldom.ParseKml('<gx:TimeSpan/>'))
++ assert kmldom.AsGxTimeStamp(kmldom.ParseKml('<gx:TimeStamp/>'))
++ assert kmldom.AsGxTour(kmldom.ParseKml('<gx:Tour/>'))
++ assert kmldom.AsGxTourControl(kmldom.ParseKml('<gx:TourControl/>'))
++ assert kmldom.AsGxWait(kmldom.ParseKml('<gx:Wait/>'))
++
++
++class VerySimpleSimpleChildTestCase(unittest.TestCase):
++ """
++ This tests that an element derived from Feature can properly set/get/clear
++ the simple value <name> element.
++ """
++
++ def runTest(self):
++ factory = kmldom.KmlFactory_GetFactory()
++ folder = factory.CreateFolder()
++ assert not folder.has_name()
++ name = 'my name'
++ folder.set_name(name)
++ assert folder.has_name()
++ assert name == folder.get_name()
++ folder.clear_name()
++ assert not folder.has_name()
++
++
++class VerySimpleComplexChildTestCase(unittest.TestCase):
++ """
++ This tests that a complex child of a specific type can be set and
++ cleared as a child of another element.
++ """
++
++ def runTest(self):
++ factory = kmldom.KmlFactory_GetFactory()
++ region = factory.CreateRegion()
++ assert not region.has_lod()
++ assert not region.has_latlonaltbox()
++ region.set_lod(factory.CreateLod())
++ region.set_latlonaltbox(factory.CreateLatLonAltBox())
++ assert region.has_lod()
++ assert region.has_latlonaltbox()
++ region.clear_lod()
++ region.clear_latlonaltbox()
++ assert not region.has_lod()
++ assert not region.has_latlonaltbox()
++
++
++class SimpleAtomAuthorTestCase(unittest.TestCase):
++ """ This tests the AtomAuthor element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.atomauthor = self.factory.CreateAtomAuthor()
++
++ def testDefault(self):
++ assert kmldom.Type_AtomAuthor == self.atomauthor.Type()
++ assert self.atomauthor.IsA(kmldom.Type_AtomAuthor)
++ # default state
++ assert not self.atomauthor.has_name()
++ assert "" == self.atomauthor.get_name()
++ assert not self.atomauthor.has_uri()
++ assert "" == self.atomauthor.get_uri()
++ assert not self.atomauthor.has_email()
++ assert "" == self.atomauthor.get_email()
++
++ def testSetClear(self):
++ # name
++ name = 'Scott Turow'
++ self.atomauthor.set_name(name)
++ assert self.atomauthor.has_name()
++ assert name == self.atomauthor.get_name()
++ self.atomauthor.clear_name()
++
++ # uri
++ uri = 'http://www.authorsguild.org/'
++ self.atomauthor.set_uri(uri)
++ assert self.atomauthor.has_uri()
++ assert uri == self.atomauthor.get_uri()
++ self.atomauthor.clear_uri()
++
++ # email
++ email = 'jsmith at example.com'
++ self.atomauthor.set_email(email)
++ assert self.atomauthor.has_email()
++ assert email == self.atomauthor.get_email()
++ self.atomauthor.clear_email()
++
++ self.testDefault()
++
++
++class SimpleAtomLinkTestCase(unittest.TestCase):
++ """ This tests the AtomLink element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.atomlink = self.factory.CreateAtomLink()
++
++ def testDefault(self):
++ assert kmldom.Type_AtomLink == self.atomlink.Type()
++ assert self.atomlink.IsA(kmldom.Type_AtomLink)
++ assert not self.atomlink.has_href()
++ assert "" == self.atomlink.get_href()
++ assert not self.atomlink.has_rel()
++ assert "" == self.atomlink.get_rel()
++ assert not self.atomlink.has_type()
++ assert "" == self.atomlink.get_type()
++ assert not self.atomlink.has_hreflang()
++ assert "" == self.atomlink.get_hreflang()
++ assert not self.atomlink.has_title()
++ assert "" == self.atomlink.get_title()
++ assert not self.atomlink.has_length()
++ assert 0 == self.atomlink.get_length()
++
++ def testSetClear(self):
++ # href
++ href = 'http://example.com'
++ self.atomlink.set_href(href)
++ assert self.atomlink.has_href()
++ assert href == self.atomlink.get_href()
++ self.atomlink.clear_href()
++
++ rel = 'alternate'
++ self.atomlink.set_rel(rel)
++ assert self.atomlink.has_rel()
++ assert rel == self.atomlink.get_rel()
++ self.atomlink.clear_rel()
++
++ type = 'text/html'
++ self.atomlink.set_type(type)
++ assert self.atomlink.has_type()
++ assert type == self.atomlink.get_type()
++ self.atomlink.clear_type()
++
++ hreflang = 'en'
++ self.atomlink.set_hreflang(hreflang)
++ assert self.atomlink.has_hreflang()
++ assert hreflang == self.atomlink.get_hreflang()
++ self.atomlink.clear_hreflang()
++
++ title = 'dive into mark'
++ self.atomlink.set_title(title)
++ assert self.atomlink.has_title()
++ assert title == self.atomlink.get_title()
++ self.atomlink.clear_title()
++
++ length = 42
++ self.atomlink.set_length(length)
++ assert self.atomlink.has_length()
++ assert length == self.atomlink.get_length()
++ self.atomlink.clear_length()
++
++ self.testDefault()
++
++ def testParse(self):
++ # Straight out of RFC 4287
++ link_xml = '<link rel=\"alternate\" type=\"text/html\" '
++ link_xml += 'hreflang=\"en\" href=\"http://example.org/\"/>'
++ self.atomlink = kmldom.ParseKml(link_xml)
++ assert self.atomlink.has_rel()
++ assert self.atomlink.has_type()
++ assert self.atomlink.has_hreflang()
++ assert self.atomlink.has_href()
++ assert not self.atomlink.has_title()
++ assert not self.atomlink.has_length()
++
++ assert self.atomlink.clear_rel()
++ assert self.atomlink.clear_type()
++ assert self.atomlink.clear_hreflang()
++ assert self.atomlink.clear_href()
++
++ self.testDefault()
++
++class SimpleCoordinatesTestCase(unittest.TestCase):
++ """ This tests the methods on Coordinates and Vec3 """
++ def runTest(self):
++ factory = kmldom.KmlFactory_GetFactory()
++ coordinates = factory.CreateCoordinates()
++ # Test the Element methods
++ assert kmldom.Type_coordinates == coordinates.Type()
++ assert coordinates.IsA(kmldom.Type_coordinates)
++ # Test the Coordinates methods
++ lon = -123.456
++ lat = 38.765
++ alt = 1001.909
++ assert 0 == coordinates.get_coordinates_array_size()
++ coordinates.add_latlng(lat, lon)
++ assert 1 == coordinates.get_coordinates_array_size()
++ coordinates.add_latlngalt(lat, lon, alt)
++ assert 2 == coordinates.get_coordinates_array_size()
++ vec0 = coordinates.get_coordinates_array_at(0)
++ vec1 = coordinates.get_coordinates_array_at(1)
++ # Test the Vec3 methods
++ assert lon == vec0.get_longitude()
++ assert lat == vec0.get_latitude()
++ assert 0 == vec0.get_altitude()
++ assert lon == vec1.get_longitude()
++ assert lat == vec1.get_latitude()
++ assert alt == vec1.get_altitude()
++
++
++class SimpleVec2TestCase(unittest.TestCase):
++ """ This tests the methods on Vec2 (using HotSpot) """
++ def runTest(self):
++ factory = kmldom.KmlFactory_GetFactory()
++ hotspot = factory.CreateHotSpot()
++ # Test the Element methods
++ assert kmldom.Type_hotSpot == hotspot.Type()
++ assert hotspot.IsA(kmldom.Type_hotSpot)
++ # Test the Vec2 methods
++ assert not hotspot.has_x()
++ assert not hotspot.has_xunits()
++ assert not hotspot.has_y()
++ assert not hotspot.has_yunits()
++ x = 128
++ xunits = kmldom.UNITS_PIXELS
++ y = .7
++ yunits = kmldom.UNITS_FRACTION
++ # Test the setters
++ hotspot.set_x(x)
++ hotspot.set_xunits(xunits)
++ hotspot.set_y(y)
++ hotspot.set_yunits(yunits)
++ # Test the has'ers
++ assert hotspot.has_x()
++ assert hotspot.has_xunits()
++ assert hotspot.has_y()
++ assert hotspot.has_yunits()
++ # Test the getters
++ assert x == hotspot.get_x()
++ assert xunits == hotspot.get_xunits()
++ assert y == hotspot.get_y()
++ assert yunits == hotspot.get_yunits()
++ # Test the clear'ers
++ hotspot.clear_x()
++ hotspot.clear_xunits()
++ hotspot.clear_y()
++ hotspot.clear_yunits()
++ assert not hotspot.has_x()
++ assert not hotspot.has_xunits()
++ assert not hotspot.has_y()
++ assert not hotspot.has_yunits()
++
++
++class SimpleObjectTestCase(unittest.TestCase):
++ """ This tests the Object methods (using Placemark) """
++ def runTest(self):
++ factory = kmldom.KmlFactory_GetFactory()
++ placemark = factory.CreatePlacemark()
++ # Element methods
++ assert kmldom.Type_Placemark == placemark.Type()
++ assert placemark.IsA(kmldom.Type_Object)
++ assert placemark.IsA(kmldom.Type_Placemark)
++ # Object methods
++ # has_xxx()...
++ assert not placemark.has_id()
++ assert not placemark.has_targetid()
++ id = 'placemark123'
++ targetid ='placemark456'
++ # set_xxx()...
++ placemark.set_id(id)
++ placemark.set_targetid(targetid)
++ assert placemark.has_id()
++ assert placemark.has_targetid()
++ # xxx()...
++ assert id == placemark.get_id()
++ assert targetid == placemark.get_targetid()
++ # clear_xxx()...
++ placemark.clear_id()
++ placemark.clear_targetid()
++ assert not placemark.has_id()
++ assert not placemark.has_targetid()
++
++
++class SimpleFeatureTestCase(unittest.TestCase):
++ """ This tests the Feature methods (using Folder) """
++ def runTest(self):
++ factory = kmldom.KmlFactory_GetFactory()
++ folder = factory.CreateFolder()
++
++ # Element methods
++ assert kmldom.Type_Folder == folder.Type()
++ assert folder.IsA(kmldom.Type_Object)
++ assert folder.IsA(kmldom.Type_Feature)
++ assert folder.IsA(kmldom.Type_Folder)
++
++ # TODO: Object methods
++
++ # Feature methods
++ # TODO everything else
++
++ assert not folder.has_phonenumber()
++ phonenumber = '867-5309'
++ folder.set_phonenumber(phonenumber)
++ assert folder.has_phonenumber()
++ assert phonenumber == folder.get_phonenumber()
++
++ assert not folder.has_atomauthor()
++ atomauthor = factory.CreateAtomAuthor()
++ assert atomauthor
++ atom_name = 'D.F. Wallace'
++ atomauthor.set_name(atom_name)
++ folder.set_atomauthor(atomauthor)
++ got_atomauthor = folder.get_atomauthor()
++ assert atom_name == got_atomauthor.get_name()
++
++ assert not folder.has_atomlink()
++ atomlink = factory.CreateAtomLink()
++ assert atomlink
++ atom_href = 'http://infinitesummer.org'
++ atomlink.set_href(atom_href)
++ folder.set_atomlink(atomlink)
++ got_atomlink = folder.get_atomlink()
++ assert atom_href == got_atomlink.get_href()
++
++ assert not folder.has_snippet()
++ folder.set_snippet(factory.CreateSnippet())
++ assert folder.has_snippet()
++ snippet = folder.get_snippet()
++ # Test that the snippet() returns a SnippetPtr
++ assert not snippet.has_maxlines()
++ folder.clear_snippet()
++ assert not folder.has_snippet()
++
++ def testParseAtom(self):
++ kml = ('<Placemark>'
++ '<atom:author>'
++ '<atom:name>D.F. Wallace</atom:name>'
++ '</atom:author>'
++ '<atom:link href="http://infinitesummer.org"></atom:link>'
++ '</Placemark>')
++ root = kmldom.ParseKml(kml)
++ assert root
++ placemark = kmldom.AsPlacemark(root)
++ assert placemark
++ assert placemark.has_atomauthor()
++ author = kmldom.AsAtomAuthor(placemark.get_atomauthor())
++ assert author
++ assert author.has_name();
++ assert "D.F. Wallace" == author.get_name()
++ assert placemark.has_atomlink()
++ link = kmldom.AsAtomLink(placemark.get_atomlink())
++ assert link
++ assert link.has_href()
++ assert "http://infinitesummer.org" == link.get_href()
++
++
++class SimpleRegionTestCase(unittest.TestCase):
++ """ This tests the methods on Region """
++ def runTest(self):
++ factory = kmldom.KmlFactory_GetFactory()
++ region = factory.CreateRegion()
++
++ # Element methods
++ assert kmldom.Type_Region == region.Type()
++ assert region.IsA(kmldom.Type_Object)
++ assert region.IsA(kmldom.Type_Region)
++
++ # Object methods
++ # has_xxx()...
++ assert not region.has_id()
++ assert not region.has_targetid()
++ id = 'region123'
++ targetid ='region456'
++ # set_xxx()...
++ region.set_id(id)
++ region.set_targetid(targetid)
++ assert region.has_id()
++ assert region.has_targetid()
++ # xxx()...
++ assert id == region.get_id()
++ assert targetid == region.get_targetid()
++ # clear_xxx()...
++ region.clear_id()
++ region.clear_targetid()
++ assert not region.has_id()
++ assert not region.has_targetid()
++
++ # Region methods
++ assert not region.has_lod()
++ assert not region.has_latlonaltbox()
++ region.set_lod(factory.CreateLod())
++ region.set_latlonaltbox(factory.CreateLatLonAltBox())
++ assert region.has_lod()
++ assert region.has_latlonaltbox()
++ region.clear_lod()
++ region.clear_latlonaltbox()
++ assert not region.has_lod()
++ assert not region.has_latlonaltbox()
++
++
++class SimpleParseTestCase(unittest.TestCase):
++ """ This tests the Parse() function."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.root = kmldom.ParseKml('<kml>'
++ '<Placemark id=\"pm123\">'
++ '<name>hi</name>'
++ '</Placemark>'
++ '</kml>')
++
++ def tearDown(self):
++ """ KML DOM memory is managed with smart pointers no tear down is needed """
++
++ def testBasic(self):
++ assert self.root
++ kml = kmldom.AsKml(self.root)
++ assert kml
++ assert not kml.has_hint()
++ assert not kml.has_networklinkcontrol()
++ assert kml.has_feature()
++ placemark = kmldom.AsPlacemark(kml.get_feature())
++ assert placemark
++ assert placemark.has_id()
++ assert 'pm123' == placemark.get_id()
++ assert placemark.has_name()
++ assert 'hi' == placemark.get_name()
++ assert not placemark.has_geometry()
++
++
++class SimpleSerializePrettyTestCase(unittest.TestCase):
++ """ This tests the SerializePretty() function."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.kml = self.factory.CreateKml()
++ self.folder = self.factory.CreateFolder()
++ self.folder.set_name('folder')
++ self.placemark = self.factory.CreatePlacemark()
++ self.placemark.set_name('placemark')
++ self.folder.add_feature(self.placemark)
++ self.kml.set_feature(self.folder)
++ self.xml = kmldom.SerializePretty(self.kml)
++
++ def testBasic(self):
++ assert self.xml
++ assert '<kml>\n'\
++ ' <Folder>\n'\
++ ' <name>folder</name>\n'\
++ ' <Placemark>\n'\
++ ' <name>placemark</name>\n'\
++ ' </Placemark>\n'\
++ ' </Folder>\n'\
++ '</kml>\n' == self.xml
++
++
++class SimpleSerializeRawTestCase(unittest.TestCase):
++ """ This tests the SerializeRaw() function."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.kml = self.factory.CreateKml()
++ self.folder = self.factory.CreateFolder()
++ self.folder.set_name('folder')
++ self.placemark = self.factory.CreatePlacemark()
++ self.placemark.set_name('placemark')
++ self.folder.add_feature(self.placemark)
++ self.kml.set_feature(self.folder)
++ self.xml = kmldom.SerializeRaw(self.kml)
++
++ def testBasic(self):
++ assert self.xml
++ assert '<kml>'\
++ '<Folder>'\
++ '<name>folder</name>'\
++ '<Placemark>'\
++ '<name>placemark</name>'\
++ '</Placemark>'\
++ '</Folder>'\
++ '</kml>' == self.xml
++
++
++class SimpleExtendedDataTestCase(unittest.TestCase):
++ """ This tests the ExtendedData element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.extendeddata = self.factory.CreateExtendedData()
++
++ def testDefault(self):
++ assert kmldom.AsExtendedData(self.extendeddata)
++ assert 0 == self.extendeddata.get_data_array_size()
++ assert 0 == self.extendeddata.get_schemadata_array_size()
++
++class DataTestCase(unittest.TestCase):
++ """ This tests the Data element """
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.data = self.factory.CreateData()
++
++ def testDefault(self):
++ assert kmldom.AsData(self.data)
++ assert not self.data.has_name()
++ assert "" == self.data.get_name()
++ assert not self.data.has_displayname()
++ assert "" == self.data.get_displayname()
++ assert not self.data.has_value()
++ assert "" == self.data.get_value()
++
++class SimpleDataTestCase(unittest.TestCase):
++ """ This tests the SimpleData element """
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.simpledata = self.factory.CreateSimpleData()
++
++ def testDefault(self):
++ assert kmldom.AsSimpleData(self.simpledata)
++ assert not self.simpledata.has_name()
++ assert "" == self.simpledata.get_name()
++ assert not self.simpledata.has_text()
++ assert "" == self.simpledata.get_text()
++
++def TestColorStyle(colorstyle):
++ """ This tests the ColorStyle elements of the given ColorStyle-derived
++ element"""
++ # ColorStyle fields
++ # Verify default state of <color>
++ assert not colorstyle.has_color()
++ # Set <color> to a given value and verify get_ and has_
++ color = kmlbase.Color32(0xf0f0c80f)
++ colorstyle.set_color(color)
++ assert colorstyle.has_color()
++ assert color == colorstyle.get_color()
++ # Clear <color> and verify has_
++ colorstyle.clear_color()
++ assert not colorstyle.has_color()
++
++ assert not colorstyle.has_colormode()
++ colormode = kmldom.COLORMODE_RANDOM
++ colorstyle.set_colormode(colormode)
++ assert colorstyle.has_colormode()
++ assert colormode == colorstyle.get_colormode()
++ colorstyle.clear_colormode()
++ assert not colorstyle.has_colormode()
++
++class SimpleIconStyleTestCase(unittest.TestCase):
++ """ This tests the IconStyle element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.iconstyle = self.factory.CreateIconStyle()
++
++ def testDefault(self):
++ assert kmldom.AsObject(self.iconstyle)
++ assert kmldom.AsSubStyle(self.iconstyle)
++ assert kmldom.AsColorStyle(self.iconstyle)
++
++ TestColorStyle(self.iconstyle)
++
++class SimpleKmlTestCase(unittest.TestCase):
++ """ This tests the Kml element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.kml = self.factory.CreateKml()
++
++ def testDefault(self):
++ assert kmldom.Type_kml == self.kml.Type()
++ assert self.kml.IsA(kmldom.Type_kml)
++ assert not self.kml.has_hint()
++ assert "" == self.kml.get_hint()
++ assert not self.kml.has_networklinkcontrol()
++ assert None == self.kml.get_networklinkcontrol()
++ assert not self.kml.has_feature()
++ assert None == self.kml.get_feature()
++
++ def testSetClear(self):
++ hint = 'target=sky'
++ self.kml.set_hint(hint)
++ assert self.kml.has_hint()
++ assert hint == self.kml.get_hint()
++ self.kml.clear_hint()
++ self.testDefault()
++
++class SimpleLabelStyleTestCase(unittest.TestCase):
++ """ This tests the LabelStyle element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.labelstyle = self.factory.CreateLabelStyle()
++
++ def testDefault(self):
++ assert kmldom.AsObject(self.labelstyle)
++ assert kmldom.AsSubStyle(self.labelstyle)
++ assert kmldom.AsColorStyle(self.labelstyle)
++
++ TestColorStyle(self.labelstyle)
++
++class SimpleLineStyleTestCase(unittest.TestCase):
++ """ This tests the LineStyle element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.linestyle = self.factory.CreateLineStyle()
++
++ def testDefault(self):
++ assert kmldom.AsObject(self.linestyle)
++ assert kmldom.AsSubStyle(self.linestyle)
++ assert kmldom.AsColorStyle(self.linestyle)
++
++ TestColorStyle(self.linestyle)
++
++ # LineStyle fields
++ # Verify default state of <width>
++ assert not self.linestyle.has_width()
++ # Set <width> and verify get_ and has_
++ width = 4
++ self.linestyle.set_width(width)
++ assert self.linestyle.has_width()
++ assert width == self.linestyle.get_width()
++ # Clear <width> and verify has_
++ self.linestyle.clear_width()
++ assert not self.linestyle.has_width()
++
++class SimpleListStyleTestCase(unittest.TestCase):
++ """ This tests the ListStyle element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.liststyle = self.factory.CreateListStyle()
++
++ def testDefault(self):
++ assert kmldom.AsObject(self.liststyle)
++ assert kmldom.AsSubStyle(self.liststyle)
++ assert kmldom.AsListStyle(self.liststyle)
++ assert not self.liststyle.has_id()
++ assert 0 == self.liststyle.get_itemicon_array_size()
++
++class SimpleNetworkLinkControlTestCase(unittest.TestCase):
++ """ This tests the NetworkLinkControl element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.nlc = self.factory.CreateNetworkLinkControl()
++
++ def testDefault(self):
++ assert kmldom.Type_NetworkLinkControl == self.nlc.Type()
++ assert self.nlc.IsA(kmldom.Type_NetworkLinkControl)
++ assert not self.nlc.has_minrefreshperiod()
++ assert not self.nlc.has_maxsessionlength()
++ assert not self.nlc.has_cookie()
++ assert not self.nlc.has_message()
++ assert not self.nlc.has_linkname()
++ assert not self.nlc.has_linkdescription()
++ assert not self.nlc.has_linksnippet()
++ assert not self.nlc.has_expires()
++ assert not self.nlc.has_update()
++ assert not self.nlc.has_abstractview()
++
++ def testSetClear(self):
++ minrefreshperiod = 42.123
++ self.nlc.set_minrefreshperiod(minrefreshperiod)
++ assert self.nlc.has_minrefreshperiod()
++ assert minrefreshperiod == self.nlc.get_minrefreshperiod()
++ self.nlc.clear_minrefreshperiod()
++ assert not self.nlc.has_minrefreshperiod()
++
++class SimplePhotoOverlayTestCase(unittest.TestCase):
++ """ This tests the PhotoOverlay element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.photooverlay = self.factory.CreatePhotoOverlay()
++
++ def testDefault(self):
++ assert kmldom.AsObject(self.photooverlay)
++ assert kmldom.AsFeature(self.photooverlay)
++ assert kmldom.AsOverlay(self.photooverlay)
++ assert kmldom.AsPhotoOverlay(self.photooverlay)
++ assert not self.photooverlay.has_id() # Object-ness
++ assert not self.photooverlay.has_name() # Feature-ness
++ assert not self.photooverlay.has_icon() # Overlay-ness
++ assert not self.photooverlay.has_rotation() # PhotoOverlay-ness...
++ assert not self.photooverlay.has_viewvolume()
++ assert not self.photooverlay.has_imagepyramid()
++ assert not self.photooverlay.has_point()
++ assert not self.photooverlay.has_shape()
++
++
++class SimplePlacemarkTestCase(unittest.TestCase):
++ """ This tests the Placemark element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.placemark = self.factory.CreatePlacemark()
++
++ def testDefault(self):
++ assert kmldom.AsObject(self.placemark)
++ assert kmldom.AsFeature(self.placemark)
++ assert kmldom.AsPlacemark(self.placemark)
++ assert not self.placemark.has_id() # Object-ness
++ assert not self.placemark.has_name() # Feature-ness
++ assert not self.placemark.has_geometry() # Placemark-ness
++
++ def testName(self):
++ name = 'This is my name'
++ self.placemark.set_name(name)
++ assert self.placemark.has_name()
++ assert name == self.placemark.get_name()
++ self.placemark.clear_name()
++ assert not self.placemark.has_name()
++
++
++class SimpleLatLonBoxTestCase(unittest.TestCase):
++ """ This tests the LatLonBox element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.latlonbox = self.factory.CreateLatLonBox()
++
++ def testDefault(self):
++ assert kmldom.AsObject(self.latlonbox)
++ assert kmldom.AsLatLonBox(self.latlonbox)
++ assert not self.latlonbox.has_id() # Object-ness
++ assert not self.latlonbox.has_north()
++ assert 180.0 == self.latlonbox.get_north()
++ assert not self.latlonbox.has_south()
++ assert -180.0 == self.latlonbox.get_south()
++ assert not self.latlonbox.has_east()
++ assert 180.0 == self.latlonbox.get_east()
++ assert not self.latlonbox.has_west()
++ assert -180.0 == self.latlonbox.get_west()
++
++ def testSetClear(self):
++ north = 42.42
++ south = -11.12
++ east = -80.80
++ west = -123.321
++ self.latlonbox.set_north(north)
++ self.latlonbox.set_south(south)
++ self.latlonbox.set_east(east)
++ self.latlonbox.set_west(west)
++ assert self.latlonbox.has_north()
++ assert north == self.latlonbox.get_north()
++ assert self.latlonbox.has_south()
++ assert south == self.latlonbox.get_south()
++ assert self.latlonbox.has_east()
++ assert east == self.latlonbox.get_east()
++ assert self.latlonbox.has_west()
++ assert west == self.latlonbox.get_west()
++ self.latlonbox.clear_north()
++ self.latlonbox.clear_south()
++ self.latlonbox.clear_east()
++ self.latlonbox.clear_west()
++ # Clearing everything returns to default state
++ self.testDefault()
++
++
++class SimpleLinkTestCase(unittest.TestCase):
++ """ This tests the Link element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.link = self.factory.CreateLink()
++
++ def testDefault(self):
++ assert kmldom.AsObject(self.link)
++ assert kmldom.AsLink(self.link)
++ assert not self.link.has_id() # Object-ness
++ assert not self.link.has_href() # Link-ness
++
++ def testSetClear(self):
++ href = 'http://example.com/cool.kml'
++ self.link.set_href(href)
++ assert self.link.has_href()
++ assert href == self.link.get_href()
++ self.link.clear_href()
++ # Clearing everything returns to default state
++ self.testDefault()
++
++
++class SimpleChangeTestCase(unittest.TestCase):
++ """ This tests the Change element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.change = self.factory.CreateChange()
++
++ def testDefault(self):
++ assert kmldom.AsChange(self.change)
++ assert 0 == self.change.get_object_array_size()
++
++ def testAddOneObject(self):
++ placemark = self.factory.CreatePlacemark()
++ name = 'hi'
++ placemark.set_name(name)
++ self.change.add_object(placemark)
++ assert 1 == self.change.get_object_array_size()
++ placemark = kmldom.AsPlacemark(self.change.get_object_array_at(0))
++ assert name == placemark.get_name()
++
++ def testAddNObjects(self):
++ placemark = self.factory.CreatePlacemark()
++ placemark_id = 'pm123'
++ placemark.set_id(placemark_id)
++ self.change.add_object(placemark)
++
++ latlonbox = self.factory.CreateLatLonBox()
++ latlonbox_id = 'llb123'
++ latlonbox.set_id(latlonbox_id)
++ self.change.add_object(latlonbox)
++
++ location = self.factory.CreateLocation()
++ location_id = 'location123'
++ location.set_id(location_id)
++ self.change.add_object(location)
++
++ """ Verify there are 3 items in the array in the proper order."""
++ assert 3 == self.change.get_object_array_size()
++ assert placemark_id == self.change.get_object_array_at(0).get_id()
++ assert latlonbox_id == self.change.get_object_array_at(1).get_id()
++ assert location_id == self.change.get_object_array_at(2).get_id()
++
++
++class SimpleCreateTestCase(unittest.TestCase):
++ """ This tests the Create element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.create = self.factory.CreateCreate()
++
++ def testDefault(self):
++ assert kmldom.AsCreate(self.create)
++ assert 0 == self.create.get_container_array_size()
++
++ def testAddOneContainer(self):
++ folder = self.factory.CreateFolder()
++ target_folder_id = 'target-folder'
++ folder.set_targetid(target_folder_id)
++ self.create.add_container(folder)
++ assert 1 == self.create.get_container_array_size()
++ folder = kmldom.AsFolder(self.create.get_container_array_at(0))
++ assert target_folder_id == folder.get_targetid()
++
++ def testAddNContainers(self):
++ folder = self.factory.CreateFolder()
++ folder_a_id = 'folder-a'
++ folder.set_id(folder_a_id)
++ self.create.add_container(folder)
++
++ document = self.factory.CreateFolder()
++ document_a_id = 'container-a'
++ document.set_id(document_a_id)
++ self.create.add_container(document)
++
++ document = self.factory.CreateFolder()
++ document_b_id = 'container-b'
++ document.set_id(document_b_id)
++ self.create.add_container(document)
++
++ folder = self.factory.CreateFolder()
++ folder_b_id = 'folder-b'
++ folder.set_id(folder_b_id)
++ self.create.add_container(folder)
++
++ # Verify there are 4 items in the array in the proper order.
++ assert 4 == self.create.get_container_array_size()
++ assert folder_a_id == self.create.get_container_array_at(0).get_id()
++ assert document_a_id == self.create.get_container_array_at(1).get_id()
++ assert document_b_id == self.create.get_container_array_at(2).get_id()
++ assert folder_b_id == self.create.get_container_array_at(3).get_id()
++
++
++class SimpleDeleteTestCase(unittest.TestCase):
++ """ This tests the Delete element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.delete = self.factory.CreateDelete()
++
++ def testDefault(self):
++ assert kmldom.AsDelete(self.delete)
++ assert 0 == self.delete.get_feature_array_size()
++
++ def testAddOneFeature(self):
++ groundoverlay = self.factory.CreateGroundOverlay()
++ target_groundoverlay_id = 'target-groundoverlay'
++ groundoverlay.set_targetid(target_groundoverlay_id)
++ self.delete.add_feature(groundoverlay)
++ assert 1 == self.delete.get_feature_array_size()
++ groundoverlay = kmldom.AsGroundOverlay(self.delete.get_feature_array_at(0))
++ assert target_groundoverlay_id == groundoverlay.get_targetid()
++
++ def testAddNFeatures(self):
++ document = self.factory.CreateDocument()
++ document_id = 'document-id'
++ document.set_id(document_id)
++ self.delete.add_feature(document)
++
++ folder = self.factory.CreateFolder()
++ folder_id = 'folder-id'
++ folder.set_id(folder_id)
++ self.delete.add_feature(folder)
++
++ groundoverlay = self.factory.CreateGroundOverlay()
++ groundoverlay_id = 'groundoverlay-id'
++ groundoverlay.set_id(groundoverlay_id)
++ self.delete.add_feature(groundoverlay)
++
++ networklink = self.factory.CreateNetworkLink()
++ networklink_id = 'networklink-id'
++ networklink.set_id(networklink_id)
++ self.delete.add_feature(networklink)
++
++ placemark = self.factory.CreatePlacemark()
++ placemark_id = 'placemark-id'
++ placemark.set_id(placemark_id)
++ self.delete.add_feature(placemark)
++
++ photooverlay = self.factory.CreatePhotoOverlay()
++ photooverlay_id = 'photooverlay-id'
++ photooverlay.set_id(photooverlay_id)
++ self.delete.add_feature(photooverlay)
++
++ screenoverlay = self.factory.CreateScreenOverlay()
++ screenoverlay_id = 'screenoverlay-id'
++ screenoverlay.set_id(screenoverlay_id)
++ self.delete.add_feature(screenoverlay)
++
++ # Verify there are 7 items in the array in the proper order.
++ assert 7 == self.delete.get_feature_array_size()
++ assert document_id == self.delete.get_feature_array_at(0).get_id()
++ assert folder_id == self.delete.get_feature_array_at(1).get_id()
++ assert groundoverlay_id == self.delete.get_feature_array_at(2).get_id()
++ assert networklink_id == self.delete.get_feature_array_at(3).get_id()
++ assert placemark_id == self.delete.get_feature_array_at(4).get_id()
++ assert photooverlay_id == self.delete.get_feature_array_at(5).get_id()
++ assert screenoverlay_id == self.delete.get_feature_array_at(6).get_id()
++
++
++class SimpleDocumentTestCase(unittest.TestCase):
++ """ This tests the Document element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.document = self.factory.CreateDocument()
++
++ def testDefault(self):
++ assert kmldom.AsObject(self.document)
++ assert kmldom.AsFeature(self.document)
++ assert kmldom.AsContainer(self.document)
++ assert kmldom.AsDocument(self.document)
++ assert not self.document.has_id() # Object-ness
++ assert not self.document.has_name() # Feature-ness
++ assert 0 == self.document.get_feature_array_size() # Container-ness
++ assert 0 == self.document.get_schema_array_size() # Document-ness
++ assert 0 == self.document.get_styleselector_array_size() # Document-ness
++
++
++class SimpleMultiGeometryTestCase(unittest.TestCase):
++ """ This tests the MultiGeometry element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.multigeometry = self.factory.CreateMultiGeometry()
++
++ def testDefault(self):
++ assert kmldom.AsObject(self.multigeometry)
++ assert kmldom.AsGeometry(self.multigeometry)
++ assert kmldom.AsMultiGeometry(self.multigeometry)
++ assert not self.multigeometry.has_id() # Object-ness
++ # MultiGeometry-ness
++ assert 0 == self.multigeometry.get_geometry_array_size()
++
++
++class SimpleOuterBoundaryIsTestCase(unittest.TestCase):
++ """ TODO: This tests the OuterBoundaryIs element."""
++
++
++class SimpleInnerBoundaryIsTestCase(unittest.TestCase):
++ """ TODO: This tests the InnerBoundaryIs element."""
++
++
++class SimplePolygonTestCase(unittest.TestCase):
++ """ TODO: This tests the Polygon element."""
++
++class SimplePolyStyleTestCase(unittest.TestCase):
++ """ This tests the PolyStyle element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.polystyle = self.factory.CreatePolyStyle()
++
++ def testDefault(self):
++ assert kmldom.AsObject(self.polystyle)
++ assert kmldom.AsSubStyle(self.polystyle)
++ assert kmldom.AsColorStyle(self.polystyle)
++
++ TestColorStyle(self.polystyle)
++
++ # PolyStyle fields
++ # Verify default state of <fill>
++ assert not self.polystyle.has_fill()
++ # Set <fill> and verify get_ and has_
++ fill = True
++ self.polystyle.set_fill(fill)
++ assert self.polystyle.has_fill()
++ assert fill == self.polystyle.get_fill()
++ # Clear <fill> and verify has_
++ self.polystyle.clear_fill()
++ assert not self.polystyle.has_fill()
++
++ # Verify default state of <outline>
++ assert not self.polystyle.has_outline()
++ # Set <outline> and verify get_ and has_
++ outline = True
++ self.polystyle.set_outline(outline)
++ assert self.polystyle.has_outline()
++ assert outline == self.polystyle.get_outline()
++ # Clear <outline> and verify has_
++ self.polystyle.clear_outline()
++ assert not self.polystyle.has_outline()
++
++class SimpleResourceMapTestCase(unittest.TestCase):
++ """ This tests the ResourceMap element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.resourcemap = self.factory.CreateResourceMap()
++
++ def testDefault(self):
++ assert kmldom.AsObject(self.resourcemap)
++ assert kmldom.AsResourceMap(self.resourcemap)
++ assert not self.resourcemap.has_id()
++ assert 0 == self.resourcemap.get_alias_array_size()
++
++
++class SimpleSchemaTestCase(unittest.TestCase):
++ """ This tests the Schema element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.schema = self.factory.CreateSchema()
++
++ def testDefault(self):
++ assert kmldom.AsSchema(self.schema)
++ assert not self.schema.has_name()
++ assert not self.schema.has_id()
++ assert 0 == self.schema.get_simplefield_array_size()
++
++
++class SimpleSchemaDataTestCase(unittest.TestCase):
++ """ This tests the SchemaData element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.schemadata = self.factory.CreateSchemaData()
++
++ def testDefault(self):
++ assert kmldom.AsObject(self.schemadata)
++ assert kmldom.AsSchemaData(self.schemadata)
++ assert not self.schemadata.has_schemaurl()
++ assert "" == self.schemadata.get_schemaurl()
++ assert not self.schemadata.has_id()
++ assert 0 == self.schemadata.get_simpledata_array_size()
++
++
++class SimpleSimpleFieldTestCase(unittest.TestCase):
++ """ This tests the SimpleField element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.simplefield = self.factory.CreateSimpleField()
++
++ def testDefault(self):
++ assert kmldom.AsSimpleField(self.simplefield)
++ assert not self.simplefield.has_type()
++ assert not self.simplefield.has_name()
++ assert not self.simplefield.has_displayname()
++
++
++class SimpleStyleMapTestCase(unittest.TestCase):
++ """ TODO: This tests the StyleMap element."""
++
++
++class SimpleUpdateTestCase(unittest.TestCase):
++ """ This tests the Update element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.update = self.factory.CreateUpdate()
++
++ def testDefault(self):
++ assert kmldom.AsUpdate(self.update)
++ assert 0 == self.update.get_updateoperation_array_size()
++
++ def testTargetHref(self):
++ assert not self.update.has_targethref()
++ assert '' == self.update.get_targethref()
++ href = 'mycoolhref'
++ self.update.set_targethref(href)
++ assert self.update.has_targethref()
++ assert href == self.update.get_targethref()
++
++class SimpleStyleMapTestCase(unittest.TestCase):
++ """ TODO: This tests the StyleMap element."""
++
++class SimpleIconStyleIconTestCase(unittest.TestCase):
++ """ This tests the IconStyleIcon element."""
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.iconstyleicon= self.factory.CreateIconStyleIcon()
++
++ def testBasic(self):
++ assert not self.iconstyleicon.has_href() # default state
++ assert '' == self.iconstyleicon.get_href()
++ href = 'http://blah.blah'
++ self.iconstyleicon.set_href(href)
++ assert self.iconstyleicon.has_href()
++ assert href == self.iconstyleicon.get_href()
++ self.iconstyleicon.clear_href()
++ assert not self.iconstyleicon.has_href() # back in default state
++ assert '' == self.iconstyleicon.get_href()
++
++class GxExtensionsTestCase(unittest.TestCase):
++ """ This tests the gx: elements extended by Google Earth 5.0
++ These are basic subsets of the full suite of tests in the main
++ C++ code and verify the basic operation of the API """
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++
++ # Feature's gx:balloonVisibility.
++ def testGxBalloonVisibility(self):
++ placemark = self.factory.CreatePlacemark()
++ assert not placemark.has_gx_balloonvisibility()
++ assert False == placemark.get_gx_balloonvisibility()
++ placemark.set_gx_balloonvisibility(True)
++ assert placemark.has_gx_balloonvisibility()
++ assert True == placemark.get_gx_balloonvisibility()
++ expected = (
++ '<Placemark>\n'
++ ' <gx:balloonVisibility>1</gx:balloonVisibility>\n'
++ '</Placemark>\n')
++ assert expected == kmldom.SerializePretty(placemark)
++
++ # <gx:TimeStamp> and <gx:TimeSpan> in AbstractView.
++ def testGxTimePrimitives(self):
++ lookat = self.factory.CreateLookAt()
++ assert not lookat.has_gx_timeprimitive()
++ assert None == lookat.get_gx_timeprimitive()
++ timespan = self.factory.CreateGxTimeSpan()
++ lookat.set_gx_timeprimitive(timespan)
++ assert lookat.has_gx_timeprimitive()
++ expected_lookat = (
++ '<LookAt>\n'
++ ' <gx:TimeSpan/>\n'
++ '</LookAt>\n')
++ assert expected_lookat == kmldom.SerializePretty(lookat)
++
++ camera = self.factory.CreateCamera()
++ assert not camera.has_gx_timeprimitive()
++ assert None == camera.get_gx_timeprimitive()
++ timestamp = self.factory.CreateGxTimeStamp()
++ camera.set_gx_timeprimitive(timestamp)
++ assert camera.has_gx_timeprimitive()
++ expected_camera = (
++ '<Camera>\n'
++ ' <gx:TimeStamp/>\n'
++ '</Camera>\n')
++ assert expected_camera == kmldom.SerializePretty(camera)
++
++ # <gx:altitudeMode>clampToSeaFloor|relativeToSeaFloor.
++ def testGxAltitudeModes(self):
++ llab = self.factory.CreateLatLonAltBox()
++ assert not llab.has_gx_altitudemode()
++ assert kmldom.GX_ALTITUDEMODE_CLAMPTOSEAFLOOR == llab.get_gx_altitudemode()
++ altmode_rel = kmldom.GX_ALTITUDEMODE_RELATIVETOSEAFLOOR
++ llab.set_gx_altitudemode(altmode_rel)
++ assert llab.has_gx_altitudemode()
++ assert altmode_rel == llab.get_gx_altitudemode()
++ expected = (
++ '<LatLonAltBox>\n'
++ ' <gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>\n'
++ '</LatLonAltBox>\n')
++ assert expected == kmldom.SerializePretty(llab)
++ # TODO: Camera, GroundOverlay, LineString, LineStyle, LinearRing, LookAt,
++ # Model, Point, Polygon.
++
++ # <gx:LatLonQuad>
++ def testGxLatLonQuad(self):
++ groundoverlay = self.factory.CreateGroundOverlay()
++ assert False == groundoverlay.has_gx_latlonquad()
++ assert None == groundoverlay.get_gx_latlonquad()
++ llq = self.factory.CreateGxLatLonQuad()
++ coords = self.factory.CreateCoordinates()
++ llq.set_coordinates(coords)
++ groundoverlay.set_gx_latlonquad(llq)
++ assert True == groundoverlay.has_gx_latlonquad()
++ expected = (
++ '<GroundOverlay>\n'
++ ' <gx:LatLonQuad>\n'
++ ' <coordinates/>\n'
++ ' </gx:LatLonQuad>\n'
++ '</GroundOverlay>\n')
++ assert expected == kmldom.SerializePretty(groundoverlay)
++
++ # <gx:Tour>
++ def testGxTour(self):
++ tour = self.factory.CreateGxTour()
++ assert not tour.has_gx_playlist()
++ assert None == tour.get_gx_playlist()
++ tour.set_gx_playlist(self.factory.CreateGxPlaylist())
++ assert tour.has_gx_playlist()
++
++ # <gx:Playlist>
++ def testGxPlaylist(self):
++ playlist = self.factory.CreateGxPlaylist()
++ assert 0 == playlist.get_gx_tourprimitive_array_size()
++ playlist.add_gx_tourprimitive(self.factory.CreateGxFlyTo())
++ assert 1 == playlist.get_gx_tourprimitive_array_size()
++
++ # <gx:AnimatedUpdate>
++ def testGxAnimatedUpdate(self):
++ animatedupdate = self.factory.CreateGxAnimatedUpdate()
++ assert False == animatedupdate.has_gx_duration()
++ assert 0.0 == animatedupdate.get_gx_duration()
++ animatedupdate.set_gx_duration(1.0)
++ assert animatedupdate.has_gx_duration()
++ assert 1.0 == animatedupdate.get_gx_duration()
++
++ assert False == animatedupdate.has_update()
++ assert None == animatedupdate.get_update()
++ animatedupdate.set_update(self.factory.CreateUpdate())
++ assert animatedupdate.has_update()
++
++ # <gx:FlyTo>
++ def testGxFlyTo(self):
++ flyto = self.factory.CreateGxFlyTo()
++ assert False == flyto.has_gx_duration()
++ assert 0.0 == flyto.get_gx_duration()
++ flyto.set_gx_duration(1.0)
++ assert flyto.has_gx_duration()
++ assert 1.0 == flyto.get_gx_duration()
++
++ assert False == flyto.has_gx_flytomode()
++ assert kmldom.GX_FLYTOMODE_BOUNCE == flyto.get_gx_flytomode()
++ flyto.set_gx_flytomode(kmldom.GX_FLYTOMODE_SMOOTH)
++ assert flyto.has_gx_flytomode()
++ assert kmldom.GX_FLYTOMODE_SMOOTH == flyto.get_gx_flytomode()
++
++ # <gx:Wait>
++ def testGxWait(self):
++ wait = self.factory.CreateGxWait()
++ assert False == wait.has_gx_duration()
++ assert 0.0 == wait.get_gx_duration()
++ wait.set_gx_duration(1.0)
++ assert wait.has_gx_duration()
++ assert 1.0 == wait.get_gx_duration()
++
++ # <gx:SoundCue>
++ def testGxSoundCue(self):
++ soundcue = self.factory.CreateGxSoundCue()
++ assert False == soundcue.has_href()
++ assert '' == soundcue.get_href()
++ href = 'some href'
++ soundcue.set_href(href)
++ assert soundcue.has_href()
++ assert href == soundcue.get_href()
++
++ # <gx:TourControl>
++ def testGxTourControl(self):
++ tourcontrol = self.factory.CreateGxTourControl()
++ assert False == tourcontrol.has_gx_playmode()
++ assert kmldom.GX_PLAYMODE_PAUSE == tourcontrol.get_gx_playmode()
++ tourcontrol.set_gx_playmode(kmldom.GX_PLAYMODE_PAUSE)
++ assert tourcontrol.has_gx_playmode()
++ assert kmldom.GX_PLAYMODE_PAUSE == tourcontrol.get_gx_playmode()
++
++ # Parse and serialization of gx:Tour and friends.
++ def testGxTourParseSerialize(self):
++ kml = (
++ '<gx:Tour>'
++ '<gx:Playlist>'
++ '<gx:SoundCue><href>x</href></gx:SoundCue>'
++ '<gx:FlyTo>'
++ '<gx:duration>1.0</gx:duration>'
++ '</gx:FlyTo>'
++ '<gx:AnimatedUpdate>'
++ '<gx:duration>2.0</gx:duration>'
++ '<Update/>'
++ '</gx:AnimatedUpdate>'
++ '<gx:TourControl><gx:playMode>pause</gx:playMode></gx:TourControl>'
++ '<gx:Wait><gx:duration>3.0</gx:duration></gx:Wait>'
++ '</gx:Playlist>'
++ '</gx:Tour>')
++ assert kmldom.ParseKml(kml)
++ assert kmldom.AsGxTour(kmldom.ParseKml(kml))
++ tour = kmldom.AsGxTour(kmldom.ParseKml(kml))
++ assert tour.has_gx_playlist()
++ playlist = tour.get_gx_playlist()
++ assert 5 == playlist.get_gx_tourprimitive_array_size()
++ soundcue = kmldom.AsGxSoundCue(playlist.get_gx_tourprimitive_array_at(0))
++ assert soundcue
++ assert soundcue.has_href()
++ assert 'x' == soundcue.get_href()
++ flyto = kmldom.AsGxFlyTo(playlist.get_gx_tourprimitive_array_at(1))
++ assert flyto
++ assert flyto.has_gx_duration()
++ assert 1.0 == flyto.get_gx_duration()
++ au = kmldom.AsGxAnimatedUpdate(playlist.get_gx_tourprimitive_array_at(2))
++ assert au
++ assert au.has_gx_duration()
++ assert 2.0 == au.get_gx_duration()
++ assert au.has_update()
++ assert kmldom.AsUpdate(au.get_update())
++ tc = kmldom.AsGxTourControl(playlist.get_gx_tourprimitive_array_at(3))
++ assert tc
++ assert tc.has_gx_playmode()
++ assert kmldom.GX_PLAYMODE_PAUSE == tc.get_gx_playmode()
++ wait = kmldom.AsGxWait(playlist.get_gx_tourprimitive_array_at(4))
++ assert wait
++ assert wait.has_gx_duration()
++ assert 3.0 == wait.get_gx_duration()
++
++class ItemIconTestCase(unittest.TestCase):
++ """ This verifies the behavior of ItemIcon and its children """
++
++ def setUp(self):
++ self.factory = kmldom.KmlFactory_GetFactory()
++ self.itemicon = self.factory.CreateItemIcon()
++
++ def testDefaults(self):
++ assert not self.itemicon.has_state()
++ assert 1 == self.itemicon.get_state_array_size()
++ assert kmldom.ITEMICONSTATE_OPEN == self.itemicon.get_state_array_at(0)
++ assert not self.itemicon.has_href()
++ assert "" == self.itemicon.get_href()
++
++ def testState(self):
++ state_open = kmldom.ITEMICONSTATE_OPEN
++ state_error = kmldom.ITEMICONSTATE_ERROR
++ state_fetching0 = kmldom.ITEMICONSTATE_FETCHING0
++
++ self.itemicon.clear_state()
++ assert 0 == self.itemicon.get_state_array_size()
++ self.itemicon.add_state(state_error)
++ assert 1 == self.itemicon.get_state_array_size()
++ assert state_error == self.itemicon.get_state_array_at(0)
++ self.itemicon.add_state(state_fetching0)
++ assert 2 == self.itemicon.get_state_array_size()
++ assert state_fetching0 == self.itemicon.get_state_array_at(1)
++
++
++def suite():
++ suite = unittest.TestSuite()
++ suite.addTest(VerySimpleParseTestCase())
++ suite.addTest(VerySimpleSerializeTestCase())
++ suite.addTest(SimpleFactoryTestCase())
++ suite.addTest(FactoryCreateElementByIdTestCase())
++ suite.addTest(VerySimpleCastTestCase())
++ suite.addTest(VerySimpleSimpleChildTestCase())
++ suite.addTest(VerySimpleComplexChildTestCase())
++ suite.addTest(SimpleAtomAuthorTestCase('testDefault'))
++ suite.addTest(SimpleAtomAuthorTestCase('testSetClear'))
++ suite.addTest(SimpleAtomLinkTestCase('testDefault'))
++ suite.addTest(SimpleAtomLinkTestCase('testSetClear'))
++ suite.addTest(SimpleCoordinatesTestCase())
++ suite.addTest(SimpleVec2TestCase())
++ suite.addTest(SimpleObjectTestCase())
++ suite.addTest(SimpleFeatureTestCase())
++ suite.addTest(SimpleFeatureTestCase('testParseAtom'))
++ suite.addTest(SimpleRegionTestCase())
++ suite.addTest(SimpleParseTestCase('testBasic'))
++ suite.addTest(SimpleSerializePrettyTestCase('testBasic'))
++ suite.addTest(SimpleSerializeRawTestCase('testBasic'))
++ suite.addTest(SimpleExtendedDataTestCase('testDefault'))
++ suite.addTest(DataTestCase('testDefault'))
++ suite.addTest(SimpleDataTestCase('testDefault'))
++ suite.addTest(SimpleIconStyleTestCase('testDefault'))
++ suite.addTest(SimpleKmlTestCase('testDefault'))
++ suite.addTest(SimpleKmlTestCase('testSetClear'))
++ suite.addTest(SimpleNetworkLinkControlTestCase('testDefault'))
++ suite.addTest(SimpleNetworkLinkControlTestCase('testSetClear'))
++ suite.addTest(SimpleLabelStyleTestCase('testDefault'))
++ suite.addTest(SimpleLineStyleTestCase('testDefault'))
++ suite.addTest(SimpleListStyleTestCase('testDefault'))
++ suite.addTest(SimplePhotoOverlayTestCase('testDefault'))
++ suite.addTest(SimplePlacemarkTestCase('testDefault'))
++ suite.addTest(SimplePlacemarkTestCase('testName'))
++ suite.addTest(SimplePolyStyleTestCase('testDefault'))
++ suite.addTest(SimpleLatLonBoxTestCase('testDefault'))
++ suite.addTest(SimpleLatLonBoxTestCase('testSetClear'))
++ suite.addTest(SimpleLinkTestCase('testDefault'))
++ suite.addTest(SimpleLinkTestCase('testSetClear'))
++ suite.addTest(SimpleChangeTestCase('testDefault'))
++ suite.addTest(SimpleChangeTestCase('testAddOneObject'))
++ suite.addTest(SimpleChangeTestCase('testAddNObjects'))
++ suite.addTest(SimpleCreateTestCase('testDefault'))
++ suite.addTest(SimpleCreateTestCase('testAddOneContainer'))
++ suite.addTest(SimpleCreateTestCase('testAddNContainers'))
++ suite.addTest(SimpleDeleteTestCase('testAddOneFeature'))
++ suite.addTest(SimpleDeleteTestCase('testAddNFeatures'))
++ suite.addTest(SimpleDocumentTestCase('testDefault'))
++ suite.addTest(SimpleResourceMapTestCase('testDefault'))
++ suite.addTest(SimpleMultiGeometryTestCase('testDefault'))
++ suite.addTest(SimpleSchemaTestCase('testDefault'))
++ suite.addTest(SimpleSchemaDataTestCase('testDefault'))
++ suite.addTest(SimpleSimpleFieldTestCase('testDefault'))
++ suite.addTest(SimpleUpdateTestCase('testDefault'))
++ suite.addTest(SimpleUpdateTestCase('testTargetHref'))
++ suite.addTest(SimpleIconStyleIconTestCase('testBasic'))
++ suite.addTest(GxExtensionsTestCase('testGxBalloonVisibility'))
++ suite.addTest(GxExtensionsTestCase('testGxTimePrimitives'))
++ suite.addTest(GxExtensionsTestCase('testGxAltitudeModes'))
++ suite.addTest(GxExtensionsTestCase('testGxLatLonQuad'))
++ suite.addTest(GxExtensionsTestCase('testGxTour'))
++ suite.addTest(GxExtensionsTestCase('testGxPlaylist'))
++ suite.addTest(GxExtensionsTestCase('testGxAnimatedUpdate'))
++ suite.addTest(GxExtensionsTestCase('testGxFlyTo'))
++ suite.addTest(GxExtensionsTestCase('testGxWait'))
++ suite.addTest(GxExtensionsTestCase('testGxSoundCue'))
++ suite.addTest(GxExtensionsTestCase('testGxTourControl'))
++ suite.addTest(GxExtensionsTestCase('testGxTourParseSerialize'))
++ suite.addTest(ItemIconTestCase('testDefaults'))
++ suite.addTest(ItemIconTestCase('testState'))
++ return suite
++
++
++runner = unittest.TextTestRunner()
++runner.run(suite())
+--- /dev/null
++++ b/tests/swig/kmlengine_test.py
+@@ -0,0 +1,283 @@
++#!/usr/bin/env python
++
++# Copyright 2008, Google Inc. All rights reserved.
++#
++# Redistribution and use in source and binary forms, with or without
++# modification, are permitted provided that the following conditions are met:
++#
++# 1. Redistributions of source code must retain the above copyright notice,
++# this list of conditions and the following disclaimer.
++# 2. Redistributions in binary form must reproduce the above copyright notice,
++# this list of conditions and the following disclaimer in the documentation
++# and/or other materials provided with the distribution.
++# 3. Neither the name of Google Inc. nor the names of its contributors may be
++# used to endorse or promote products derived from this software without
++# specific prior written permission.
++#
++# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
++# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
++# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
++# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
++# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
++# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
++# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
++# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
++# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++
++"""
++This file contains unit tests for the KML Engine Python SWIG bindings.
++"""
++
++import unittest
++import kmldom
++import kmlengine
++
++# These VerySimple tests really only verify that the function/class exists.
++
++class VerySimpleKmlDomTestCase(unittest.TestCase):
++ """ Verify very simple KML DOM usage """
++ def runTest(self):
++ factory = kmldom.KmlFactory_GetFactory()
++ placemark = factory.CreatePlacemark()
++ name = 'hi'
++ placemark.set_name(name)
++ assert name == placemark.get_name()
++
++class VerySimpleBboxTestCase(unittest.TestCase):
++ """ Verify very simple usage of class Bbox """
++ def runTest(self):
++ bbox = kmlengine.Bbox(38, 36, -120, -122)
++ assert bbox.Contains(37, -121)
++
++class AllMethodsBboxTestCase(unittest.TestCase):
++ """ Verify basic usage of each method of kmlengine.Bbox """
++ def runTest(self):
++ bbox = kmlengine.Bbox()
++ assert -180.0 == bbox.get_north()
++ assert 180.0 == bbox.get_south()
++ assert -180.0 == bbox.get_east()
++ assert 180.0 == bbox.get_west()
++
++ bbox_a = kmlengine.Bbox(10.1, -11.2, 99.99, -88.88)
++ bbox.ExpandFromBbox(bbox_a)
++ assert 10.1 == bbox.get_north()
++ assert -11.2 == bbox.get_south()
++ assert 99.99 == bbox.get_east()
++ assert -88.88 == bbox.get_west()
++
++ bbox.ExpandLatitude(20.2)
++ assert 20.2 == bbox.get_north()
++ assert -11.2 == bbox.get_south()
++ bbox.ExpandLatitude(-20.2)
++ assert 20.2 == bbox.get_north()
++ assert -20.2 == bbox.get_south()
++ bbox.ExpandLongitude(101.101)
++ assert 101.101 == bbox.get_east()
++ assert -88.88 == bbox.get_west()
++ bbox.ExpandLongitude(-101.101)
++ assert 101.101 == bbox.get_east()
++ assert -101.101 == bbox.get_west()
++
++ bbox.ExpandLatLon(30.3, -111.222);
++ assert 30.3 == bbox.get_north()
++ assert -20.2 == bbox.get_south()
++ assert 101.101 == bbox.get_east()
++ assert -111.222 == bbox.get_west()
++
++class VerySimpleCloneTestCase(unittest.TestCase):
++ """ Verify very simple usage of Clone() """
++ def runTest(self):
++ factory = kmldom.KmlFactory_GetFactory()
++ placemark = factory.CreatePlacemark()
++ name = 'hi'
++ placemark.set_name(name)
++ clone_element = kmlengine.Clone(placemark)
++ assert clone_element
++ clone_placemark = kmldom.AsPlacemark(clone_element)
++ assert clone_placemark
++ assert name == clone_placemark.get_name()
++ # Change the name in the original
++ new_name = 'new name'
++ placemark.set_name(new_name)
++ # Verify that the clone still has the old name
++ assert name == clone_placemark.get_name()
++
++class VerySimpleGetFeatureLatLonTestCase(unittest.TestCase):
++ def runTest(self):
++ kml = '<Placemark>' \
++ '<Point><coordinates>1,2,3</coordinates></Point>' \
++ '</Placemark>'
++ element = kmldom.ParseKml(kml)
++ assert element
++ feature = kmldom.AsFeature(element)
++ assert feature
++ status,lat,lon = kmlengine.GetFeatureLatLon(feature)
++ assert True == status
++ assert 1 == lon
++ assert 2 == lat
++
++class VerySimpleGetFeatureBoundsTestCase(unittest.TestCase):
++ def runTest(self):
++ kml = '<Placemark>' \
++ '<LineString><coordinates>1,2 -1,-2</coordinates></LineString>' \
++ '</Placemark>'
++ element = kmldom.ParseKml(kml)
++ assert element
++ feature = kmldom.AsFeature(element)
++ assert feature
++ bbox = kmlengine.Bbox()
++ status = kmlengine.GetFeatureBounds(feature, bbox)
++ assert status
++ assert 2 == bbox.get_north()
++ assert -2 == bbox.get_south()
++ assert 1 == bbox.get_east()
++ assert -1 == bbox.get_west()
++
++class VerySimpleGetRootFeatureTestCase(unittest.TestCase):
++ """ Verify very simple usage of GetRootFeature() """
++ def runTest(self):
++ factory = kmldom.KmlFactory_GetFactory()
++ placemark = factory.CreatePlacemark()
++ feature = kmlengine.GetRootFeature(placemark)
++ assert feature
++ assert kmldom.AsPlacemark(feature)
++
++class VerySimpleKmzSplitTestCase(unittest.TestCase):
++ def runTest(self):
++ kml_url = 'http://foo.com/goo.kmz/bar.jpg'
++ status,kmz_url,kmz_path = kmlengine.KmzSplit(kml_url)
++ assert True == status
++ assert 'http://foo.com/goo.kmz' == kmz_url
++ assert 'bar.jpg' == kmz_path
++
++class VerySimpleSplitUriTestCase(unittest.TestCase):
++ def runTest(self):
++ status,scheme,host,port,path,query,fragment = \
++ kmlengine.SplitUri('http://host.com:82/a/b/c.kml?p=q#id')
++ assert True == status
++ assert 'http' == scheme
++ assert 'host.com' == host
++ assert 'a/b/c.kml' == path
++ assert 'p=q' == query
++ assert 'id' == fragment
++
++class BasicKmlFileCreateFromParseTestCase(unittest.TestCase):
++ """ Verify very simple usage of the KmlFile::CreateFromParse() method """
++ def runTest(self):
++ id = 'pm123'
++ kml = '<Placemark id="%s"><name>hello</name></Placemark>' % id
++ kmlfile,errors = kmlengine.KmlFile.CreateFromParse(kml)
++ assert kmlfile
++ object = kmlfile.GetObjectById(id)
++ assert object
++ placemark = kmldom.AsPlacemark(object)
++ assert placemark
++ assert placemark.has_id()
++ assert id == placemark.get_id()
++
++class KmlFileCreateFromParseOfBasicElementTestCase(unittest.TestCase):
++ def runTest(self):
++ kmlfile,errors = kmlengine.KmlFile.CreateFromParse('<kml/>')
++ assert kmlfile
++ root = kmlfile.get_root()
++ assert kmldom.Type_kml == root.Type()
++
++class BasicKmlFileCreateFromImportTestCase(unittest.TestCase):
++ def runTest(self):
++ factory = kmldom.KmlFactory_GetFactory()
++ placemark = factory.CreatePlacemark()
++ id = 'placemark123'
++ name = 'some name'
++ placemark.set_id(id)
++ placemark.set_name(name)
++ folder = factory.CreateFolder()
++ folder.add_feature(placemark)
++ kmlfile = kmlengine.KmlFile.CreateFromImport(folder)
++ assert kmlfile
++ object = kmlfile.GetObjectById(id)
++ assert object
++ placemark = kmldom.AsPlacemark(object)
++ assert placemark
++ assert placemark.has_id()
++ assert id == placemark.get_id()
++ assert placemark.has_name()
++ assert name == placemark.get_name()
++
++class KmlFileCreateFromImportOfBasicElementTestCase(unittest.TestCase):
++ def runTest(self):
++ factory = kmldom.KmlFactory_GetFactory()
++ # TODO: This crashes CreateFromImport as do all non-Object complex elements
++ # kml = factory.CreateKml()
++ # This returns an ElementPtr for the given element and works fine in
++ # CreateFromImport:
++ kml_as_element = factory.CreateElementById(kmldom.Type_kml)
++ kml = kmldom.AsKml(kml_as_element)
++ kml.set_feature(factory.CreatePlacemark())
++ kmlfile = kmlengine.KmlFile.CreateFromImport(kml_as_element)
++ assert kmlfile
++ root = kmlfile.get_root()
++ assert root
++ kml = kmldom.AsKml(root)
++ assert kml
++ assert kml.has_feature()
++ placemark = kmldom.AsPlacemark(kml.get_feature())
++ assert placemark
++
++class BasicKmlFileSerializeToStringTestCase(unittest.TestCase):
++ def runTest(self):
++ factory = kmldom.KmlFactory_GetFactory()
++ kml = factory.CreateElementById(kmldom.Type_kml)
++ assert kml
++ kmlfile = kmlengine.KmlFile.CreateFromImport(kml)
++ assert kmlfile
++ (ok, xml) = kmlfile.SerializeToString()
++ assert ok
++ kExpectedXml = '<?xml version="1.0" encoding="utf-8"?>\n' \
++ '<kml xmlns="http://www.opengis.net/kml/2.2"/>\n'
++ assert kExpectedXml == xml
++
++class BasicKmzFileTestCase(unittest.TestCase):
++ def runTest(self):
++ kmz_filepath = '../../testdata/kmz/model-macky.kmz'
++ kmzfile = kmlengine.KmzFile.OpenFromFile(kmz_filepath)
++ assert kmzfile
++ (ok, kml) = kmzfile.ReadKml()
++ assert ok
++ (kmlfile,errors) = kmlengine.KmlFile.CreateFromParse(kml)
++ assert kmlfile
++ root = kmldom.AsKml(kmlfile.get_root())
++ assert root
++ placemark = kmldom.AsPlacemark(root.get_feature())
++ assert placemark
++ assert 'SketchUp Model of Macky Auditorium' == placemark.get_name()
++ assert placemark.has_geometry()
++ model = kmldom.AsModel(placemark.get_geometry())
++ assert model
++ assert 'model_4' == model.get_id()
++ (ok, dae) = kmzfile.ReadFile('geometry/CU-Macky.dae')
++ assert ok
++ assert 268477 == len(dae)
++
++def suite():
++ suite = unittest.TestSuite()
++ suite.addTest(VerySimpleKmlDomTestCase())
++ suite.addTest(VerySimpleBboxTestCase())
++ suite.addTest(AllMethodsBboxTestCase())
++ suite.addTest(VerySimpleCloneTestCase())
++ suite.addTest(VerySimpleGetRootFeatureTestCase())
++ suite.addTest(VerySimpleGetFeatureLatLonTestCase())
++ suite.addTest(VerySimpleGetFeatureBoundsTestCase())
++ suite.addTest(VerySimpleKmzSplitTestCase())
++ suite.addTest(VerySimpleSplitUriTestCase())
++ suite.addTest(KmlFileCreateFromParseOfBasicElementTestCase())
++ suite.addTest(BasicKmlFileCreateFromParseTestCase())
++ suite.addTest(BasicKmlFileCreateFromImportTestCase())
++ suite.addTest(KmlFileCreateFromImportOfBasicElementTestCase())
++ suite.addTest(BasicKmlFileSerializeToStringTestCase())
++ suite.addTest(BasicKmzFileTestCase())
++ return suite
++
++
++runner = unittest.TextTestRunner()
++runner.run(suite())
+--- a/src/swig/KmlBaseTest.java
++++ /dev/null
+@@ -1,92 +0,0 @@
+-// Copyright 2009, Google Inc. All rights reserved.
+-//
+-// Redistribution and use in source and binary forms, with or without
+-// modification, are permitted provided that the following conditions are met:
+-//
+-// 1. Redistributions of source code must retain the above copyright notice,
+-// this list of conditions and the following disclaimer.
+-// 2. Redistributions in binary form must reproduce the above copyright notice,
+-// this list of conditions and the following disclaimer in the documentation
+-// and/or other materials provided with the distribution.
+-// 3. Neither the name of Google Inc. nor the names of its contributors may be
+-// used to endorse or promote products derived from this software without
+-// specific prior written permission.
+-//
+-// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+-// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+-// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+-// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+-// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+-// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+-// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+-// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-
+-// This is a small subset of the python tests to ensure sanity of the basic
+-// Java bindings.
+-
+-import org.junit.*;
+-import static org.junit.Assert.*;
+-
+-import com.googlecode.libkml.*;
+-
+-public class KmlBaseTest {
+-
+- static {
+- try {
+- System.loadLibrary("kmlbase_swig_java");
+- } catch (UnsatisfiedLinkError e) {
+- System.err.println("Failed to load kmlbase. " + e);
+- System.err.println("Make sure you have your classpath set correctly " +
+- "and that LD_LIBRARY_PATH can see " +
+- "libkmldom_swig_java and friends");
+- System.exit(1);
+- }
+- }
+-
+- @Test public void testBasicAttributes() {
+- Attributes attributes = new Attributes();
+- assertEquals(0, attributes.GetSize());
+- }
+-
+- @Test public void testBasicColor32() {
+- Color32 color = new Color32();
+- long expected = 0xffffffffL;
+- assertEquals(expected, color.get_color_abgr());
+-
+- long red = 0xff0000ffL;
+- color = new Color32(red);
+- assertEquals(red, color.get_color_abgr());
+-
+- String red_str = "ff0000ff";
+- color = new Color32(red_str);
+- assertEquals(red, color.get_color_abgr());
+- }
+-
+- @Test public void testBasicDateTime() {
+- String when = "2008-10-03T09:25:42Z";
+- DateTime datetime = DateTime.Create(when);
+- assertEquals(1223025942, datetime.GetTimeT());
+- assertEquals("09:25:42", datetime.GetXsdTime());
+- assertEquals("2008-10-03", datetime.GetXsdDate());
+- assertEquals(when, datetime.GetXsdDateTime());
+- }
+-
+- @Test public void testBasicVec3() {
+- double latitude = 38.12345;
+- double longitude = -121.123123;
+- double altitude = 9876.5432;
+- Vec3 vec3 = new Vec3(longitude, latitude, altitude);
+- assertEquals(latitude, vec3.get_latitude(), 0.000001);
+- assertEquals(longitude, vec3.get_longitude(), 0.000001);
+- assertTrue(vec3.has_altitude());
+- assertEquals(altitude, vec3.get_altitude(), 0.000001);
+- vec3 = new Vec3(longitude, latitude);
+- assertEquals(latitude, vec3.get_latitude(), 0.000001);
+- assertEquals(longitude, vec3.get_longitude(), 0.000001);
+- assertFalse(vec3.has_altitude());
+- }
+-
+-}
+-
+--- a/src/swig/kmlbase.i
++++ b/src/swig/kmlbase.i
+@@ -1,9 +1,9 @@
+ // Copyright 2008, Google Inc. All rights reserved.
+ //
+-// Redistribution and use in source and binary forms, with or without
++// Redistribution and use in source and binary forms, with or without
+ // modification, are permitted provided that the following conditions are met:
+ //
+-// 1. Redistributions of source code must retain the above copyright notice,
++// 1. Redistributions of source code must retain the above copyright notice,
+ // this list of conditions and the following disclaimer.
+ // 2. Redistributions in binary form must reproduce the above copyright notice,
+ // this list of conditions and the following disclaimer in the documentation
+@@ -13,19 +13,21 @@
+ // specific prior written permission.
+ //
+ // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+-// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
++// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+-// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+-// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+-// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
++// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
++// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ // This is the SWIG interface file for the KML Base module.
+ // This was developed with SWIG version 1.3.35.
+
++//%rename(__set__) *::operator=;
++//%rename(__getitem__) *::operator[];
+ %module kmlbase
+
+ // Include the headers needed to build kmlengine_wrap.cc.
+@@ -52,6 +54,8 @@
+ %apply std::string* OUTPUT { std::string* output_value };
+ %apply std::string* OUTPUT { std::string* output_key };
+
++
++
+ typedef long time_t;
+
+ namespace kmlbase {
+@@ -64,6 +68,8 @@ class Attributes {
+ void SetString(const std::string& attr_name, const std::string& attr_val);
+ };
+
++%rename(Color32_op_equal) Color32::operator==;
++
+ class Color32 {
+ public:
+ Color32();
+@@ -88,6 +94,7 @@ class Color32 {
+ unsigned char g, unsigned char r);
+ void set_color_argb(uint32_t color_argb);
+ bool operator==(const Color32& color) const;
++
+ // TODO: other operator overrides.
+ };
+
+--- a/src/swig/kmlbase_test.py
++++ /dev/null
+@@ -1,161 +0,0 @@
+-#!/usr/bin/env python
+-
+-# Copyright 2008, Google Inc. All rights reserved.
+-#
+-# Redistribution and use in source and binary forms, with or without
+-# modification, are permitted provided that the following conditions are met:
+-#
+-# 1. Redistributions of source code must retain the above copyright notice,
+-# this list of conditions and the following disclaimer.
+-# 2. Redistributions in binary form must reproduce the above copyright notice,
+-# this list of conditions and the following disclaimer in the documentation
+-# and/or other materials provided with the distribution.
+-# 3. Neither the name of Google Inc. nor the names of its contributors may be
+-# used to endorse or promote products derived from this software without
+-# specific prior written permission.
+-#
+-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+-# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-
+-"""
+-This file contains unit tests for the KML Base Python SWIG bindings.
+-"""
+-
+-import unittest
+-import kmlbase
+-
+-# These VerySimple tests really only verify that the function/class exists.
+-# Based on kml/base/color32_test.cc.
+-
+-class BasicAttributesTestCase(unittest.TestCase):
+- def runTest(self):
+- attributes = kmlbase.Attributes()
+- assert 0 == attributes.GetSize()
+- found,value = attributes.FindValue("key")
+- assert not found
+- found,key = attributes.FindKey("value")
+- assert not found
+-
+-class BasicColor32TestCase(unittest.TestCase):
+- """Verify very simple Color32 usage """
+- def runTest(self):
+- # Default construction.
+- color = kmlbase.Color32()
+- assert 0xffffffff == color.get_color_abgr()
+-
+- # Construction from specific color.
+- red = 0xff0000ff
+- color = kmlbase.Color32(red)
+- assert red == color.get_color_abgr()
+-
+- # Construction from RGBA chars.
+- A = 0xff
+- B = 0x00
+- G = 0x00
+- R = 0xff
+- color = kmlbase.Color32(A, B, G, R)
+- assert red == color.get_color_abgr()
+-
+- # Construction from string.
+- red_str = "ff0000ff"
+- color = kmlbase.Color32(red_str)
+- assert red == color.get_color_abgr()
+-
+- # Bad construction.
+- nonsense = "This isn't even close to a color value"
+- color = kmlbase.Color32(nonsense)
+- assert "00000000" == color.to_string_abgr()
+-
+- # Getters in default state.
+- color = kmlbase.Color32()
+- kFF = 0xff
+-
+- assert kFF == color.get_alpha()
+- assert kFF == color.get_blue()
+- assert kFF == color.get_green()
+- assert kFF == color.get_red()
+-
+- # Verify getters of newly set state.
+- kAB = 0xab
+- color.set_alpha(kAB)
+- color.set_blue(kAB)
+- color.set_green(kAB)
+- color.set_red(kAB)
+- assert kAB == color.get_alpha()
+- assert kAB == color.get_blue()
+- assert kAB == color.get_green()
+- assert kAB == color.get_red()
+-
+- # Verify get_color_abgr and get_color_rgba.
+- kOpaqueGreen = 0xff00ff00
+- color = kmlbase.Color32(kOpaqueGreen)
+- assert kOpaqueGreen == color.get_color_abgr()
+- kOpaqueGreenARGB = 0xff00ff00
+- assert kOpaqueGreenARGB == color.get_color_argb()
+-
+- # Verify reconstruction to AABBGGRR string.
+- kOpaqueRedStr = "ff0000ff"
+- color = kmlbase.Color32(kOpaqueRedStr);
+- assert kOpaqueRedStr == color.to_string_abgr()
+-
+- # Verify to_argb_string.
+- assert kOpaqueRedStr == color.to_string_abgr()
+- kOpaqueRedStr_argb = "ffff0000"
+- assert kOpaqueRedStr_argb == color.to_string_argb()
+-
+- # Equality operator.
+- red = kmlbase.Color32(kOpaqueRedStr)
+- green = kmlbase.Color32(kOpaqueGreen)
+- assert red == red
+- assert green != red
+-
+-class BasicDateTimeTestCase(unittest.TestCase):
+- def runTest(self):
+- kWhen = "2008-10-03T09:25:42Z"
+- datetime = kmlbase.DateTime_Create(kWhen)
+- assert datetime
+- assert 1223025942 == datetime.GetTimeT()
+- assert "09:25:42" == datetime.GetXsdTime()
+- assert "2008-10-03" == datetime.GetXsdDate()
+- assert kWhen == datetime.GetXsdDateTime()
+-
+-class BasicVec3TestCase(unittest.TestCase):
+- def runTest(self):
+- kLatitude = 38.12345
+- kLongitude = -121.123123
+- kAltitude = 9876.5432
+- vec3 = kmlbase.Vec3(kLongitude, kLatitude, kAltitude)
+- assert vec3
+- assert kLatitude == vec3.get_latitude()
+- assert kLongitude == vec3.get_longitude()
+- assert vec3.has_altitude()
+- assert kAltitude == vec3.get_altitude()
+- vec3 = kmlbase.Vec3(kLongitude, kLatitude)
+- assert vec3
+- assert kLatitude == vec3.get_latitude()
+- assert kLongitude == vec3.get_longitude()
+- assert not vec3.has_altitude()
+-
+-class BasicVersionTestCase(unittest.TestCase):
+- def runTest(self):
+- assert "1.3.0" == kmlbase.Version_GetString()
+-
+-def suite():
+- suite = unittest.TestSuite()
+- suite.addTest(BasicAttributesTestCase())
+- suite.addTest(BasicColor32TestCase())
+- suite.addTest(BasicDateTimeTestCase())
+- suite.addTest(BasicVec3TestCase())
+- suite.addTest(BasicVersionTestCase())
+- return suite
+-
+-runner = unittest.TextTestRunner()
+-runner.run(suite())
+--- a/src/swig/kmldom_test.py
++++ /dev/null
+@@ -1,1655 +0,0 @@
+-#!/usr/bin/env python
+-
+-# Copyright 2008, Google Inc. All rights reserved.
+-#
+-# Redistribution and use in source and binary forms, with or without
+-# modification, are permitted provided that the following conditions are met:
+-#
+-# 1. Redistributions of source code must retain the above copyright notice,
+-# this list of conditions and the following disclaimer.
+-# 2. Redistributions in binary form must reproduce the above copyright notice,
+-# this list of conditions and the following disclaimer in the documentation
+-# and/or other materials provided with the distribution.
+-# 3. Neither the name of Google Inc. nor the names of its contributors may be
+-# used to endorse or promote products derived from this software without
+-# specific prior written permission.
+-#
+-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+-# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-
+-"""
+-This file contains unit tests for the KML DOM Python SWIG bindings.
+-"""
+-
+-import unittest
+-import kmlbase
+-import kmldom
+-
+-
+-class VerySimpleParseTestCase(unittest.TestCase):
+- """ This simply verifies the existence of the binding to ParseKml() """
+-
+- def runTest(self):
+- assert kmldom.ParseKml('<kml/>')
+-
+-
+-class VerySimpleSerializeTestCase(unittest.TestCase):
+- """ This verifies the existence of the binding to SerializeRaw() """
+-
+- def runTest(self):
+- kml = '<kml/>'
+- assert kml == kmldom.SerializeRaw(kmldom.ParseKml(kml))
+-
+-
+-class SimpleFactoryTestCase(unittest.TestCase):
+- """
+- This verifies the existence of the binding to KmlFactory::GetFactory
+- and the exitence of bindings for all factory methods.
+- """
+-
+- def runTest(self):
+- factory = kmldom.KmlFactory_GetFactory()
+- assert factory.CreateElementById(kmldom.Type_Placemark)
+- assert factory.CreateAlias()
+- assert factory.CreateAtomAuthor()
+- assert factory.CreateAtomLink()
+- assert factory.CreateBalloonStyle()
+- assert factory.CreateCamera()
+- assert factory.CreateChange()
+- assert factory.CreateCreate()
+- assert factory.CreateData()
+- assert factory.CreateDelete()
+- assert factory.CreateDocument()
+- assert factory.CreateExtendedData()
+- assert factory.CreateFolder()
+- assert factory.CreateGroundOverlay()
+- assert factory.CreateIcon()
+- assert factory.CreateIconStyle()
+- assert factory.CreateImagePyramid()
+- assert factory.CreateItemIcon()
+- assert factory.CreateLabelStyle()
+- assert factory.CreateLatLonAltBox()
+- assert factory.CreateLatLonBox()
+- assert factory.CreateLineString()
+- assert factory.CreateLineStyle()
+- assert factory.CreateLinearRing()
+- assert factory.CreateLink()
+- assert factory.CreateListStyle()
+- assert factory.CreateLocation()
+- assert factory.CreateLod()
+- assert factory.CreateLookAt()
+- assert factory.CreateModel()
+- assert factory.CreateMultiGeometry()
+- assert factory.CreateNetworkLink()
+- assert factory.CreateNetworkLinkControl()
+- assert factory.CreateOrientation()
+- assert factory.CreatePair()
+- assert factory.CreatePhotoOverlay()
+- assert factory.CreatePlacemark()
+- assert factory.CreatePoint()
+- assert factory.CreatePolyStyle()
+- assert factory.CreatePolygon()
+- assert factory.CreateRegion()
+- assert factory.CreateResourceMap()
+- assert factory.CreateScale()
+- assert factory.CreateSchema()
+- assert factory.CreateSchemaData()
+- assert factory.CreateScreenOverlay()
+- assert factory.CreateSimpleData()
+- assert factory.CreateSimpleField()
+- assert factory.CreateSnippet()
+- assert factory.CreateStyle()
+- assert factory.CreateStyleMap()
+- assert factory.CreateTimeSpan()
+- assert factory.CreateTimeStamp()
+- assert factory.CreateUpdate()
+- assert factory.CreateViewVolume()
+- assert factory.CreateHotSpot()
+- assert factory.CreateInnerBoundaryIs()
+- assert factory.CreateKml()
+- assert factory.CreateLinkSnippet()
+- assert factory.CreateOuterBoundaryIs()
+- assert factory.CreateOverlayXY()
+- assert factory.CreateRotationXY()
+- assert factory.CreateScreenXY()
+- assert factory.CreateSize()
+- assert factory.CreateGxAnimatedUpdate()
+- assert factory.CreateGxFlyTo()
+- assert factory.CreateGxLatLonQuad()
+- assert factory.CreateGxPlaylist()
+- assert factory.CreateGxSoundCue()
+- assert factory.CreateGxTimeSpan()
+- assert factory.CreateGxTimeStamp()
+- assert factory.CreateGxTour()
+- assert factory.CreateGxTourControl()
+- assert factory.CreateGxWait()
+-
+-class FactoryCreateElementByIdTestCase(unittest.TestCase):
+- def runTest(self):
+- factory = kmldom.KmlFactory_GetFactory()
+- assert factory.CreateElementById(kmldom.Type_Alias)
+- assert factory.CreateElementById(kmldom.Type_AtomAuthor)
+- assert factory.CreateElementById(kmldom.Type_AtomLink)
+- assert factory.CreateElementById(kmldom.Type_BalloonStyle)
+- assert factory.CreateElementById(kmldom.Type_Camera)
+- assert factory.CreateElementById(kmldom.Type_Change)
+- assert factory.CreateElementById(kmldom.Type_coordinates)
+- assert factory.CreateElementById(kmldom.Type_Create)
+- assert factory.CreateElementById(kmldom.Type_Data)
+- assert factory.CreateElementById(kmldom.Type_Delete)
+- assert factory.CreateElementById(kmldom.Type_Document)
+- assert factory.CreateElementById(kmldom.Type_ExtendedData)
+- assert factory.CreateElementById(kmldom.Type_Folder)
+- assert factory.CreateElementById(kmldom.Type_GroundOverlay)
+- assert factory.CreateElementById(kmldom.Type_Icon)
+- assert factory.CreateElementById(kmldom.Type_IconStyle)
+- assert factory.CreateElementById(kmldom.Type_ImagePyramid)
+- assert factory.CreateElementById(kmldom.Type_ItemIcon)
+- assert factory.CreateElementById(kmldom.Type_LabelStyle)
+- assert factory.CreateElementById(kmldom.Type_LatLonAltBox)
+- assert factory.CreateElementById(kmldom.Type_LatLonBox)
+- assert factory.CreateElementById(kmldom.Type_LineString)
+- assert factory.CreateElementById(kmldom.Type_LineStyle)
+- assert factory.CreateElementById(kmldom.Type_LinearRing)
+- assert factory.CreateElementById(kmldom.Type_Link)
+- assert factory.CreateElementById(kmldom.Type_ListStyle)
+- assert factory.CreateElementById(kmldom.Type_Location)
+- assert factory.CreateElementById(kmldom.Type_Lod)
+- assert factory.CreateElementById(kmldom.Type_LookAt)
+- assert factory.CreateElementById(kmldom.Type_Model)
+- assert factory.CreateElementById(kmldom.Type_MultiGeometry)
+- assert factory.CreateElementById(kmldom.Type_NetworkLink)
+- assert factory.CreateElementById(kmldom.Type_NetworkLinkControl)
+- assert factory.CreateElementById(kmldom.Type_Orientation)
+- assert factory.CreateElementById(kmldom.Type_Pair)
+- assert factory.CreateElementById(kmldom.Type_PhotoOverlay)
+- assert factory.CreateElementById(kmldom.Type_Placemark)
+- assert factory.CreateElementById(kmldom.Type_Point)
+- assert factory.CreateElementById(kmldom.Type_PolyStyle)
+- assert factory.CreateElementById(kmldom.Type_Polygon)
+- assert factory.CreateElementById(kmldom.Type_Region)
+- assert factory.CreateElementById(kmldom.Type_ResourceMap)
+- assert factory.CreateElementById(kmldom.Type_Scale)
+- assert factory.CreateElementById(kmldom.Type_Schema)
+- assert factory.CreateElementById(kmldom.Type_SchemaData)
+- assert factory.CreateElementById(kmldom.Type_ScreenOverlay)
+- assert factory.CreateElementById(kmldom.Type_SimpleData)
+- assert factory.CreateElementById(kmldom.Type_SimpleField)
+- assert factory.CreateElementById(kmldom.Type_Snippet)
+- assert factory.CreateElementById(kmldom.Type_Style)
+- assert factory.CreateElementById(kmldom.Type_StyleMap)
+- assert factory.CreateElementById(kmldom.Type_TimeSpan)
+- assert factory.CreateElementById(kmldom.Type_TimeStamp)
+- assert factory.CreateElementById(kmldom.Type_Update)
+- assert factory.CreateElementById(kmldom.Type_ViewVolume)
+- assert factory.CreateElementById(kmldom.Type_hotSpot)
+- assert factory.CreateElementById(kmldom.Type_innerBoundaryIs)
+- assert factory.CreateElementById(kmldom.Type_kml)
+- assert factory.CreateElementById(kmldom.Type_linkSnippet)
+- assert factory.CreateElementById(kmldom.Type_outerBoundaryIs)
+- assert factory.CreateElementById(kmldom.Type_overlayXY)
+- assert factory.CreateElementById(kmldom.Type_rotationXY)
+- assert factory.CreateElementById(kmldom.Type_screenXY)
+- assert factory.CreateElementById(kmldom.Type_size)
+- assert factory.CreateElementById(kmldom.Type_GxAnimatedUpdate)
+- assert factory.CreateElementById(kmldom.Type_GxFlyTo)
+- assert factory.CreateElementById(kmldom.Type_GxLatLonQuad)
+- assert factory.CreateElementById(kmldom.Type_GxPlaylist)
+- assert factory.CreateElementById(kmldom.Type_GxSoundCue)
+- assert factory.CreateElementById(kmldom.Type_GxTimeSpan)
+- assert factory.CreateElementById(kmldom.Type_GxTimeStamp)
+- assert factory.CreateElementById(kmldom.Type_GxTour)
+- assert factory.CreateElementById(kmldom.Type_GxTourControl)
+- assert factory.CreateElementById(kmldom.Type_GxWait)
+-
+-class VerySimpleCastTestCase(unittest.TestCase):
+- """ This verifies the existence of the bindings to a few of the casts """
+-
+- def runTest(self):
+- """ kmldom.ParseKml() returns an ElementPtr """
+- assert kmldom.AsCoordinates(kmldom.ParseKml('<coordinates/>'))
+- assert not kmldom.AsCoordinates(kmldom.ParseKml('<Document/>'))
+- assert kmldom.AsFolder(kmldom.ParseKml('<Folder/>'))
+- assert not kmldom.AsFolder(kmldom.ParseKml('<Document/>'))
+- assert kmldom.AsKml(kmldom.ParseKml('<kml/>'))
+- assert not kmldom.AsKml(kmldom.ParseKml('<Placemark/>'))
+- assert kmldom.AsPlacemark(kmldom.ParseKml('<Placemark/>'))
+- assert not kmldom.AsPlacemark(kmldom.ParseKml('<NetworkLink/>'))
+- assert kmldom.AsPoint(kmldom.ParseKml('<Point/>'))
+- assert not kmldom.AsPoint(kmldom.ParseKml('<LineString/>'))
+- assert kmldom.AsGxAnimatedUpdate(kmldom.ParseKml('<gx:AnimatedUpdate/>'))
+- assert kmldom.AsGxFlyTo(kmldom.ParseKml('<gx:FlyTo/>'))
+- assert kmldom.AsGxLatLonQuad(kmldom.ParseKml('<gx:LatLonQuad/>'))
+- assert kmldom.AsGxPlaylist(kmldom.ParseKml('<gx:Playlist/>'))
+- assert kmldom.AsGxSoundCue(kmldom.ParseKml('<gx:SoundCue/>'))
+- assert kmldom.AsGxTimeSpan(kmldom.ParseKml('<gx:TimeSpan/>'))
+- assert kmldom.AsGxTimeStamp(kmldom.ParseKml('<gx:TimeStamp/>'))
+- assert kmldom.AsGxTour(kmldom.ParseKml('<gx:Tour/>'))
+- assert kmldom.AsGxTourControl(kmldom.ParseKml('<gx:TourControl/>'))
+- assert kmldom.AsGxWait(kmldom.ParseKml('<gx:Wait/>'))
+-
+-
+-class VerySimpleSimpleChildTestCase(unittest.TestCase):
+- """
+- This tests that an element derived from Feature can properly set/get/clear
+- the simple value <name> element.
+- """
+-
+- def runTest(self):
+- factory = kmldom.KmlFactory_GetFactory()
+- folder = factory.CreateFolder()
+- assert not folder.has_name()
+- name = 'my name'
+- folder.set_name(name)
+- assert folder.has_name()
+- assert name == folder.get_name()
+- folder.clear_name()
+- assert not folder.has_name()
+-
+-
+-class VerySimpleComplexChildTestCase(unittest.TestCase):
+- """
+- This tests that a complex child of a specific type can be set and
+- cleared as a child of another element.
+- """
+-
+- def runTest(self):
+- factory = kmldom.KmlFactory_GetFactory()
+- region = factory.CreateRegion()
+- assert not region.has_lod()
+- assert not region.has_latlonaltbox()
+- region.set_lod(factory.CreateLod())
+- region.set_latlonaltbox(factory.CreateLatLonAltBox())
+- assert region.has_lod()
+- assert region.has_latlonaltbox()
+- region.clear_lod()
+- region.clear_latlonaltbox()
+- assert not region.has_lod()
+- assert not region.has_latlonaltbox()
+-
+-
+-class SimpleAtomAuthorTestCase(unittest.TestCase):
+- """ This tests the AtomAuthor element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.atomauthor = self.factory.CreateAtomAuthor()
+-
+- def testDefault(self):
+- assert kmldom.Type_AtomAuthor == self.atomauthor.Type()
+- assert self.atomauthor.IsA(kmldom.Type_AtomAuthor)
+- # default state
+- assert not self.atomauthor.has_name()
+- assert "" == self.atomauthor.get_name()
+- assert not self.atomauthor.has_uri()
+- assert "" == self.atomauthor.get_uri()
+- assert not self.atomauthor.has_email()
+- assert "" == self.atomauthor.get_email()
+-
+- def testSetClear(self):
+- # name
+- name = 'Scott Turow'
+- self.atomauthor.set_name(name)
+- assert self.atomauthor.has_name()
+- assert name == self.atomauthor.get_name()
+- self.atomauthor.clear_name()
+-
+- # uri
+- uri = 'http://www.authorsguild.org/'
+- self.atomauthor.set_uri(uri)
+- assert self.atomauthor.has_uri()
+- assert uri == self.atomauthor.get_uri()
+- self.atomauthor.clear_uri()
+-
+- # email
+- email = 'jsmith at example.com'
+- self.atomauthor.set_email(email)
+- assert self.atomauthor.has_email()
+- assert email == self.atomauthor.get_email()
+- self.atomauthor.clear_email()
+-
+- self.testDefault()
+-
+-
+-class SimpleAtomLinkTestCase(unittest.TestCase):
+- """ This tests the AtomLink element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.atomlink = self.factory.CreateAtomLink()
+-
+- def testDefault(self):
+- assert kmldom.Type_AtomLink == self.atomlink.Type()
+- assert self.atomlink.IsA(kmldom.Type_AtomLink)
+- assert not self.atomlink.has_href()
+- assert "" == self.atomlink.get_href()
+- assert not self.atomlink.has_rel()
+- assert "" == self.atomlink.get_rel()
+- assert not self.atomlink.has_type()
+- assert "" == self.atomlink.get_type()
+- assert not self.atomlink.has_hreflang()
+- assert "" == self.atomlink.get_hreflang()
+- assert not self.atomlink.has_title()
+- assert "" == self.atomlink.get_title()
+- assert not self.atomlink.has_length()
+- assert 0 == self.atomlink.get_length()
+-
+- def testSetClear(self):
+- # href
+- href = 'http://example.com'
+- self.atomlink.set_href(href)
+- assert self.atomlink.has_href()
+- assert href == self.atomlink.get_href()
+- self.atomlink.clear_href()
+-
+- rel = 'alternate'
+- self.atomlink.set_rel(rel)
+- assert self.atomlink.has_rel()
+- assert rel == self.atomlink.get_rel()
+- self.atomlink.clear_rel()
+-
+- type = 'text/html'
+- self.atomlink.set_type(type)
+- assert self.atomlink.has_type()
+- assert type == self.atomlink.get_type()
+- self.atomlink.clear_type()
+-
+- hreflang = 'en'
+- self.atomlink.set_hreflang(hreflang)
+- assert self.atomlink.has_hreflang()
+- assert hreflang == self.atomlink.get_hreflang()
+- self.atomlink.clear_hreflang()
+-
+- title = 'dive into mark'
+- self.atomlink.set_title(title)
+- assert self.atomlink.has_title()
+- assert title == self.atomlink.get_title()
+- self.atomlink.clear_title()
+-
+- length = 42
+- self.atomlink.set_length(length)
+- assert self.atomlink.has_length()
+- assert length == self.atomlink.get_length()
+- self.atomlink.clear_length()
+-
+- self.testDefault()
+-
+- def testParse(self):
+- # Straight out of RFC 4287
+- link_xml = '<link rel=\"alternate\" type=\"text/html\" '
+- link_xml += 'hreflang=\"en\" href=\"http://example.org/\"/>'
+- self.atomlink = kmldom.ParseKml(link_xml)
+- assert self.atomlink.has_rel()
+- assert self.atomlink.has_type()
+- assert self.atomlink.has_hreflang()
+- assert self.atomlink.has_href()
+- assert not self.atomlink.has_title()
+- assert not self.atomlink.has_length()
+-
+- assert self.atomlink.clear_rel()
+- assert self.atomlink.clear_type()
+- assert self.atomlink.clear_hreflang()
+- assert self.atomlink.clear_href()
+-
+- self.testDefault()
+-
+-class SimpleCoordinatesTestCase(unittest.TestCase):
+- """ This tests the methods on Coordinates and Vec3 """
+- def runTest(self):
+- factory = kmldom.KmlFactory_GetFactory()
+- coordinates = factory.CreateCoordinates()
+- # Test the Element methods
+- assert kmldom.Type_coordinates == coordinates.Type()
+- assert coordinates.IsA(kmldom.Type_coordinates)
+- # Test the Coordinates methods
+- lon = -123.456
+- lat = 38.765
+- alt = 1001.909
+- assert 0 == coordinates.get_coordinates_array_size()
+- coordinates.add_latlng(lat, lon)
+- assert 1 == coordinates.get_coordinates_array_size()
+- coordinates.add_latlngalt(lat, lon, alt)
+- assert 2 == coordinates.get_coordinates_array_size()
+- vec0 = coordinates.get_coordinates_array_at(0)
+- vec1 = coordinates.get_coordinates_array_at(1)
+- # Test the Vec3 methods
+- assert lon == vec0.get_longitude()
+- assert lat == vec0.get_latitude()
+- assert 0 == vec0.get_altitude()
+- assert lon == vec1.get_longitude()
+- assert lat == vec1.get_latitude()
+- assert alt == vec1.get_altitude()
+-
+-
+-class SimpleVec2TestCase(unittest.TestCase):
+- """ This tests the methods on Vec2 (using HotSpot) """
+- def runTest(self):
+- factory = kmldom.KmlFactory_GetFactory()
+- hotspot = factory.CreateHotSpot()
+- # Test the Element methods
+- assert kmldom.Type_hotSpot == hotspot.Type()
+- assert hotspot.IsA(kmldom.Type_hotSpot)
+- # Test the Vec2 methods
+- assert not hotspot.has_x()
+- assert not hotspot.has_xunits()
+- assert not hotspot.has_y()
+- assert not hotspot.has_yunits()
+- x = 128
+- xunits = kmldom.UNITS_PIXELS
+- y = .7
+- yunits = kmldom.UNITS_FRACTION
+- # Test the setters
+- hotspot.set_x(x)
+- hotspot.set_xunits(xunits)
+- hotspot.set_y(y)
+- hotspot.set_yunits(yunits)
+- # Test the has'ers
+- assert hotspot.has_x()
+- assert hotspot.has_xunits()
+- assert hotspot.has_y()
+- assert hotspot.has_yunits()
+- # Test the getters
+- assert x == hotspot.get_x()
+- assert xunits == hotspot.get_xunits()
+- assert y == hotspot.get_y()
+- assert yunits == hotspot.get_yunits()
+- # Test the clear'ers
+- hotspot.clear_x()
+- hotspot.clear_xunits()
+- hotspot.clear_y()
+- hotspot.clear_yunits()
+- assert not hotspot.has_x()
+- assert not hotspot.has_xunits()
+- assert not hotspot.has_y()
+- assert not hotspot.has_yunits()
+-
+-
+-class SimpleObjectTestCase(unittest.TestCase):
+- """ This tests the Object methods (using Placemark) """
+- def runTest(self):
+- factory = kmldom.KmlFactory_GetFactory()
+- placemark = factory.CreatePlacemark()
+- # Element methods
+- assert kmldom.Type_Placemark == placemark.Type()
+- assert placemark.IsA(kmldom.Type_Object)
+- assert placemark.IsA(kmldom.Type_Placemark)
+- # Object methods
+- # has_xxx()...
+- assert not placemark.has_id()
+- assert not placemark.has_targetid()
+- id = 'placemark123'
+- targetid ='placemark456'
+- # set_xxx()...
+- placemark.set_id(id)
+- placemark.set_targetid(targetid)
+- assert placemark.has_id()
+- assert placemark.has_targetid()
+- # xxx()...
+- assert id == placemark.get_id()
+- assert targetid == placemark.get_targetid()
+- # clear_xxx()...
+- placemark.clear_id()
+- placemark.clear_targetid()
+- assert not placemark.has_id()
+- assert not placemark.has_targetid()
+-
+-
+-class SimpleFeatureTestCase(unittest.TestCase):
+- """ This tests the Feature methods (using Folder) """
+- def runTest(self):
+- factory = kmldom.KmlFactory_GetFactory()
+- folder = factory.CreateFolder()
+-
+- # Element methods
+- assert kmldom.Type_Folder == folder.Type()
+- assert folder.IsA(kmldom.Type_Object)
+- assert folder.IsA(kmldom.Type_Feature)
+- assert folder.IsA(kmldom.Type_Folder)
+-
+- # TODO: Object methods
+-
+- # Feature methods
+- # TODO everything else
+-
+- assert not folder.has_phonenumber()
+- phonenumber = '867-5309'
+- folder.set_phonenumber(phonenumber)
+- assert folder.has_phonenumber()
+- assert phonenumber == folder.get_phonenumber()
+-
+- assert not folder.has_atomauthor()
+- atomauthor = factory.CreateAtomAuthor()
+- assert atomauthor
+- atom_name = 'D.F. Wallace'
+- atomauthor.set_name(atom_name)
+- folder.set_atomauthor(atomauthor)
+- got_atomauthor = folder.get_atomauthor()
+- assert atom_name == got_atomauthor.get_name()
+-
+- assert not folder.has_atomlink()
+- atomlink = factory.CreateAtomLink()
+- assert atomlink
+- atom_href = 'http://infinitesummer.org'
+- atomlink.set_href(atom_href)
+- folder.set_atomlink(atomlink)
+- got_atomlink = folder.get_atomlink()
+- assert atom_href == got_atomlink.get_href()
+-
+- assert not folder.has_snippet()
+- folder.set_snippet(factory.CreateSnippet())
+- assert folder.has_snippet()
+- snippet = folder.get_snippet()
+- # Test that the snippet() returns a SnippetPtr
+- assert not snippet.has_maxlines()
+- folder.clear_snippet()
+- assert not folder.has_snippet()
+-
+- def testParseAtom(self):
+- kml = ('<Placemark>'
+- '<atom:author>'
+- '<atom:name>D.F. Wallace</atom:name>'
+- '</atom:author>'
+- '<atom:link href="http://infinitesummer.org"></atom:link>'
+- '</Placemark>')
+- root = kmldom.ParseKml(kml)
+- assert root
+- placemark = kmldom.AsPlacemark(root)
+- assert placemark
+- assert placemark.has_atomauthor()
+- author = kmldom.AsAtomAuthor(placemark.get_atomauthor())
+- assert author
+- assert author.has_name();
+- assert "D.F. Wallace" == author.get_name()
+- assert placemark.has_atomlink()
+- link = kmldom.AsAtomLink(placemark.get_atomlink())
+- assert link
+- assert link.has_href()
+- assert "http://infinitesummer.org" == link.get_href()
+-
+-
+-class SimpleRegionTestCase(unittest.TestCase):
+- """ This tests the methods on Region """
+- def runTest(self):
+- factory = kmldom.KmlFactory_GetFactory()
+- region = factory.CreateRegion()
+-
+- # Element methods
+- assert kmldom.Type_Region == region.Type()
+- assert region.IsA(kmldom.Type_Object)
+- assert region.IsA(kmldom.Type_Region)
+-
+- # Object methods
+- # has_xxx()...
+- assert not region.has_id()
+- assert not region.has_targetid()
+- id = 'region123'
+- targetid ='region456'
+- # set_xxx()...
+- region.set_id(id)
+- region.set_targetid(targetid)
+- assert region.has_id()
+- assert region.has_targetid()
+- # xxx()...
+- assert id == region.get_id()
+- assert targetid == region.get_targetid()
+- # clear_xxx()...
+- region.clear_id()
+- region.clear_targetid()
+- assert not region.has_id()
+- assert not region.has_targetid()
+-
+- # Region methods
+- assert not region.has_lod()
+- assert not region.has_latlonaltbox()
+- region.set_lod(factory.CreateLod())
+- region.set_latlonaltbox(factory.CreateLatLonAltBox())
+- assert region.has_lod()
+- assert region.has_latlonaltbox()
+- region.clear_lod()
+- region.clear_latlonaltbox()
+- assert not region.has_lod()
+- assert not region.has_latlonaltbox()
+-
+-
+-class SimpleParseTestCase(unittest.TestCase):
+- """ This tests the Parse() function."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.root = kmldom.ParseKml('<kml>'
+- '<Placemark id=\"pm123\">'
+- '<name>hi</name>'
+- '</Placemark>'
+- '</kml>')
+-
+- def tearDown(self):
+- """ KML DOM memory is managed with smart pointers no tear down is needed """
+-
+- def testBasic(self):
+- assert self.root
+- kml = kmldom.AsKml(self.root)
+- assert kml
+- assert not kml.has_hint()
+- assert not kml.has_networklinkcontrol()
+- assert kml.has_feature()
+- placemark = kmldom.AsPlacemark(kml.get_feature())
+- assert placemark
+- assert placemark.has_id()
+- assert 'pm123' == placemark.get_id()
+- assert placemark.has_name()
+- assert 'hi' == placemark.get_name()
+- assert not placemark.has_geometry()
+-
+-
+-class SimpleSerializePrettyTestCase(unittest.TestCase):
+- """ This tests the SerializePretty() function."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.kml = self.factory.CreateKml()
+- self.folder = self.factory.CreateFolder()
+- self.folder.set_name('folder')
+- self.placemark = self.factory.CreatePlacemark()
+- self.placemark.set_name('placemark')
+- self.folder.add_feature(self.placemark)
+- self.kml.set_feature(self.folder)
+- self.xml = kmldom.SerializePretty(self.kml)
+-
+- def testBasic(self):
+- assert self.xml
+- assert '<kml>\n'\
+- ' <Folder>\n'\
+- ' <name>folder</name>\n'\
+- ' <Placemark>\n'\
+- ' <name>placemark</name>\n'\
+- ' </Placemark>\n'\
+- ' </Folder>\n'\
+- '</kml>\n' == self.xml
+-
+-
+-class SimpleSerializeRawTestCase(unittest.TestCase):
+- """ This tests the SerializeRaw() function."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.kml = self.factory.CreateKml()
+- self.folder = self.factory.CreateFolder()
+- self.folder.set_name('folder')
+- self.placemark = self.factory.CreatePlacemark()
+- self.placemark.set_name('placemark')
+- self.folder.add_feature(self.placemark)
+- self.kml.set_feature(self.folder)
+- self.xml = kmldom.SerializeRaw(self.kml)
+-
+- def testBasic(self):
+- assert self.xml
+- assert '<kml>'\
+- '<Folder>'\
+- '<name>folder</name>'\
+- '<Placemark>'\
+- '<name>placemark</name>'\
+- '</Placemark>'\
+- '</Folder>'\
+- '</kml>' == self.xml
+-
+-
+-class SimpleExtendedDataTestCase(unittest.TestCase):
+- """ This tests the ExtendedData element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.extendeddata = self.factory.CreateExtendedData()
+-
+- def testDefault(self):
+- assert kmldom.AsExtendedData(self.extendeddata)
+- assert 0 == self.extendeddata.get_data_array_size()
+- assert 0 == self.extendeddata.get_schemadata_array_size()
+-
+-class DataTestCase(unittest.TestCase):
+- """ This tests the Data element """
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.data = self.factory.CreateData()
+-
+- def testDefault(self):
+- assert kmldom.AsData(self.data)
+- assert not self.data.has_name()
+- assert "" == self.data.get_name()
+- assert not self.data.has_displayname()
+- assert "" == self.data.get_displayname()
+- assert not self.data.has_value()
+- assert "" == self.data.get_value()
+-
+-class SimpleDataTestCase(unittest.TestCase):
+- """ This tests the SimpleData element """
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.simpledata = self.factory.CreateSimpleData()
+-
+- def testDefault(self):
+- assert kmldom.AsSimpleData(self.simpledata)
+- assert not self.simpledata.has_name()
+- assert "" == self.simpledata.get_name()
+- assert not self.simpledata.has_text()
+- assert "" == self.simpledata.get_text()
+-
+-def TestColorStyle(colorstyle):
+- """ This tests the ColorStyle elements of the given ColorStyle-derived
+- element"""
+- # ColorStyle fields
+- # Verify default state of <color>
+- assert not colorstyle.has_color()
+- # Set <color> to a given value and verify get_ and has_
+- color = kmlbase.Color32(0xf0f0c80f)
+- colorstyle.set_color(color)
+- assert colorstyle.has_color()
+- assert color == colorstyle.get_color()
+- # Clear <color> and verify has_
+- colorstyle.clear_color()
+- assert not colorstyle.has_color()
+-
+- assert not colorstyle.has_colormode()
+- colormode = kmldom.COLORMODE_RANDOM
+- colorstyle.set_colormode(colormode)
+- assert colorstyle.has_colormode()
+- assert colormode == colorstyle.get_colormode()
+- colorstyle.clear_colormode()
+- assert not colorstyle.has_colormode()
+-
+-class SimpleIconStyleTestCase(unittest.TestCase):
+- """ This tests the IconStyle element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.iconstyle = self.factory.CreateIconStyle()
+-
+- def testDefault(self):
+- assert kmldom.AsObject(self.iconstyle)
+- assert kmldom.AsSubStyle(self.iconstyle)
+- assert kmldom.AsColorStyle(self.iconstyle)
+-
+- TestColorStyle(self.iconstyle)
+-
+-class SimpleKmlTestCase(unittest.TestCase):
+- """ This tests the Kml element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.kml = self.factory.CreateKml()
+-
+- def testDefault(self):
+- assert kmldom.Type_kml == self.kml.Type()
+- assert self.kml.IsA(kmldom.Type_kml)
+- assert not self.kml.has_hint()
+- assert "" == self.kml.get_hint()
+- assert not self.kml.has_networklinkcontrol()
+- assert None == self.kml.get_networklinkcontrol()
+- assert not self.kml.has_feature()
+- assert None == self.kml.get_feature()
+-
+- def testSetClear(self):
+- hint = 'target=sky'
+- self.kml.set_hint(hint)
+- assert self.kml.has_hint()
+- assert hint == self.kml.get_hint()
+- self.kml.clear_hint()
+- self.testDefault()
+-
+-class SimpleLabelStyleTestCase(unittest.TestCase):
+- """ This tests the LabelStyle element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.labelstyle = self.factory.CreateLabelStyle()
+-
+- def testDefault(self):
+- assert kmldom.AsObject(self.labelstyle)
+- assert kmldom.AsSubStyle(self.labelstyle)
+- assert kmldom.AsColorStyle(self.labelstyle)
+-
+- TestColorStyle(self.labelstyle)
+-
+-class SimpleLineStyleTestCase(unittest.TestCase):
+- """ This tests the LineStyle element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.linestyle = self.factory.CreateLineStyle()
+-
+- def testDefault(self):
+- assert kmldom.AsObject(self.linestyle)
+- assert kmldom.AsSubStyle(self.linestyle)
+- assert kmldom.AsColorStyle(self.linestyle)
+-
+- TestColorStyle(self.linestyle)
+-
+- # LineStyle fields
+- # Verify default state of <width>
+- assert not self.linestyle.has_width()
+- # Set <width> and verify get_ and has_
+- width = 4
+- self.linestyle.set_width(width)
+- assert self.linestyle.has_width()
+- assert width == self.linestyle.get_width()
+- # Clear <width> and verify has_
+- self.linestyle.clear_width()
+- assert not self.linestyle.has_width()
+-
+-class SimpleListStyleTestCase(unittest.TestCase):
+- """ This tests the ListStyle element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.liststyle = self.factory.CreateListStyle()
+-
+- def testDefault(self):
+- assert kmldom.AsObject(self.liststyle)
+- assert kmldom.AsSubStyle(self.liststyle)
+- assert kmldom.AsListStyle(self.liststyle)
+- assert not self.liststyle.has_id()
+- assert 0 == self.liststyle.get_itemicon_array_size()
+-
+-class SimpleNetworkLinkControlTestCase(unittest.TestCase):
+- """ This tests the NetworkLinkControl element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.nlc = self.factory.CreateNetworkLinkControl()
+-
+- def testDefault(self):
+- assert kmldom.Type_NetworkLinkControl == self.nlc.Type()
+- assert self.nlc.IsA(kmldom.Type_NetworkLinkControl)
+- assert not self.nlc.has_minrefreshperiod()
+- assert not self.nlc.has_maxsessionlength()
+- assert not self.nlc.has_cookie()
+- assert not self.nlc.has_message()
+- assert not self.nlc.has_linkname()
+- assert not self.nlc.has_linkdescription()
+- assert not self.nlc.has_linksnippet()
+- assert not self.nlc.has_expires()
+- assert not self.nlc.has_update()
+- assert not self.nlc.has_abstractview()
+-
+- def testSetClear(self):
+- minrefreshperiod = 42.123
+- self.nlc.set_minrefreshperiod(minrefreshperiod)
+- assert self.nlc.has_minrefreshperiod()
+- assert minrefreshperiod == self.nlc.get_minrefreshperiod()
+- self.nlc.clear_minrefreshperiod()
+- assert not self.nlc.has_minrefreshperiod()
+-
+-class SimplePhotoOverlayTestCase(unittest.TestCase):
+- """ This tests the PhotoOverlay element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.photooverlay = self.factory.CreatePhotoOverlay()
+-
+- def testDefault(self):
+- assert kmldom.AsObject(self.photooverlay)
+- assert kmldom.AsFeature(self.photooverlay)
+- assert kmldom.AsOverlay(self.photooverlay)
+- assert kmldom.AsPhotoOverlay(self.photooverlay)
+- assert not self.photooverlay.has_id() # Object-ness
+- assert not self.photooverlay.has_name() # Feature-ness
+- assert not self.photooverlay.has_icon() # Overlay-ness
+- assert not self.photooverlay.has_rotation() # PhotoOverlay-ness...
+- assert not self.photooverlay.has_viewvolume()
+- assert not self.photooverlay.has_imagepyramid()
+- assert not self.photooverlay.has_point()
+- assert not self.photooverlay.has_shape()
+-
+-
+-class SimplePlacemarkTestCase(unittest.TestCase):
+- """ This tests the Placemark element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.placemark = self.factory.CreatePlacemark()
+-
+- def testDefault(self):
+- assert kmldom.AsObject(self.placemark)
+- assert kmldom.AsFeature(self.placemark)
+- assert kmldom.AsPlacemark(self.placemark)
+- assert not self.placemark.has_id() # Object-ness
+- assert not self.placemark.has_name() # Feature-ness
+- assert not self.placemark.has_geometry() # Placemark-ness
+-
+- def testName(self):
+- name = 'This is my name'
+- self.placemark.set_name(name)
+- assert self.placemark.has_name()
+- assert name == self.placemark.get_name()
+- self.placemark.clear_name()
+- assert not self.placemark.has_name()
+-
+-
+-class SimpleLatLonBoxTestCase(unittest.TestCase):
+- """ This tests the LatLonBox element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.latlonbox = self.factory.CreateLatLonBox()
+-
+- def testDefault(self):
+- assert kmldom.AsObject(self.latlonbox)
+- assert kmldom.AsLatLonBox(self.latlonbox)
+- assert not self.latlonbox.has_id() # Object-ness
+- assert not self.latlonbox.has_north()
+- assert 180.0 == self.latlonbox.get_north()
+- assert not self.latlonbox.has_south()
+- assert -180.0 == self.latlonbox.get_south()
+- assert not self.latlonbox.has_east()
+- assert 180.0 == self.latlonbox.get_east()
+- assert not self.latlonbox.has_west()
+- assert -180.0 == self.latlonbox.get_west()
+-
+- def testSetClear(self):
+- north = 42.42
+- south = -11.12
+- east = -80.80
+- west = -123.321
+- self.latlonbox.set_north(north)
+- self.latlonbox.set_south(south)
+- self.latlonbox.set_east(east)
+- self.latlonbox.set_west(west)
+- assert self.latlonbox.has_north()
+- assert north == self.latlonbox.get_north()
+- assert self.latlonbox.has_south()
+- assert south == self.latlonbox.get_south()
+- assert self.latlonbox.has_east()
+- assert east == self.latlonbox.get_east()
+- assert self.latlonbox.has_west()
+- assert west == self.latlonbox.get_west()
+- self.latlonbox.clear_north()
+- self.latlonbox.clear_south()
+- self.latlonbox.clear_east()
+- self.latlonbox.clear_west()
+- # Clearing everything returns to default state
+- self.testDefault()
+-
+-
+-class SimpleLinkTestCase(unittest.TestCase):
+- """ This tests the Link element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.link = self.factory.CreateLink()
+-
+- def testDefault(self):
+- assert kmldom.AsObject(self.link)
+- assert kmldom.AsLink(self.link)
+- assert not self.link.has_id() # Object-ness
+- assert not self.link.has_href() # Link-ness
+-
+- def testSetClear(self):
+- href = 'http://example.com/cool.kml'
+- self.link.set_href(href)
+- assert self.link.has_href()
+- assert href == self.link.get_href()
+- self.link.clear_href()
+- # Clearing everything returns to default state
+- self.testDefault()
+-
+-
+-class SimpleChangeTestCase(unittest.TestCase):
+- """ This tests the Change element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.change = self.factory.CreateChange()
+-
+- def testDefault(self):
+- assert kmldom.AsChange(self.change)
+- assert 0 == self.change.get_object_array_size()
+-
+- def testAddOneObject(self):
+- placemark = self.factory.CreatePlacemark()
+- name = 'hi'
+- placemark.set_name(name)
+- self.change.add_object(placemark)
+- assert 1 == self.change.get_object_array_size()
+- placemark = kmldom.AsPlacemark(self.change.get_object_array_at(0))
+- assert name == placemark.get_name()
+-
+- def testAddNObjects(self):
+- placemark = self.factory.CreatePlacemark()
+- placemark_id = 'pm123'
+- placemark.set_id(placemark_id)
+- self.change.add_object(placemark)
+-
+- latlonbox = self.factory.CreateLatLonBox()
+- latlonbox_id = 'llb123'
+- latlonbox.set_id(latlonbox_id)
+- self.change.add_object(latlonbox)
+-
+- location = self.factory.CreateLocation()
+- location_id = 'location123'
+- location.set_id(location_id)
+- self.change.add_object(location)
+-
+- """ Verify there are 3 items in the array in the proper order."""
+- assert 3 == self.change.get_object_array_size()
+- assert placemark_id == self.change.get_object_array_at(0).get_id()
+- assert latlonbox_id == self.change.get_object_array_at(1).get_id()
+- assert location_id == self.change.get_object_array_at(2).get_id()
+-
+-
+-class SimpleCreateTestCase(unittest.TestCase):
+- """ This tests the Create element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.create = self.factory.CreateCreate()
+-
+- def testDefault(self):
+- assert kmldom.AsCreate(self.create)
+- assert 0 == self.create.get_container_array_size()
+-
+- def testAddOneContainer(self):
+- folder = self.factory.CreateFolder()
+- target_folder_id = 'target-folder'
+- folder.set_targetid(target_folder_id)
+- self.create.add_container(folder)
+- assert 1 == self.create.get_container_array_size()
+- folder = kmldom.AsFolder(self.create.get_container_array_at(0))
+- assert target_folder_id == folder.get_targetid()
+-
+- def testAddNContainers(self):
+- folder = self.factory.CreateFolder()
+- folder_a_id = 'folder-a'
+- folder.set_id(folder_a_id)
+- self.create.add_container(folder)
+-
+- document = self.factory.CreateFolder()
+- document_a_id = 'container-a'
+- document.set_id(document_a_id)
+- self.create.add_container(document)
+-
+- document = self.factory.CreateFolder()
+- document_b_id = 'container-b'
+- document.set_id(document_b_id)
+- self.create.add_container(document)
+-
+- folder = self.factory.CreateFolder()
+- folder_b_id = 'folder-b'
+- folder.set_id(folder_b_id)
+- self.create.add_container(folder)
+-
+- # Verify there are 4 items in the array in the proper order.
+- assert 4 == self.create.get_container_array_size()
+- assert folder_a_id == self.create.get_container_array_at(0).get_id()
+- assert document_a_id == self.create.get_container_array_at(1).get_id()
+- assert document_b_id == self.create.get_container_array_at(2).get_id()
+- assert folder_b_id == self.create.get_container_array_at(3).get_id()
+-
+-
+-class SimpleDeleteTestCase(unittest.TestCase):
+- """ This tests the Delete element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.delete = self.factory.CreateDelete()
+-
+- def testDefault(self):
+- assert kmldom.AsDelete(self.delete)
+- assert 0 == self.delete.get_feature_array_size()
+-
+- def testAddOneFeature(self):
+- groundoverlay = self.factory.CreateGroundOverlay()
+- target_groundoverlay_id = 'target-groundoverlay'
+- groundoverlay.set_targetid(target_groundoverlay_id)
+- self.delete.add_feature(groundoverlay)
+- assert 1 == self.delete.get_feature_array_size()
+- groundoverlay = kmldom.AsGroundOverlay(self.delete.get_feature_array_at(0))
+- assert target_groundoverlay_id == groundoverlay.get_targetid()
+-
+- def testAddNFeatures(self):
+- document = self.factory.CreateDocument()
+- document_id = 'document-id'
+- document.set_id(document_id)
+- self.delete.add_feature(document)
+-
+- folder = self.factory.CreateFolder()
+- folder_id = 'folder-id'
+- folder.set_id(folder_id)
+- self.delete.add_feature(folder)
+-
+- groundoverlay = self.factory.CreateGroundOverlay()
+- groundoverlay_id = 'groundoverlay-id'
+- groundoverlay.set_id(groundoverlay_id)
+- self.delete.add_feature(groundoverlay)
+-
+- networklink = self.factory.CreateNetworkLink()
+- networklink_id = 'networklink-id'
+- networklink.set_id(networklink_id)
+- self.delete.add_feature(networklink)
+-
+- placemark = self.factory.CreatePlacemark()
+- placemark_id = 'placemark-id'
+- placemark.set_id(placemark_id)
+- self.delete.add_feature(placemark)
+-
+- photooverlay = self.factory.CreatePhotoOverlay()
+- photooverlay_id = 'photooverlay-id'
+- photooverlay.set_id(photooverlay_id)
+- self.delete.add_feature(photooverlay)
+-
+- screenoverlay = self.factory.CreateScreenOverlay()
+- screenoverlay_id = 'screenoverlay-id'
+- screenoverlay.set_id(screenoverlay_id)
+- self.delete.add_feature(screenoverlay)
+-
+- # Verify there are 7 items in the array in the proper order.
+- assert 7 == self.delete.get_feature_array_size()
+- assert document_id == self.delete.get_feature_array_at(0).get_id()
+- assert folder_id == self.delete.get_feature_array_at(1).get_id()
+- assert groundoverlay_id == self.delete.get_feature_array_at(2).get_id()
+- assert networklink_id == self.delete.get_feature_array_at(3).get_id()
+- assert placemark_id == self.delete.get_feature_array_at(4).get_id()
+- assert photooverlay_id == self.delete.get_feature_array_at(5).get_id()
+- assert screenoverlay_id == self.delete.get_feature_array_at(6).get_id()
+-
+-
+-class SimpleDocumentTestCase(unittest.TestCase):
+- """ This tests the Document element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.document = self.factory.CreateDocument()
+-
+- def testDefault(self):
+- assert kmldom.AsObject(self.document)
+- assert kmldom.AsFeature(self.document)
+- assert kmldom.AsContainer(self.document)
+- assert kmldom.AsDocument(self.document)
+- assert not self.document.has_id() # Object-ness
+- assert not self.document.has_name() # Feature-ness
+- assert 0 == self.document.get_feature_array_size() # Container-ness
+- assert 0 == self.document.get_schema_array_size() # Document-ness
+- assert 0 == self.document.get_styleselector_array_size() # Document-ness
+-
+-
+-class SimpleMultiGeometryTestCase(unittest.TestCase):
+- """ This tests the MultiGeometry element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.multigeometry = self.factory.CreateMultiGeometry()
+-
+- def testDefault(self):
+- assert kmldom.AsObject(self.multigeometry)
+- assert kmldom.AsGeometry(self.multigeometry)
+- assert kmldom.AsMultiGeometry(self.multigeometry)
+- assert not self.multigeometry.has_id() # Object-ness
+- # MultiGeometry-ness
+- assert 0 == self.multigeometry.get_geometry_array_size()
+-
+-
+-class SimpleOuterBoundaryIsTestCase(unittest.TestCase):
+- """ TODO: This tests the OuterBoundaryIs element."""
+-
+-
+-class SimpleInnerBoundaryIsTestCase(unittest.TestCase):
+- """ TODO: This tests the InnerBoundaryIs element."""
+-
+-
+-class SimplePolygonTestCase(unittest.TestCase):
+- """ TODO: This tests the Polygon element."""
+-
+-class SimplePolyStyleTestCase(unittest.TestCase):
+- """ This tests the PolyStyle element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.polystyle = self.factory.CreatePolyStyle()
+-
+- def testDefault(self):
+- assert kmldom.AsObject(self.polystyle)
+- assert kmldom.AsSubStyle(self.polystyle)
+- assert kmldom.AsColorStyle(self.polystyle)
+-
+- TestColorStyle(self.polystyle)
+-
+- # PolyStyle fields
+- # Verify default state of <fill>
+- assert not self.polystyle.has_fill()
+- # Set <fill> and verify get_ and has_
+- fill = True
+- self.polystyle.set_fill(fill)
+- assert self.polystyle.has_fill()
+- assert fill == self.polystyle.get_fill()
+- # Clear <fill> and verify has_
+- self.polystyle.clear_fill()
+- assert not self.polystyle.has_fill()
+-
+- # Verify default state of <outline>
+- assert not self.polystyle.has_outline()
+- # Set <outline> and verify get_ and has_
+- outline = True
+- self.polystyle.set_outline(outline)
+- assert self.polystyle.has_outline()
+- assert outline == self.polystyle.get_outline()
+- # Clear <outline> and verify has_
+- self.polystyle.clear_outline()
+- assert not self.polystyle.has_outline()
+-
+-class SimpleResourceMapTestCase(unittest.TestCase):
+- """ This tests the ResourceMap element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.resourcemap = self.factory.CreateResourceMap()
+-
+- def testDefault(self):
+- assert kmldom.AsObject(self.resourcemap)
+- assert kmldom.AsResourceMap(self.resourcemap)
+- assert not self.resourcemap.has_id()
+- assert 0 == self.resourcemap.get_alias_array_size()
+-
+-
+-class SimpleSchemaTestCase(unittest.TestCase):
+- """ This tests the Schema element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.schema = self.factory.CreateSchema()
+-
+- def testDefault(self):
+- assert kmldom.AsSchema(self.schema)
+- assert not self.schema.has_name()
+- assert not self.schema.has_id()
+- assert 0 == self.schema.get_simplefield_array_size()
+-
+-
+-class SimpleSchemaDataTestCase(unittest.TestCase):
+- """ This tests the SchemaData element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.schemadata = self.factory.CreateSchemaData()
+-
+- def testDefault(self):
+- assert kmldom.AsObject(self.schemadata)
+- assert kmldom.AsSchemaData(self.schemadata)
+- assert not self.schemadata.has_schemaurl()
+- assert "" == self.schemadata.get_schemaurl()
+- assert not self.schemadata.has_id()
+- assert 0 == self.schemadata.get_simpledata_array_size()
+-
+-
+-class SimpleSimpleFieldTestCase(unittest.TestCase):
+- """ This tests the SimpleField element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.simplefield = self.factory.CreateSimpleField()
+-
+- def testDefault(self):
+- assert kmldom.AsSimpleField(self.simplefield)
+- assert not self.simplefield.has_type()
+- assert not self.simplefield.has_name()
+- assert not self.simplefield.has_displayname()
+-
+-
+-class SimpleStyleMapTestCase(unittest.TestCase):
+- """ TODO: This tests the StyleMap element."""
+-
+-
+-class SimpleUpdateTestCase(unittest.TestCase):
+- """ This tests the Update element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.update = self.factory.CreateUpdate()
+-
+- def testDefault(self):
+- assert kmldom.AsUpdate(self.update)
+- assert 0 == self.update.get_updateoperation_array_size()
+-
+- def testTargetHref(self):
+- assert not self.update.has_targethref()
+- assert '' == self.update.get_targethref()
+- href = 'mycoolhref'
+- self.update.set_targethref(href)
+- assert self.update.has_targethref()
+- assert href == self.update.get_targethref()
+-
+-class SimpleStyleMapTestCase(unittest.TestCase):
+- """ TODO: This tests the StyleMap element."""
+-
+-class SimpleIconStyleIconTestCase(unittest.TestCase):
+- """ This tests the IconStyleIcon element."""
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.iconstyleicon= self.factory.CreateIconStyleIcon()
+-
+- def testBasic(self):
+- assert not self.iconstyleicon.has_href() # default state
+- assert '' == self.iconstyleicon.get_href()
+- href = 'http://blah.blah'
+- self.iconstyleicon.set_href(href)
+- assert self.iconstyleicon.has_href()
+- assert href == self.iconstyleicon.get_href()
+- self.iconstyleicon.clear_href()
+- assert not self.iconstyleicon.has_href() # back in default state
+- assert '' == self.iconstyleicon.get_href()
+-
+-class GxExtensionsTestCase(unittest.TestCase):
+- """ This tests the gx: elements extended by Google Earth 5.0
+- These are basic subsets of the full suite of tests in the main
+- C++ code and verify the basic operation of the API """
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+-
+- # Feature's gx:balloonVisibility.
+- def testGxBalloonVisibility(self):
+- placemark = self.factory.CreatePlacemark()
+- assert not placemark.has_gx_balloonvisibility()
+- assert False == placemark.get_gx_balloonvisibility()
+- placemark.set_gx_balloonvisibility(True)
+- assert placemark.has_gx_balloonvisibility()
+- assert True == placemark.get_gx_balloonvisibility()
+- expected = (
+- '<Placemark>\n'
+- ' <gx:balloonVisibility>1</gx:balloonVisibility>\n'
+- '</Placemark>\n')
+- assert expected == kmldom.SerializePretty(placemark)
+-
+- # <gx:TimeStamp> and <gx:TimeSpan> in AbstractView.
+- def testGxTimePrimitives(self):
+- lookat = self.factory.CreateLookAt()
+- assert not lookat.has_gx_timeprimitive()
+- assert None == lookat.get_gx_timeprimitive()
+- timespan = self.factory.CreateGxTimeSpan()
+- lookat.set_gx_timeprimitive(timespan)
+- assert lookat.has_gx_timeprimitive()
+- expected_lookat = (
+- '<LookAt>\n'
+- ' <gx:TimeSpan/>\n'
+- '</LookAt>\n')
+- assert expected_lookat == kmldom.SerializePretty(lookat)
+-
+- camera = self.factory.CreateCamera()
+- assert not camera.has_gx_timeprimitive()
+- assert None == camera.get_gx_timeprimitive()
+- timestamp = self.factory.CreateGxTimeStamp()
+- camera.set_gx_timeprimitive(timestamp)
+- assert camera.has_gx_timeprimitive()
+- expected_camera = (
+- '<Camera>\n'
+- ' <gx:TimeStamp/>\n'
+- '</Camera>\n')
+- assert expected_camera == kmldom.SerializePretty(camera)
+-
+- # <gx:altitudeMode>clampToSeaFloor|relativeToSeaFloor.
+- def testGxAltitudeModes(self):
+- llab = self.factory.CreateLatLonAltBox()
+- assert not llab.has_gx_altitudemode()
+- assert kmldom.GX_ALTITUDEMODE_CLAMPTOSEAFLOOR == llab.get_gx_altitudemode()
+- altmode_rel = kmldom.GX_ALTITUDEMODE_RELATIVETOSEAFLOOR
+- llab.set_gx_altitudemode(altmode_rel)
+- assert llab.has_gx_altitudemode()
+- assert altmode_rel == llab.get_gx_altitudemode()
+- expected = (
+- '<LatLonAltBox>\n'
+- ' <gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>\n'
+- '</LatLonAltBox>\n')
+- assert expected == kmldom.SerializePretty(llab)
+- # TODO: Camera, GroundOverlay, LineString, LineStyle, LinearRing, LookAt,
+- # Model, Point, Polygon.
+-
+- # <gx:LatLonQuad>
+- def testGxLatLonQuad(self):
+- groundoverlay = self.factory.CreateGroundOverlay()
+- assert False == groundoverlay.has_gx_latlonquad()
+- assert None == groundoverlay.get_gx_latlonquad()
+- llq = self.factory.CreateGxLatLonQuad()
+- coords = self.factory.CreateCoordinates()
+- llq.set_coordinates(coords)
+- groundoverlay.set_gx_latlonquad(llq)
+- assert True == groundoverlay.has_gx_latlonquad()
+- expected = (
+- '<GroundOverlay>\n'
+- ' <gx:LatLonQuad>\n'
+- ' <coordinates/>\n'
+- ' </gx:LatLonQuad>\n'
+- '</GroundOverlay>\n')
+- assert expected == kmldom.SerializePretty(groundoverlay)
+-
+- # <gx:Tour>
+- def testGxTour(self):
+- tour = self.factory.CreateGxTour()
+- assert not tour.has_gx_playlist()
+- assert None == tour.get_gx_playlist()
+- tour.set_gx_playlist(self.factory.CreateGxPlaylist())
+- assert tour.has_gx_playlist()
+-
+- # <gx:Playlist>
+- def testGxPlaylist(self):
+- playlist = self.factory.CreateGxPlaylist()
+- assert 0 == playlist.get_gx_tourprimitive_array_size()
+- playlist.add_gx_tourprimitive(self.factory.CreateGxFlyTo())
+- assert 1 == playlist.get_gx_tourprimitive_array_size()
+-
+- # <gx:AnimatedUpdate>
+- def testGxAnimatedUpdate(self):
+- animatedupdate = self.factory.CreateGxAnimatedUpdate()
+- assert False == animatedupdate.has_gx_duration()
+- assert 0.0 == animatedupdate.get_gx_duration()
+- animatedupdate.set_gx_duration(1.0)
+- assert animatedupdate.has_gx_duration()
+- assert 1.0 == animatedupdate.get_gx_duration()
+-
+- assert False == animatedupdate.has_update()
+- assert None == animatedupdate.get_update()
+- animatedupdate.set_update(self.factory.CreateUpdate())
+- assert animatedupdate.has_update()
+-
+- # <gx:FlyTo>
+- def testGxFlyTo(self):
+- flyto = self.factory.CreateGxFlyTo()
+- assert False == flyto.has_gx_duration()
+- assert 0.0 == flyto.get_gx_duration()
+- flyto.set_gx_duration(1.0)
+- assert flyto.has_gx_duration()
+- assert 1.0 == flyto.get_gx_duration()
+-
+- assert False == flyto.has_gx_flytomode()
+- assert kmldom.GX_FLYTOMODE_BOUNCE == flyto.get_gx_flytomode()
+- flyto.set_gx_flytomode(kmldom.GX_FLYTOMODE_SMOOTH)
+- assert flyto.has_gx_flytomode()
+- assert kmldom.GX_FLYTOMODE_SMOOTH == flyto.get_gx_flytomode()
+-
+- # <gx:Wait>
+- def testGxWait(self):
+- wait = self.factory.CreateGxWait()
+- assert False == wait.has_gx_duration()
+- assert 0.0 == wait.get_gx_duration()
+- wait.set_gx_duration(1.0)
+- assert wait.has_gx_duration()
+- assert 1.0 == wait.get_gx_duration()
+-
+- # <gx:SoundCue>
+- def testGxSoundCue(self):
+- soundcue = self.factory.CreateGxSoundCue()
+- assert False == soundcue.has_href()
+- assert '' == soundcue.get_href()
+- href = 'some href'
+- soundcue.set_href(href)
+- assert soundcue.has_href()
+- assert href == soundcue.get_href()
+-
+- # <gx:TourControl>
+- def testGxTourControl(self):
+- tourcontrol = self.factory.CreateGxTourControl()
+- assert False == tourcontrol.has_gx_playmode()
+- assert kmldom.GX_PLAYMODE_PAUSE == tourcontrol.get_gx_playmode()
+- tourcontrol.set_gx_playmode(kmldom.GX_PLAYMODE_PAUSE)
+- assert tourcontrol.has_gx_playmode()
+- assert kmldom.GX_PLAYMODE_PAUSE == tourcontrol.get_gx_playmode()
+-
+- # Parse and serialization of gx:Tour and friends.
+- def testGxTourParseSerialize(self):
+- kml = (
+- '<gx:Tour>'
+- '<gx:Playlist>'
+- '<gx:SoundCue><href>x</href></gx:SoundCue>'
+- '<gx:FlyTo>'
+- '<gx:duration>1.0</gx:duration>'
+- '</gx:FlyTo>'
+- '<gx:AnimatedUpdate>'
+- '<gx:duration>2.0</gx:duration>'
+- '<Update/>'
+- '</gx:AnimatedUpdate>'
+- '<gx:TourControl><gx:playMode>pause</gx:playMode></gx:TourControl>'
+- '<gx:Wait><gx:duration>3.0</gx:duration></gx:Wait>'
+- '</gx:Playlist>'
+- '</gx:Tour>')
+- assert kmldom.ParseKml(kml)
+- assert kmldom.AsGxTour(kmldom.ParseKml(kml))
+- tour = kmldom.AsGxTour(kmldom.ParseKml(kml))
+- assert tour.has_gx_playlist()
+- playlist = tour.get_gx_playlist()
+- assert 5 == playlist.get_gx_tourprimitive_array_size()
+- soundcue = kmldom.AsGxSoundCue(playlist.get_gx_tourprimitive_array_at(0))
+- assert soundcue
+- assert soundcue.has_href()
+- assert 'x' == soundcue.get_href()
+- flyto = kmldom.AsGxFlyTo(playlist.get_gx_tourprimitive_array_at(1))
+- assert flyto
+- assert flyto.has_gx_duration()
+- assert 1.0 == flyto.get_gx_duration()
+- au = kmldom.AsGxAnimatedUpdate(playlist.get_gx_tourprimitive_array_at(2))
+- assert au
+- assert au.has_gx_duration()
+- assert 2.0 == au.get_gx_duration()
+- assert au.has_update()
+- assert kmldom.AsUpdate(au.get_update())
+- tc = kmldom.AsGxTourControl(playlist.get_gx_tourprimitive_array_at(3))
+- assert tc
+- assert tc.has_gx_playmode()
+- assert kmldom.GX_PLAYMODE_PAUSE == tc.get_gx_playmode()
+- wait = kmldom.AsGxWait(playlist.get_gx_tourprimitive_array_at(4))
+- assert wait
+- assert wait.has_gx_duration()
+- assert 3.0 == wait.get_gx_duration()
+-
+-class ItemIconTestCase(unittest.TestCase):
+- """ This verifies the behavior of ItemIcon and its children """
+-
+- def setUp(self):
+- self.factory = kmldom.KmlFactory_GetFactory()
+- self.itemicon = self.factory.CreateItemIcon()
+-
+- def testDefaults(self):
+- assert not self.itemicon.has_state()
+- assert 1 == self.itemicon.get_state_array_size()
+- assert kmldom.ITEMICONSTATE_OPEN == self.itemicon.get_state_array_at(0)
+- assert not self.itemicon.has_href()
+- assert "" == self.itemicon.get_href()
+-
+- def testState(self):
+- state_open = kmldom.ITEMICONSTATE_OPEN
+- state_error = kmldom.ITEMICONSTATE_ERROR
+- state_fetching0 = kmldom.ITEMICONSTATE_FETCHING0
+-
+- self.itemicon.clear_state()
+- assert 0 == self.itemicon.get_state_array_size()
+- self.itemicon.add_state(state_error)
+- assert 1 == self.itemicon.get_state_array_size()
+- assert state_error == self.itemicon.get_state_array_at(0)
+- self.itemicon.add_state(state_fetching0)
+- assert 2 == self.itemicon.get_state_array_size()
+- assert state_fetching0 == self.itemicon.get_state_array_at(1)
+-
+-
+-def suite():
+- suite = unittest.TestSuite()
+- suite.addTest(VerySimpleParseTestCase())
+- suite.addTest(VerySimpleSerializeTestCase())
+- suite.addTest(SimpleFactoryTestCase())
+- suite.addTest(FactoryCreateElementByIdTestCase())
+- suite.addTest(VerySimpleCastTestCase())
+- suite.addTest(VerySimpleSimpleChildTestCase())
+- suite.addTest(VerySimpleComplexChildTestCase())
+- suite.addTest(SimpleAtomAuthorTestCase('testDefault'))
+- suite.addTest(SimpleAtomAuthorTestCase('testSetClear'))
+- suite.addTest(SimpleAtomLinkTestCase('testDefault'))
+- suite.addTest(SimpleAtomLinkTestCase('testSetClear'))
+- suite.addTest(SimpleCoordinatesTestCase())
+- suite.addTest(SimpleVec2TestCase())
+- suite.addTest(SimpleObjectTestCase())
+- suite.addTest(SimpleFeatureTestCase())
+- suite.addTest(SimpleFeatureTestCase('testParseAtom'))
+- suite.addTest(SimpleRegionTestCase())
+- suite.addTest(SimpleParseTestCase('testBasic'))
+- suite.addTest(SimpleSerializePrettyTestCase('testBasic'))
+- suite.addTest(SimpleSerializeRawTestCase('testBasic'))
+- suite.addTest(SimpleExtendedDataTestCase('testDefault'))
+- suite.addTest(DataTestCase('testDefault'))
+- suite.addTest(SimpleDataTestCase('testDefault'))
+- suite.addTest(SimpleIconStyleTestCase('testDefault'))
+- suite.addTest(SimpleKmlTestCase('testDefault'))
+- suite.addTest(SimpleKmlTestCase('testSetClear'))
+- suite.addTest(SimpleNetworkLinkControlTestCase('testDefault'))
+- suite.addTest(SimpleNetworkLinkControlTestCase('testSetClear'))
+- suite.addTest(SimpleLabelStyleTestCase('testDefault'))
+- suite.addTest(SimpleLineStyleTestCase('testDefault'))
+- suite.addTest(SimpleListStyleTestCase('testDefault'))
+- suite.addTest(SimplePhotoOverlayTestCase('testDefault'))
+- suite.addTest(SimplePlacemarkTestCase('testDefault'))
+- suite.addTest(SimplePlacemarkTestCase('testName'))
+- suite.addTest(SimplePolyStyleTestCase('testDefault'))
+- suite.addTest(SimpleLatLonBoxTestCase('testDefault'))
+- suite.addTest(SimpleLatLonBoxTestCase('testSetClear'))
+- suite.addTest(SimpleLinkTestCase('testDefault'))
+- suite.addTest(SimpleLinkTestCase('testSetClear'))
+- suite.addTest(SimpleChangeTestCase('testDefault'))
+- suite.addTest(SimpleChangeTestCase('testAddOneObject'))
+- suite.addTest(SimpleChangeTestCase('testAddNObjects'))
+- suite.addTest(SimpleCreateTestCase('testDefault'))
+- suite.addTest(SimpleCreateTestCase('testAddOneContainer'))
+- suite.addTest(SimpleCreateTestCase('testAddNContainers'))
+- suite.addTest(SimpleDeleteTestCase('testAddOneFeature'))
+- suite.addTest(SimpleDeleteTestCase('testAddNFeatures'))
+- suite.addTest(SimpleDocumentTestCase('testDefault'))
+- suite.addTest(SimpleResourceMapTestCase('testDefault'))
+- suite.addTest(SimpleMultiGeometryTestCase('testDefault'))
+- suite.addTest(SimpleSchemaTestCase('testDefault'))
+- suite.addTest(SimpleSchemaDataTestCase('testDefault'))
+- suite.addTest(SimpleSimpleFieldTestCase('testDefault'))
+- suite.addTest(SimpleUpdateTestCase('testDefault'))
+- suite.addTest(SimpleUpdateTestCase('testTargetHref'))
+- suite.addTest(SimpleIconStyleIconTestCase('testBasic'))
+- suite.addTest(GxExtensionsTestCase('testGxBalloonVisibility'))
+- suite.addTest(GxExtensionsTestCase('testGxTimePrimitives'))
+- suite.addTest(GxExtensionsTestCase('testGxAltitudeModes'))
+- suite.addTest(GxExtensionsTestCase('testGxLatLonQuad'))
+- suite.addTest(GxExtensionsTestCase('testGxTour'))
+- suite.addTest(GxExtensionsTestCase('testGxPlaylist'))
+- suite.addTest(GxExtensionsTestCase('testGxAnimatedUpdate'))
+- suite.addTest(GxExtensionsTestCase('testGxFlyTo'))
+- suite.addTest(GxExtensionsTestCase('testGxWait'))
+- suite.addTest(GxExtensionsTestCase('testGxSoundCue'))
+- suite.addTest(GxExtensionsTestCase('testGxTourControl'))
+- suite.addTest(GxExtensionsTestCase('testGxTourParseSerialize'))
+- suite.addTest(ItemIconTestCase('testDefaults'))
+- suite.addTest(ItemIconTestCase('testState'))
+- return suite
+-
+-
+-runner = unittest.TextTestRunner()
+-runner.run(suite())
+--- a/src/swig/kmlengine_test.py
++++ /dev/null
+@@ -1,283 +0,0 @@
+-#!/usr/bin/env python
+-
+-# Copyright 2008, Google Inc. All rights reserved.
+-#
+-# Redistribution and use in source and binary forms, with or without
+-# modification, are permitted provided that the following conditions are met:
+-#
+-# 1. Redistributions of source code must retain the above copyright notice,
+-# this list of conditions and the following disclaimer.
+-# 2. Redistributions in binary form must reproduce the above copyright notice,
+-# this list of conditions and the following disclaimer in the documentation
+-# and/or other materials provided with the distribution.
+-# 3. Neither the name of Google Inc. nor the names of its contributors may be
+-# used to endorse or promote products derived from this software without
+-# specific prior written permission.
+-#
+-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+-# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-
+-"""
+-This file contains unit tests for the KML Engine Python SWIG bindings.
+-"""
+-
+-import unittest
+-import kmldom
+-import kmlengine
+-
+-# These VerySimple tests really only verify that the function/class exists.
+-
+-class VerySimpleKmlDomTestCase(unittest.TestCase):
+- """ Verify very simple KML DOM usage """
+- def runTest(self):
+- factory = kmldom.KmlFactory_GetFactory()
+- placemark = factory.CreatePlacemark()
+- name = 'hi'
+- placemark.set_name(name)
+- assert name == placemark.get_name()
+-
+-class VerySimpleBboxTestCase(unittest.TestCase):
+- """ Verify very simple usage of class Bbox """
+- def runTest(self):
+- bbox = kmlengine.Bbox(38, 36, -120, -122)
+- assert bbox.Contains(37, -121)
+-
+-class AllMethodsBboxTestCase(unittest.TestCase):
+- """ Verify basic usage of each method of kmlengine.Bbox """
+- def runTest(self):
+- bbox = kmlengine.Bbox()
+- assert -180.0 == bbox.get_north()
+- assert 180.0 == bbox.get_south()
+- assert -180.0 == bbox.get_east()
+- assert 180.0 == bbox.get_west()
+-
+- bbox_a = kmlengine.Bbox(10.1, -11.2, 99.99, -88.88)
+- bbox.ExpandFromBbox(bbox_a)
+- assert 10.1 == bbox.get_north()
+- assert -11.2 == bbox.get_south()
+- assert 99.99 == bbox.get_east()
+- assert -88.88 == bbox.get_west()
+-
+- bbox.ExpandLatitude(20.2)
+- assert 20.2 == bbox.get_north()
+- assert -11.2 == bbox.get_south()
+- bbox.ExpandLatitude(-20.2)
+- assert 20.2 == bbox.get_north()
+- assert -20.2 == bbox.get_south()
+- bbox.ExpandLongitude(101.101)
+- assert 101.101 == bbox.get_east()
+- assert -88.88 == bbox.get_west()
+- bbox.ExpandLongitude(-101.101)
+- assert 101.101 == bbox.get_east()
+- assert -101.101 == bbox.get_west()
+-
+- bbox.ExpandLatLon(30.3, -111.222);
+- assert 30.3 == bbox.get_north()
+- assert -20.2 == bbox.get_south()
+- assert 101.101 == bbox.get_east()
+- assert -111.222 == bbox.get_west()
+-
+-class VerySimpleCloneTestCase(unittest.TestCase):
+- """ Verify very simple usage of Clone() """
+- def runTest(self):
+- factory = kmldom.KmlFactory_GetFactory()
+- placemark = factory.CreatePlacemark()
+- name = 'hi'
+- placemark.set_name(name)
+- clone_element = kmlengine.Clone(placemark)
+- assert clone_element
+- clone_placemark = kmldom.AsPlacemark(clone_element)
+- assert clone_placemark
+- assert name == clone_placemark.get_name()
+- # Change the name in the original
+- new_name = 'new name'
+- placemark.set_name(new_name)
+- # Verify that the clone still has the old name
+- assert name == clone_placemark.get_name()
+-
+-class VerySimpleGetFeatureLatLonTestCase(unittest.TestCase):
+- def runTest(self):
+- kml = '<Placemark>' \
+- '<Point><coordinates>1,2,3</coordinates></Point>' \
+- '</Placemark>'
+- element = kmldom.ParseKml(kml)
+- assert element
+- feature = kmldom.AsFeature(element)
+- assert feature
+- status,lat,lon = kmlengine.GetFeatureLatLon(feature)
+- assert True == status
+- assert 1 == lon
+- assert 2 == lat
+-
+-class VerySimpleGetFeatureBoundsTestCase(unittest.TestCase):
+- def runTest(self):
+- kml = '<Placemark>' \
+- '<LineString><coordinates>1,2 -1,-2</coordinates></LineString>' \
+- '</Placemark>'
+- element = kmldom.ParseKml(kml)
+- assert element
+- feature = kmldom.AsFeature(element)
+- assert feature
+- bbox = kmlengine.Bbox()
+- status = kmlengine.GetFeatureBounds(feature, bbox)
+- assert status
+- assert 2 == bbox.get_north()
+- assert -2 == bbox.get_south()
+- assert 1 == bbox.get_east()
+- assert -1 == bbox.get_west()
+-
+-class VerySimpleGetRootFeatureTestCase(unittest.TestCase):
+- """ Verify very simple usage of GetRootFeature() """
+- def runTest(self):
+- factory = kmldom.KmlFactory_GetFactory()
+- placemark = factory.CreatePlacemark()
+- feature = kmlengine.GetRootFeature(placemark)
+- assert feature
+- assert kmldom.AsPlacemark(feature)
+-
+-class VerySimpleKmzSplitTestCase(unittest.TestCase):
+- def runTest(self):
+- kml_url = 'http://foo.com/goo.kmz/bar.jpg'
+- status,kmz_url,kmz_path = kmlengine.KmzSplit(kml_url)
+- assert True == status
+- assert 'http://foo.com/goo.kmz' == kmz_url
+- assert 'bar.jpg' == kmz_path
+-
+-class VerySimpleSplitUriTestCase(unittest.TestCase):
+- def runTest(self):
+- status,scheme,host,port,path,query,fragment = \
+- kmlengine.SplitUri('http://host.com:82/a/b/c.kml?p=q#id')
+- assert True == status
+- assert 'http' == scheme
+- assert 'host.com' == host
+- assert 'a/b/c.kml' == path
+- assert 'p=q' == query
+- assert 'id' == fragment
+-
+-class BasicKmlFileCreateFromParseTestCase(unittest.TestCase):
+- """ Verify very simple usage of the KmlFile::CreateFromParse() method """
+- def runTest(self):
+- id = 'pm123'
+- kml = '<Placemark id="%s"><name>hello</name></Placemark>' % id
+- kmlfile,errors = kmlengine.KmlFile.CreateFromParse(kml)
+- assert kmlfile
+- object = kmlfile.GetObjectById(id)
+- assert object
+- placemark = kmldom.AsPlacemark(object)
+- assert placemark
+- assert placemark.has_id()
+- assert id == placemark.get_id()
+-
+-class KmlFileCreateFromParseOfBasicElementTestCase(unittest.TestCase):
+- def runTest(self):
+- kmlfile,errors = kmlengine.KmlFile.CreateFromParse('<kml/>')
+- assert kmlfile
+- root = kmlfile.get_root()
+- assert kmldom.Type_kml == root.Type()
+-
+-class BasicKmlFileCreateFromImportTestCase(unittest.TestCase):
+- def runTest(self):
+- factory = kmldom.KmlFactory_GetFactory()
+- placemark = factory.CreatePlacemark()
+- id = 'placemark123'
+- name = 'some name'
+- placemark.set_id(id)
+- placemark.set_name(name)
+- folder = factory.CreateFolder()
+- folder.add_feature(placemark)
+- kmlfile = kmlengine.KmlFile.CreateFromImport(folder)
+- assert kmlfile
+- object = kmlfile.GetObjectById(id)
+- assert object
+- placemark = kmldom.AsPlacemark(object)
+- assert placemark
+- assert placemark.has_id()
+- assert id == placemark.get_id()
+- assert placemark.has_name()
+- assert name == placemark.get_name()
+-
+-class KmlFileCreateFromImportOfBasicElementTestCase(unittest.TestCase):
+- def runTest(self):
+- factory = kmldom.KmlFactory_GetFactory()
+- # TODO: This crashes CreateFromImport as do all non-Object complex elements
+- # kml = factory.CreateKml()
+- # This returns an ElementPtr for the given element and works fine in
+- # CreateFromImport:
+- kml_as_element = factory.CreateElementById(kmldom.Type_kml)
+- kml = kmldom.AsKml(kml_as_element)
+- kml.set_feature(factory.CreatePlacemark())
+- kmlfile = kmlengine.KmlFile.CreateFromImport(kml_as_element)
+- assert kmlfile
+- root = kmlfile.get_root()
+- assert root
+- kml = kmldom.AsKml(root)
+- assert kml
+- assert kml.has_feature()
+- placemark = kmldom.AsPlacemark(kml.get_feature())
+- assert placemark
+-
+-class BasicKmlFileSerializeToStringTestCase(unittest.TestCase):
+- def runTest(self):
+- factory = kmldom.KmlFactory_GetFactory()
+- kml = factory.CreateElementById(kmldom.Type_kml)
+- assert kml
+- kmlfile = kmlengine.KmlFile.CreateFromImport(kml)
+- assert kmlfile
+- (ok, xml) = kmlfile.SerializeToString()
+- assert ok
+- kExpectedXml = '<?xml version="1.0" encoding="utf-8"?>\n' \
+- '<kml xmlns="http://www.opengis.net/kml/2.2"/>\n'
+- assert kExpectedXml == xml
+-
+-class BasicKmzFileTestCase(unittest.TestCase):
+- def runTest(self):
+- kmz_filepath = '../../testdata/kmz/model-macky.kmz'
+- kmzfile = kmlengine.KmzFile.OpenFromFile(kmz_filepath)
+- assert kmzfile
+- (ok, kml) = kmzfile.ReadKml()
+- assert ok
+- (kmlfile,errors) = kmlengine.KmlFile.CreateFromParse(kml)
+- assert kmlfile
+- root = kmldom.AsKml(kmlfile.get_root())
+- assert root
+- placemark = kmldom.AsPlacemark(root.get_feature())
+- assert placemark
+- assert 'SketchUp Model of Macky Auditorium' == placemark.get_name()
+- assert placemark.has_geometry()
+- model = kmldom.AsModel(placemark.get_geometry())
+- assert model
+- assert 'model_4' == model.get_id()
+- (ok, dae) = kmzfile.ReadFile('geometry/CU-Macky.dae')
+- assert ok
+- assert 268477 == len(dae)
+-
+-def suite():
+- suite = unittest.TestSuite()
+- suite.addTest(VerySimpleKmlDomTestCase())
+- suite.addTest(VerySimpleBboxTestCase())
+- suite.addTest(AllMethodsBboxTestCase())
+- suite.addTest(VerySimpleCloneTestCase())
+- suite.addTest(VerySimpleGetRootFeatureTestCase())
+- suite.addTest(VerySimpleGetFeatureLatLonTestCase())
+- suite.addTest(VerySimpleGetFeatureBoundsTestCase())
+- suite.addTest(VerySimpleKmzSplitTestCase())
+- suite.addTest(VerySimpleSplitUriTestCase())
+- suite.addTest(KmlFileCreateFromParseOfBasicElementTestCase())
+- suite.addTest(BasicKmlFileCreateFromParseTestCase())
+- suite.addTest(BasicKmlFileCreateFromImportTestCase())
+- suite.addTest(KmlFileCreateFromImportOfBasicElementTestCase())
+- suite.addTest(BasicKmlFileSerializeToStringTestCase())
+- suite.addTest(BasicKmzFileTestCase())
+- return suite
+-
+-
+-runner = unittest.TextTestRunner()
+-runner.run(suite())
diff --git a/debian/python-kml.install b/debian/python-kml.install
new file mode 100644
index 0000000..5fda4d4
--- /dev/null
+++ b/debian/python-kml.install
@@ -0,0 +1 @@
+usr/lib/python2*/*-packages
diff --git a/debian/rules b/debian/rules
index 55d8063..e13b795 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,7 +7,7 @@ DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
UPSTREAM_VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(.*\)-.*/\1/p' | sed -e 's/\+.*//; s/^[0-9]://')
%:
- dh $@ --with pkgkde_symbolshelper --parallel
+ dh $@ --with python2,pkgkde_symbolshelper --parallel
override_dh_auto_configure:
dh_auto_configure -- \
@@ -15,9 +15,9 @@ override_dh_auto_configure:
-DBUILD_TESTING=OFF \
-DBUILD_EXAMPLES=OFF \
-DINSTALL_EXAMPLES=OFF \
- -DBUILD_SWIG=OFF \
- -DBUILD_SWIG_PYTHON=OFF \
- -DBUILD_SWIG_JAVA=OFF \
+ -DWITH_SWIG=ON \
+ -DWITH_PYTHON=ON \
+ -DWITH_JAVA=ON \
override_dh_auto_install:
dh_auto_install
@@ -29,7 +29,10 @@ override_dh_install:
dh_install --autodest --list-missing
override_dh_makeshlibs:
- dh_makeshlibs -- -c0 -v$(UPSTREAM_VERSION)
+ dh_makeshlibs -Xpython-kml -- -c0 -v$(UPSTREAM_VERSION)
+
+override_dh_python:
+ dh_python2 -ppython-kml
get-orig-source:
. debian/get-orig-source
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/libkml.git
More information about the Pkg-grass-devel
mailing list