LCOV - code coverage report
Current view: top level - ogr/ogrsf_frmts/kml - kmlnode.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 2 2 100.0 %
Date: 2024-11-21 22:18:42 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  * $Id$
       3             :  *
       4             :  * Project:  KML Driver
       5             :  * Purpose:  Class for building up the node structure of the kml file.
       6             :  * Author:   Jens Oberender, j.obi@troja.net
       7             :  *
       8             :  ******************************************************************************
       9             :  * Copyright (c) 2007, Jens Oberender
      10             :  * Copyright (c) 2009-2012, Even Rouault <even dot rouault at spatialys.com>
      11             :  *
      12             :  * SPDX-License-Identifier: MIT
      13             :  ****************************************************************************/
      14             : #ifndef OGR_KMLNODE_H_INCLUDED
      15             : #define OGR_KMLNODE_H_INCLUDED
      16             : 
      17             : #ifdef HAVE_EXPAT
      18             : 
      19             : #include "kml.h"
      20             : #include "kmlutility.h"
      21             : // std
      22             : #include <iostream>
      23             : #include <string>
      24             : #include <vector>
      25             : 
      26             : std::string Nodetype2String(Nodetype const &type);
      27             : 
      28             : class KMLNode
      29             : {
      30             :     CPL_DISALLOW_COPY_ASSIGN(KMLNode)
      31             :   public:
      32             :     KMLNode();
      33             :     ~KMLNode();
      34             : 
      35             :     void print(unsigned int what = 3);
      36             :     int classify(KML *poKML, int nRecLevel = 0);
      37             :     void eliminateEmpty(KML *poKML);
      38             :     bool hasOnlyEmpty() const;
      39             : 
      40             :     void setType(Nodetype type);
      41             :     Nodetype getType() const;
      42             : 
      43             :     void setName(std::string const &name);
      44             :     const std::string &getName() const;
      45             : 
      46             :     void setLevel(std::size_t level);
      47             :     std::size_t getLevel() const;
      48             : 
      49             :     void addAttribute(Attribute *poAttr);
      50             : 
      51             :     void setParent(KMLNode *poNode);
      52             :     KMLNode *getParent() const;
      53             : 
      54             :     void addChildren(KMLNode *poNode);
      55             :     std::size_t countChildren() const;
      56             : 
      57             :     KMLNode *getChild(std::size_t index) const;
      58             : 
      59             :     void addContent(std::string const &text);
      60             :     void appendContent(std::string const &text);
      61             :     std::string getContent(std::size_t index) const;
      62             :     void deleteContent(std::size_t index);
      63             :     std::size_t numContent() const;
      64             : 
      65             :     void setLayerNumber(int nNum);
      66             :     int getLayerNumber() const;
      67             : 
      68             :     std::string getNameElement() const;
      69             :     std::string getDescriptionElement() const;
      70             : 
      71             :     std::size_t getNumFeatures();
      72             :     Feature *getFeature(std::size_t nNum, int &nLastAsked, int &nLastCount);
      73             : 
      74             :     OGRGeometry *getGeometry(Nodetype eType = Unknown);
      75             : 
      76          74 :     bool is25D() const
      77             :     {
      78          74 :         return b25D_;
      79             :     }
      80             : 
      81             :   private:
      82             :     typedef std::vector<KMLNode *> kml_nodes_t;
      83             :     kml_nodes_t *pvpoChildren_;
      84             : 
      85             :     typedef std::vector<std::string> kml_content_t;
      86             :     kml_content_t *pvsContent_;
      87             : 
      88             :     typedef std::vector<Attribute *> kml_attributes_t;
      89             :     kml_attributes_t *pvoAttributes_;
      90             : 
      91             :     KMLNode *poParent_;
      92             :     std::size_t nLevel_;
      93             :     std::string sName_;
      94             : 
      95             :     Nodetype eType_;
      96             :     bool b25D_;
      97             : 
      98             :     int nLayerNumber_;
      99             :     int nNumFeatures_;
     100             : 
     101             :     void unregisterLayerIfMatchingThisNode(KML *poKML);
     102             : };
     103             : 
     104             : #endif  // HAVE_EXPAT
     105             : 
     106             : #endif /* KMLNODE_H_INCLUDED */

Generated by: LCOV version 1.14