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
Container Registry
Model registry
Operate
Environments
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
Main Repositories
otb
Commits
b3111d5b
Commit
b3111d5b
authored
14 years ago
by
Emmanuel Christophe
Browse files
Options
Downloads
Patches
Plain Diff
COMP: remove switch case
parent
40b19cfd
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/Projections/otbGenericMapProjection.txx
+26
-35
26 additions, 35 deletions
Code/Projections/otbGenericMapProjection.txx
Code/Projections/otbMapProjection.txx
+19
-30
19 additions, 30 deletions
Code/Projections/otbMapProjection.txx
with
45 additions
and
65 deletions
Code/Projections/otbGenericMapProjection.txx
+
26
−
35
View file @
b3111d5b
...
...
@@ -148,55 +148,46 @@ GenericMapProjection<Transform, TScalarType, NInputDimensions, NOutputDimensions
{
OutputPointType outputPoint;
// otbMsgDevMacro(<< "DirectionOfMapping: " << DirectionOfMapping);
switch (DirectionOfMapping)
// otbMsgDevMacro(<< "DirectionOfMapping: " <<
// DirectionOfMapping);
if (DirectionOfMapping == INVERSE)
{
case INVERSE:
{
// otbMsgDevMacro(<< "Cartographic coordinates: (" << point[0] << "," << point[1] << ")");
//from "itk::point" to "ossim::ossimDpt"
ossimDpt ossimDPoint(point[0], point[1]);
//from "itk::point" to "ossim::ossimDpt"
ossimDpt ossimDPoint(point[0], point[1]);
//map projection
ossimGpt ossimGPoint;
ossimGPoint = this->GetMapProjection()->inverse(ossimDPoint);
ossimGPoint.changeDatum(ossimDatumFactory::instance()->wgs84());
//map projection
ossimGpt ossimGPoint;
ossimGPoint = this->GetMapProjection()->inverse(ossimDPoint);
ossimGPoint.changeDatum(ossimDatumFactory::instance()->wgs84());
// otbGenericMsgDebugMacro(<< "Inverse : " << std::endl << m_MapProjection->print(std::cout));
outputPoint[0] = ossimGPoint.lon;
outputPoint[1] = ossimGPoint.lat;
outputPoint[0] = ossimGPoint.lon;
outputPoint[1] = ossimGPoint.lat;
// otbMsgDevMacro(<< "Geographic coordinates (lon, lat) : (" << outputPoint[0] << "," << outputPoint[1] << ")");
if ((InputPointType::PointDimension == 3) && (OutputPointType::PointDimension == 3))
{
outputPoint[2] = point[2];
}
break;
}
case FORWARD:
if ((InputPointType::PointDimension == 3) && (OutputPointType::PointDimension == 3))
{
outputPoint[2] = point[2];
}
}
if (DirectionOfMapping == FORWARD)
{
// otbMsgDevMacro(<< "Geographic coordinates (lon, lat) : (" << point[1] << "," << point[0] << ")");
//from "itk::point" to "ossim::ossimGpt"
ossimGpt ossimGPoint(point[1], point[0]);
//from "itk::point" to "ossim::ossimGpt"
ossimGpt ossimGPoint(point[1], point[0]);
//map projection
ossimDpt ossimDPoint;
ossimDPoint = this->GetMapProjection()->forward(ossimGPoint);
//map projection
ossimDpt ossimDPoint;
ossimDPoint = this->GetMapProjection()->forward(ossimGPoint);
// otbGenericMsgDebugMacro(<< "Forward : ========================= " << std::endl << m_MapProjection->print(std::cout));
outputPoint[0] = ossimDPoint.x;
outputPoint[1] = ossimDPoint.y;
outputPoint[0] = ossimDPoint.x;
outputPoint[1] = ossimDPoint.y;
// otbMsgDevMacro(<< "Cartographic coordinates: (" << outputPoint[0] << "," << outputPoint[1] << ")");
if ((InputPointType::PointDimension == 3) && (OutputPointType::PointDimension == 3))
{
outputPoint[2] = point[2];
}
break;
}
default:
if ((InputPointType::PointDimension == 3) && (OutputPointType::PointDimension == 3))
{
itkExceptionMacro(<< "Model is INVERSE or FORWARD only !!");
break;
outputPoint[2] = point[2];
}
}
...
...
This diff is collapsed.
Click to expand it.
Code/Projections/otbMapProjection.txx
+
19
−
30
View file @
b3111d5b
...
...
@@ -117,48 +117,37 @@ MapProjection<TOssimMapProjection, Transform, TScalarType, NInputDimensions, NOu
{
OutputPointType outputPoint;
switch
(DirectionOfMapping)
if
(DirectionOfMapping
== INVERSE
)
{
case INVERSE:
{
// otbMsgDevMacro(<< "Cartographic coordinates: (" << point[0] << "," << point[1] << ")");
//from "itk::point" to "ossim::ossimDpt"
ossimDpt ossimDPoint(point[0], point[1]);
//from "itk::point" to "ossim::ossimDpt"
ossimDpt ossimDPoint(point[0], point[1]);
//map projection
ossimGpt ossimGPoint;
ossimGPoint = m_MapProjection->inverse(ossimDPoint);
ossimGPoint.changeDatum(ossimDatumFactory::instance()->wgs84());
//map projection
ossimGpt ossimGPoint;
ossimGPoint = m_MapProjection->inverse(ossimDPoint);
ossimGPoint.changeDatum(ossimDatumFactory::instance()->wgs84());
// otbGenericMsgDebugMacro(<< "Inverse : " << std::endl << m_MapProjection->print(std::cout));
outputPoint[0] = ossimGPoint.lon;
outputPoint[1] = ossimGPoint.lat;
outputPoint[0] = ossimGPoint.lon;
outputPoint[1] = ossimGPoint.lat;
// otbMsgDevMacro(<< "Geographic coordinates (lon, lat) : (" << outputPoint[0] << "," << outputPoint[1] << ")");
break;
}
case FORWARD:
{
}
if (DirectionOfMapping == FORWARD)
{
// otbMsgDevMacro(<< "Geographic coordinates (lon, lat) : (" << point[1] << "," << point[0] << ")");
//from "itk::point" to "ossim::ossimGpt"
ossimGpt ossimGPoint(point[1], point[0]);
//from "itk::point" to "ossim::ossimGpt"
ossimGpt ossimGPoint(point[1], point[0]);
//map projection
ossimDpt ossimDPoint;
ossimDPoint = m_MapProjection->forward(ossimGPoint);
//map projection
ossimDpt ossimDPoint;
ossimDPoint = m_MapProjection->forward(ossimGPoint);
// otbGenericMsgDebugMacro(<< "Forward : ========================= " << std::endl << m_MapProjection->print(std::cout));
outputPoint[0] = ossimDPoint.x;
outputPoint[1] = ossimDPoint.y;
outputPoint[0] = ossimDPoint.x;
outputPoint[1] = ossimDPoint.y;
// otbMsgDevMacro(<< "Cartographic coordinates: (" << outputPoint[0] << "," << outputPoint[1] << ")");
break;
}
default:
{
itkExceptionMacro(<< "Model is INVERSE or FORWARD only !!");
break;
}
}
return outputPoint;
...
...
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