Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,19 @@ Le format est basé sur [Keep a Changelog](https://keepachangelog.com/) et ce pr
## [Unreleased]

### Added

- `Terrainrgb` : Ajout d'un style terrainrgb pour transformer les MNT en format Terrain RGB.
- `TerrainrgbImage` : Ajout du processus de traitement du style Terrainrgb.
- `Style` : Ajout d'une fonction permettant de savoir si une palette existe ou non.
- Ajout du traitement en cas de style terrainrgb. Il doit être l'unique style déclaré pour fonctionner.

### Changed
### Deprecated
### Removed
### Fixed

- `Style` : Vérification de l'existance d'un bloc palette dans le json de style avant la création d'un objet palette. Ce changement nécessite la vérification de l'existance d'une palette qui n'était pas vérifié avant.

### Security

## [2.0.6] - 2025-09-11
Expand Down
66 changes: 66 additions & 0 deletions include/rok4/image/TerrainrgbImage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright © (2011) Institut national de l'information
* géographique et forestière
*
* Géoportail SAV <contact.geoservices@ign.fr>
*
* This software is a computer program whose purpose is to publish geographic
* data using OGC WMS and WMTS protocol.
*
* This software is governed by the CeCILL-C license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL-C
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
* liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
*
* knowledge of the CeCILL-C license and that you accept its terms.
*/

/**
* \file TerrainrgbImage.h
** \~french
* \brief D�finition de la classe TerrainrgbImage
** \~english
* \brief Define class TerrainrgbImage
*/

#pragma once

#include "rok4/image/Image.h"
#include "rok4/style/Terrainrgb.h"

class TerrainrgbImage : public Image
{
private:
Image *source_image;
Terrainrgb *terrainrgb;

template <typename T>
int _getline(T *buffer, int line);

public:
virtual int get_line(float *buffer, int line);
virtual int get_line(uint16_t *buffer, int line);
virtual int get_line(uint8_t *buffer, int line);
TerrainrgbImage(Image *image, Terrainrgb *terrainrgb);
virtual ~TerrainrgbImage();
};
51 changes: 47 additions & 4 deletions include/rok4/style/Style.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class Style;
#include "rok4/style/Pente.h"
#include "rok4/style/Estompage.h"
#include "rok4/style/Aspect.h"
#include "rok4/style/Terrainrgb.h"
#include "rok4/enums/Interpolation.h"
#include "rok4/utils/Configuration.h"
#include "rok4/enums/Format.h"
Expand Down Expand Up @@ -162,6 +163,11 @@ private :
* \~english \brief Define wether the server must compute a relief shadow
*/
Estompage* estompage;
/**
* \~french \brief Définit si un calcul de terrainrgb doit être appliqué
* \~english \brief Define wether the server must compute a RGB terrain
*/
Terrainrgb* terrainrgb;

/**
* \~french \brief Valeur de nodata attendue dans les données en entrée
Expand Down Expand Up @@ -219,7 +225,7 @@ private :
* \~english \brief Style is allowed ?
*/
bool handle (int spp) {
if (estompage_defined() || pente_defined() || aspect_defined()) {
if (estompage_defined() || pente_defined() || aspect_defined() || terrainrgb_defined()) {
return (spp == 1);
} else {
return true;
Expand All @@ -237,22 +243,27 @@ private :
} else {
return 4;
}
} else {
}
else if (terrainrgb_defined()){
return 3;
}
else {
if (estompage_defined() || pente_defined() || aspect_defined()) {
return 1;
} else {
// identité
return orig_channels;
}
}

}

/**
* \~french \brief Quel format de canal en sortie en sortie du style
* \~english \brief Which sample format after style
*/
SampleFormat::eSampleFormat get_sample_format (SampleFormat::eSampleFormat sf) {
if (palette && ! palette->is_empty()) {
if ((palette && ! palette->is_empty()) || terrainrgb_defined()) {
return SampleFormat::UINT8;
} else {
return sf;
Expand Down Expand Up @@ -292,7 +303,7 @@ private :
return false;
}

if (estompage_defined() || pente_defined() || aspect_defined()) {
if (estompage_defined() || pente_defined() || aspect_defined() || terrainrgb_defined()) {
return false;
} else {
return true;
Expand Down Expand Up @@ -347,6 +358,17 @@ private :
return &legends;
}

/**
* \~french
* \brief Détermine si le style décrit une table de correspondance
* \return true si oui
* \~english
* \brief Determine if the style describe a lookup table
* \return true if it does
*/
inline bool palette_defined() {
return (palette != 0);
}
/**
* \~french
* \brief Retourne la table de correspondance
Expand Down Expand Up @@ -421,6 +443,27 @@ private :
inline Aspect* get_aspect() {
return aspect;
}

/**
* \~french
* \brief Return vrai si le style est un terrainrgb
* \return bool
* \~english
* \brief Return true if the style is an rgb terrain
* \return bool
*/
inline bool terrainrgb_defined() {
return (terrainrgb != 0);
}
/**
* \~french
* \brief Retourne le terrainrgb
* \~english
* \brief Return rgb terrain
*/
inline Terrainrgb* get_terrainrgb() {
return terrainrgb;
}


/**
Expand Down
102 changes: 102 additions & 0 deletions include/rok4/style/Terrainrgb.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
* Copyright © (2011) Institut national de l'information
* géographique et forestière
*
* Géoportail SAV <contact.geoservices@ign.fr>
*
* This software is a computer program whose purpose is to publish geographic
* data using OGC WMS and WMTS protocol.
*
* This software is governed by the CeCILL-C license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL-C
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
* liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
*
* knowledge of the CeCILL-C license and that you accept its terms.
*/

/**
* \file Terrainrgb.h
** \~french
* \brief D�finition de la classe Terrainrgb
** \~english
* \brief Define class Terrainrgb
*/


#pragma once

#include "rok4/utils/Configuration.h"

#include <stdint.h>
#include <vector>
#include <map>
#include <stddef.h>

class Terrainrgb : public Configuration
{
public:
/** \~french
* \brief min_elevation : élévation minimale à partir de laquelle est calculée la couleur
** \~english
* \brief min_elevation : minimum elevation from which the color is calculated
*/
int min_elevation;

/** \~french
* \brief step : résolution verticale
** \~english
* \brief step : vertical resolution
*/
float step;

/** \~french
* \brief noData : valeur de nodata pour l'image source
** \~english
* \brief noData : value of nodata for the source image
*/
float input_nodata_value;

/** \~french
* \brief noData : valeur de nodata pour le terrainrgb
** \~english
* \brief noData : value of nodata for the RGB terrain
*/
float terrainrgb_nodata_value;

/**
* \~french
* \brief Constructeurs avec des arguments
* \~english
* \brief Constructor with arguments
*/
Terrainrgb(json11::Json doc);

/**
* \~french
* \brief Destructeur
* \~english
* \brief Destructor
*/
virtual ~Terrainrgb();
};
Loading