Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Youssefi
otb
Commits
0b7e462f
Commit
0b7e462f
authored
15 years ago
by
Emmanuel Christophe
Browse files
Options
Downloads
Plain Diff
Automated merge with
http://hg.orfeo-toolbox.org/OTB
parents
14657d8d
8d3678e5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/IO/otbWorldFile.h
+104
-0
104 additions, 0 deletions
Code/IO/otbWorldFile.h
Examples/IO/TileMapImageIOExample.cxx
+8
-14
8 additions, 14 deletions
Examples/IO/TileMapImageIOExample.cxx
with
112 additions
and
14 deletions
Code/IO/otbWorldFile.h
0 → 100644
+
104
−
0
View file @
0b7e462f
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __otbWorldFile_h
#define __otbWorldFile_h
#include
"itkObject.h"
namespace
otb
{
/**
* \class WorldFile
* \brief Handle the world file that associate geographic information to png, jpg
*
*/
class
ITK_EXPORT
WorldFile
:
public
itk
::
Object
{
public:
typedef
WorldFile
Self
;
typedef
itk
::
Object
Superclass
;
typedef
itk
::
SmartPointer
<
Self
>
Pointer
;
typedef
itk
::
SmartPointer
<
const
Self
>
ConstPointer
;
/** Method for creation through the object factory. */
itkNewMacro
(
Self
);
itkGetMacro
(
LonOrigin
,
double
)
itkSetMacro
(
LonOrigin
,
double
)
itkGetMacro
(
LatOrigin
,
double
)
itkSetMacro
(
LatOrigin
,
double
)
itkGetMacro
(
LonSpacing
,
double
)
itkSetMacro
(
LonSpacing
,
double
)
itkGetMacro
(
LatSpacing
,
double
)
itkSetMacro
(
LatSpacing
,
double
)
itkGetMacro
(
LonRotation
,
double
)
itkSetMacro
(
LonRotation
,
double
)
itkGetMacro
(
LatRotation
,
double
)
itkSetMacro
(
LatRotation
,
double
)
itkGetStringMacro
(
ImageFilename
)
itkSetStringMacro
(
ImageFilename
)
void
Update
()
{
if
(
m_ImageFilename
.
empty
())
{
itkExceptionMacro
(
<<
"The image filename must be provided"
);
}
std
::
string
worldFilename
;
int
i
=
m_ImageFilename
.
find_last_of
(
'.'
);
worldFilename
=
m_ImageFilename
.
substr
(
0
,
i
)
+
".wld"
;
std
::
ofstream
file
;
file
.
open
(
worldFilename
.
c_str
());
file
<<
std
::
setprecision
(
15
);
file
<<
m_LonSpacing
<<
std
::
endl
;
file
<<
m_LatRotation
<<
std
::
endl
;
//yes, in this order
file
<<
m_LonRotation
<<
std
::
endl
;
file
<<
m_LatSpacing
<<
std
::
endl
;
file
<<
m_LonOrigin
<<
std
::
endl
;
file
<<
m_LatOrigin
<<
std
::
endl
;
file
.
close
();
}
protected
:
WorldFile
()
:
m_LonOrigin
(
0.0
),
m_LatOrigin
(
0.0
),
m_LonSpacing
(
0.0
),
m_LatSpacing
(
0.0
),
m_LonRotation
(
0.0
),
m_LatRotation
(
0.0
),
m_ImageFilename
(
""
)
{};
~
WorldFile
()
{};
private
:
WorldFile
(
const
Self
&
);
//purposely not implemented
void
operator
=
(
const
Self
&
);
//purposely not implemented
double
m_LonOrigin
;
double
m_LatOrigin
;
double
m_LonSpacing
;
double
m_LatSpacing
;
double
m_LonRotation
;
double
m_LatRotation
;
std
::
string
m_ImageFilename
;
};
}
// end namespace otb
#endif
This diff is collapsed.
Click to expand it.
Examples/IO/TileMapImageIOExample.cxx
+
8
−
14
View file @
0b7e462f
...
...
@@ -60,6 +60,7 @@
#include
"otbExtractROI.h"
#include
"otbImageFileWriter.h"
#include
"ossim/projection/ossimTileMapModel.h"
#include
"otbWorldFile.h"
// Software Guide : EndCodeSnippet
int
main
(
int
argc
,
char
*
argv
[]
)
...
...
@@ -246,20 +247,13 @@ int main( int argc, char* argv[] )
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
std
::
string
worldFilename
;
int
i
=
outputFilename
.
find_last_of
(
'.'
);
worldFilename
=
outputFilename
.
substr
(
0
,
i
)
+
".wld"
;
std
::
ofstream
file
;
file
.
open
(
worldFilename
.
c_str
());
file
<<
std
::
setprecision
(
15
);
file
<<
lonSpacing
<<
std
::
endl
;
file
<<
0.0
<<
std
::
endl
;
file
<<
0.0
<<
std
::
endl
;
file
<<
latSpacing
<<
std
::
endl
;
file
<<
lonUL
<<
std
::
endl
;
file
<<
latUL
<<
std
::
endl
;
file
.
close
();
otb
::
WorldFile
::
Pointer
worldFile
=
otb
::
WorldFile
::
New
();
worldFile
->
SetImageFilename
(
outputFilename
);
worldFile
->
SetLonOrigin
(
lonUL
);
worldFile
->
SetLatOrigin
(
latUL
);
worldFile
->
SetLonSpacing
(
lonSpacing
);
worldFile
->
SetLatSpacing
(
latSpacing
);
worldFile
->
Update
();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment