otbMetaDataKey.cxx 5.77 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
 *
 * This file is part of Orfeo Toolbox
 *
 *     https://www.orfeo-toolbox.org/
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
Caroline Ruffel's avatar
nomsg    
Caroline Ruffel committed
20
21
22
23
24
25


#include "otbMetaDataKey.h"

namespace otb
{
26
27
28
29
namespace MetaDataKey
{
char const* DriverShortNameKey = "DriverShortName";
char const* DriverLongNameKey = "DriverLongName";
Caroline Ruffel's avatar
nomsg    
Caroline Ruffel committed
30

31
char const* ProjectionRefKey = "ProjectionRef";
Caroline Ruffel's avatar
nomsg    
Caroline Ruffel committed
32

33
34
35
char const* GCPProjectionKey = "GCPProjection";
char const* GCPParametersKey = "GCP_";
char const* GCPCountKey = "GCPCount";
Caroline Ruffel's avatar
nomsg    
Caroline Ruffel committed
36

37
char const* GeoTransformKey = "GeoTransform";
38

39
40
char const* MetadataKey = "Metadata_";
char const* SubMetadataKey = "SubMetadata_";
Caroline Ruffel's avatar
nomsg    
Caroline Ruffel committed
41

42
43
44
45
char const* UpperLeftCornerKey = "UpperLeftCorner";
char const* UpperRightCornerKey = "UpperRightCorner";
char const* LowerLeftCornerKey = "LowerLeftCorner";
char const* LowerRightCornerKey = "LowerRightCorner";
Caroline Ruffel's avatar
nomsg    
Caroline Ruffel committed
46

47
48
49
char const* ColorTableNameKey = "ColorTableName";
char const* ColorEntryCountKey = "ColorEntryCount";
char const* ColorEntryAsRGBKey = "ColorEntryAsRGB";
50

51
52
char const* OSSIMKeywordlistKey = "OSSIMKeywordlist";
char const* OSSIMKeywordlistDelimiterKey = "OSSIMKeywordlistDelimiter";
53

54
55
char const* VectorDataKeywordlistKey = "VectorDataKeywordlist";
char const* VectorDataKeywordlistDelimiterKey = "VectorDataKeywordlistDelimiter";
56

57
char const* ResolutionFactor = "ResolutionFactor";
58
char const* SubDatasetIndex = "SubDatasetIndex";
59
char const* CacheSizeInBytes = "CacheSizeInBytes";
60

61
62
char const* TileHintX = "TileHintX";
char const* TileHintY = "TileHintY";
63
64
65

char const * NoDataValueAvailable = "NoDataValueAvailable";
char const * NoDataValue = "NoDataValue";
66

67
char const * DataType = "DataType";
68
}
69

70
const MetaDataKey::KeyTypeDef Types[] =
OTB Bot's avatar
STYLE    
OTB Bot committed
71
  {
Julien Malik's avatar
Julien Malik committed
72
73
74
75
76
77
  MetaDataKey::KeyTypeDef(MetaDataKey::DriverShortNameKey,                MetaDataKey::TSTRING),
  MetaDataKey::KeyTypeDef(MetaDataKey::DriverLongNameKey,                 MetaDataKey::TSTRING),
  MetaDataKey::KeyTypeDef(MetaDataKey::ProjectionRefKey,                  MetaDataKey::TSTRING),
  MetaDataKey::KeyTypeDef(MetaDataKey::GCPProjectionKey,                  MetaDataKey::TSTRING),
  MetaDataKey::KeyTypeDef(MetaDataKey::GCPParametersKey,                  MetaDataKey::TOTB_GCP),
  MetaDataKey::KeyTypeDef(MetaDataKey::GCPCountKey,                       MetaDataKey::TENTIER),
78
  MetaDataKey::KeyTypeDef(MetaDataKey::GeoTransformKey,                   MetaDataKey::TVECTOR),
Julien Malik's avatar
Julien Malik committed
79
  MetaDataKey::KeyTypeDef(MetaDataKey::MetadataKey,                       MetaDataKey::TSTRING),
80
  MetaDataKey::KeyTypeDef(MetaDataKey::SubMetadataKey,                    MetaDataKey::TSTRING),
Julien Malik's avatar
Julien Malik committed
81
82
83
84
85
86
87
88
89
90
91
92
  MetaDataKey::KeyTypeDef(MetaDataKey::UpperLeftCornerKey,                MetaDataKey::TVECTOR),
  MetaDataKey::KeyTypeDef(MetaDataKey::UpperRightCornerKey,               MetaDataKey::TVECTOR),
  MetaDataKey::KeyTypeDef(MetaDataKey::LowerLeftCornerKey,                MetaDataKey::TVECTOR),
  MetaDataKey::KeyTypeDef(MetaDataKey::LowerRightCornerKey,               MetaDataKey::TVECTOR),
  MetaDataKey::KeyTypeDef(MetaDataKey::ColorTableNameKey,                 MetaDataKey::TSTRING),
  MetaDataKey::KeyTypeDef(MetaDataKey::ColorEntryCountKey,                MetaDataKey::TENTIER),
  MetaDataKey::KeyTypeDef(MetaDataKey::ColorEntryAsRGBKey,                MetaDataKey::TVECTOR),
  MetaDataKey::KeyTypeDef(MetaDataKey::OSSIMKeywordlistKey,               MetaDataKey::TOSSIMKEYWORDLIST),
  MetaDataKey::KeyTypeDef(MetaDataKey::OSSIMKeywordlistDelimiterKey,      MetaDataKey::TSTRING),
  MetaDataKey::KeyTypeDef(MetaDataKey::VectorDataKeywordlistKey,          MetaDataKey::TVECTORDATAKEYWORDLIST),
  MetaDataKey::KeyTypeDef(MetaDataKey::VectorDataKeywordlistDelimiterKey, MetaDataKey::TSTRING),
  MetaDataKey::KeyTypeDef(MetaDataKey::ResolutionFactor,                  MetaDataKey::TENTIER),
93
  MetaDataKey::KeyTypeDef(MetaDataKey::SubDatasetIndex,                   MetaDataKey::TENTIER),
94
95
  MetaDataKey::KeyTypeDef(MetaDataKey::CacheSizeInBytes,                  MetaDataKey::TENTIER),
  MetaDataKey::KeyTypeDef(MetaDataKey::TileHintX,                         MetaDataKey::TENTIER),
96
97
  MetaDataKey::KeyTypeDef(MetaDataKey::TileHintY,                         MetaDataKey::TENTIER),
  MetaDataKey::KeyTypeDef(MetaDataKey::NoDataValueAvailable,              MetaDataKey::TVECTOR),
98
99
  MetaDataKey::KeyTypeDef(MetaDataKey::NoDataValue,                       MetaDataKey::TVECTOR),
  MetaDataKey::KeyTypeDef(MetaDataKey::DataType,                          MetaDataKey::TENTIER),
OTB Bot's avatar
STYLE    
OTB Bot committed
100
  };
101

102
MetaDataKey::KeyType MetaDataKey::GetKeyType(const std::string& name)
Caroline Ruffel's avatar
nomsg    
Caroline Ruffel committed
103
{
104
  // MetaDataKey::KeyType ktype(MetaDataKey::TSTRING);
Caroline Ruffel's avatar
nomsg    
Caroline Ruffel committed
105

106
  for ( const auto & key : Types )
OTB Bot's avatar
STYLE    
OTB Bot committed
107
    {
108
    if ( name.find(key.keyname) != std::string::npos )
OTB Bot's avatar
STYLE    
OTB Bot committed
109
      {
110
111
112
      return MetaDataKey::KeyType(key.type);
      // ktype = key.type;
      // return ktype;
OTB Bot's avatar
STYLE    
OTB Bot committed
113
114
      }
    }
115
  return MetaDataKey::KeyType(MetaDataKey::TSTRING);
Caroline Ruffel's avatar
nomsg    
Caroline Ruffel committed
116
117
}

118
119
120
121
122
123
124
125
OTB_GCP::OTB_GCP()
 : m_GCPCol(0),
   m_GCPRow(0),
   m_GCPX(0),
   m_GCPY(0),
   m_GCPZ(0)
{
}
126

127
OTB_GCP::~OTB_GCP()
Emmanuel Christophe's avatar
Emmanuel Christophe committed
128
129
130
131
132
133
134
135
136
137
138
{
}

void OTB_GCP::Print(std::ostream& os) const
{
  os << "   GCP Id = " << this->m_Id << std::endl;
  os << "   GCP Info =  " << this->m_Info << std::endl;
  os << "   GCP (Row, Col) = (" << this->m_GCPRow << "," << this->m_GCPCol << ")" << std::endl;
  os << "   GCP (X, Y, Z) = (" << this->m_GCPX << "," << this->m_GCPY << "," << this->m_GCPZ << ")" << std::endl;
}

Caroline Ruffel's avatar
nomsg    
Caroline Ruffel committed
139
} // end namespace otb