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: 2025-01-18 12:42:00 Functions: 1 1 100.0 %

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

Generated by: LCOV version 1.14