/usr/include/citygml/polygon.h is in libcitygml-dev 2.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | #pragma once
#include <memory>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <citygml/citygml_api.h>
#include <citygml/appearancetarget.h>
#include <citygml/vecs.hpp>
#include <citygml/linearring.h>
#include <citygml/geometry.h>
class Tesselator;
namespace citygml {
class TextureCoordinates;
class CityGMLFactory;
class Texture;
class Material;
/**
* @brief The Polygon class implements the functionality of gml::Polygon and gml::SurfacePatch (gml::Rectangle, gml::Triangle) objects
*/
class LIBCITYGML_EXPORT Polygon : public AppearanceTarget
{
friend class CityGMLFactory;
public:
enum class AppearanceSide {
FRONT,
BACK
};
// Get the vertices
const std::vector<TVec3d>& getVertices() const;
std::vector<TVec3d>& getVertices();
// Get the indices
const std::vector<unsigned int>& getIndices() const;
/**
* @brief returns the material of this polygon for the given theme and side
* @param theme a name of an appearance theme
* @param front determines for which side the material should be returned (true = front side, false = backside)
* @return a Material object or nullptr if there is no material for the theme and side
*/
std::shared_ptr<const Material> getMaterialFor(const std::string& theme, bool front) const;
/**
* @brief returns the material of this polygon for the given theme. Prefers front side materials over back side materials
* @param theme a name of an appearance theme
* @return a Material object or nullptr if there is no material for the theme
*/
std::shared_ptr<const Material> getMaterialFor(const std::string& theme) const;
/**
* @brief returns the texture of this polygon for the given theme and side
* @param theme a name of an appearance theme
* @param front determines for which side the texture should be returned (true = front side, false = backside)
* @return a Texture object or nullptr if there is no texture for the theme and side
*/
std::shared_ptr<const Texture> getTextureFor(const std::string& theme, bool front) const;
/**
* @brief returns the texture of this polygon for the given theme. Prefers front side textures over back side textures
* @param theme a name of an appearance theme
* @return a Texture object or nullptr if there is no texture for the theme
*/
std::shared_ptr<const Texture> getTextureFor(const std::string& theme) const;
/**
* @brief returns the texture coordinates for the given theme and side
* @param theme a name of an appearance theme
* @param front determines for which side the texture coordinates should be returned (true = front side, false = backside)
* @return the texture coordinates or an empty list if there are no texture coordinates for this theme and side
*/
const std::vector<TVec2f> getTexCoordsForTheme(const std::string& theme, bool front) const;
bool negNormal() const;
void setNegNormal(bool negNormal);
void addRing( LinearRing* );
void finish(Tesselator& tesselator , bool optimize, std::shared_ptr<CityGMLLogger> logger);
virtual ~Polygon();
protected:
Polygon( const std::string& id, std::shared_ptr<CityGMLLogger> logger );
std::shared_ptr<const Texture> getTextureForTheme(const std::string& theme, bool front) const;
/**
* @brief fill the vertex array and creates a corresponding index array
* @param tesselate if true the tesselator will be used to tesselate the linear rings
* @param tesselator the Tesselator object
*/
void computeIndices(Tesselator& tesselator, std::shared_ptr<CityGMLLogger> logger);
void createSimpleIndices(std::shared_ptr<CityGMLLogger> logger);
void createIndicesWithTesselation(Tesselator& tesselator, std::shared_ptr<CityGMLLogger> logger);
void removeDuplicateVerticesInRings(std::shared_ptr<CityGMLLogger> logger);
std::vector<TVec2f> getTexCoordsForRingAndTheme(const LinearRing& ring, const std::string& theme, bool front);
std::vector<std::vector<TVec2f> > getTexCoordListsForRing(const LinearRing& ring, const std::vector<std::string>& themesFront, const std::vector<std::string>& themesBack);
TVec3d computeNormal();
std::vector<TVec3d> m_vertices;
std::unordered_map<std::string, std::vector<TVec2f>> m_themeToFrontTexCoordsMap;
std::unordered_map<std::string, std::vector<TVec2f>> m_themeToBackTexCoordsMap;
std::vector<unsigned int> m_indices;
std::unique_ptr<LinearRing> m_exteriorRing;
std::vector<std::unique_ptr<LinearRing>> m_interiorRings;
bool m_negNormal;
bool m_finished;
std::shared_ptr<CityGMLLogger> m_logger;
};
}
|