36 int64_t maximum,
double scale,
double offset ) :
37 NodeImpl( destImageFile ), value_( rawValue ), minimum_( minimum ), maximum_( maximum ), scale_( scale ),
52 double scaledMinimum,
double scaledMaximum,
double scale,
54 NodeImpl( destImageFile ), value_( static_cast<int64_t>(
std::
floor( ( scaledValue -
offset ) / scale + .5 ) ) ),
55 minimum_( static_cast<int64_t>(
std::
floor( ( scaledMinimum -
offset ) / scale + .5 ) ) ),
56 maximum_( static_cast<int64_t>(
std::
floor( ( scaledMaximum -
offset ) / scale + .5 ) ) ), scale_( scale ),
65 " scaledValue=" +
toString( scaledValue ) +
82 std::shared_ptr<ScaledIntegerNodeImpl> ii( std::static_pointer_cast<ScaledIntegerNodeImpl>( ni ) );
85 if ( minimum_ != ii->minimum_ )
91 if ( maximum_ != ii->maximum_ )
97 if ( scale_ != ii->scale_ )
103 if ( offset_ != ii->offset_ )
131 return ( value_ * scale_ + offset_ );
142 return ( minimum_ * scale_ + offset_ );
153 return ( maximum_ * scale_ + offset_ );
180 const char *forcedFieldName )
185 if ( forcedFieldName !=
nullptr )
187 fieldName = forcedFieldName;
194 cf <<
space( indent ) <<
"<" << fieldName <<
" type=\"ScaledInteger\"";
197 if ( minimum_ != E57_INT64_MIN )
199 cf <<
" minimum=\"" << minimum_ <<
"\"";
201 if ( maximum_ != E57_INT64_MAX )
203 cf <<
" maximum=\"" << maximum_ <<
"\"";
207 cf <<
" scale=\"" << scale_ <<
"\"";
209 if ( offset_ != 0.0 )
211 cf <<
" offset=\"" << offset_ <<
"\"";
217 cf <<
">" << value_ <<
"</" << fieldName <<
">\n";
229 os <<
space( indent ) <<
"type: ScaledInteger"
ustring relativePathName(const NodeImplSharedPtr &origin, ustring childPathName=ustring()) const
void checkImageFileOpen(const char *srcFileName, int srcLineNumber, const char *srcFunctionName) const
virtual void dump(int indent=0, std::ostream &os=std::cout) const
void checkLeavesInSet(const StringSet &pathNames, NodeImplSharedPtr origin) override
void dump(int indent=0, std::ostream &os=std::cout) const override
void writeXml(ImageFileImplSharedPtr imf, CheckedFile &cf, int indent, const char *forcedFieldName=nullptr) override
bool isDefined(const ustring &pathName) override
bool isTypeEquivalent(NodeImplSharedPtr ni) override
ScaledIntegerNodeImpl(ImageFileImplWeakPtr destImageFile, int64_t value=0, int64_t minimum=0, int64_t maximum=0, double scale=1.0, double offset=0.0)
NodeType type() const override
QTextStream & endl(QTextStream &stream)
MiniVec< float, N > floor(const MiniVec< float, N > &a)
std::shared_ptr< class NodeImpl > NodeImplSharedPtr
std::weak_ptr< class ImageFileImpl > ImageFileImplWeakPtr
std::shared_ptr< class ImageFileImpl > ImageFileImplSharedPtr
@ E57_ERROR_VALUE_OUT_OF_BOUNDS
element value out of min/max bounds
@ E57_ERROR_NO_BUFFER_FOR_ELEMENT
std::string ustring
UTF-8 encodeded Unicode string.
std::set< std::string > StringSet
@ E57_SCALED_INTEGER
ScaledIntegerNode class.
std::string toString(T x)
std::string space(size_t n)