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
Antoine Belvire
otb
Commits
eed4f693
Commit
eed4f693
authored
16 years ago
by
Otmane Lahlou
Browse files
Options
Downloads
Patches
Plain Diff
ENH : Use the GenericRSTransform in the VectorDataExtractROI
parent
c818cf85
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/Common/otbVectorDataExtractROI.txx
+19
-43
19 additions, 43 deletions
Code/Common/otbVectorDataExtractROI.txx
with
19 additions
and
43 deletions
Code/Common/otbVectorDataExtractROI.txx
+
19
−
43
View file @
eed4f693
...
...
@@ -23,6 +23,7 @@
#include "otbGenericMapProjection.h"
#include "itkIdentityTransform.h"
#include "otbGenericRSTransform.h"
#include "otbObjectList.h"
#include "otbMacro.h"
...
...
@@ -297,13 +298,20 @@ void
VectorDataExtractROI<TVectorData>
::ProjectRegionToInputVectorProjection()
{
typedef otb::GenericMapProjection<otb::INVERSE> ForwardMapProjectionType;
ForwardMapProjectionType::Pointer mapTransform = ForwardMapProjectionType::New();
mapTransform->SetWkt(m_ROI.GetRegionProjection());
/*FORWARD ; From RegionProjection To long/lat Projection */
typename VertexListType::Pointer regionCorners = VertexListType::New();
ProjPointType point1, point2 , point3, point4;
/* Use the RS Generic projection */
typedef otb::GenericRSTransform<> GenericRSTransformType;
typename GenericRSTransformType::Pointer genericTransform = GenericRSTransformType::New();
/** We need get the transformation*/
const itk::MetaDataDictionary &inputDict = this->GetInput()->GetMetaDataDictionary();
genericTransform->SetInputDictionary(inputDict);
genericTransform->SetInputProjectionRef( m_ROI.GetRegionProjection());
genericTransform->SetOutputProjectionRef(this->GetInput()->GetProjectionRef() );
genericTransform->InstanciateTransform();
typename VertexListType::Pointer regionCorners = VertexListType::New();
ProjPointType point1, point2 , point3, point4;
/** Compute the extremities of the region*/
point1[0] = m_ROI.GetOrigin()[0];
...
...
@@ -317,44 +325,12 @@ VectorDataExtractROI<TVectorData>
point4[0] = m_ROI.GetOrigin()[0];
point4[1] = m_ROI.GetOrigin()[1]+ m_ROI.GetSize()[1];
/** Aplly the transformation*/
ProjPointType pGeo1 = mapTransform->TransformPoint(point1);
ProjPointType pGeo2 = mapTransform->TransformPoint(point2);
ProjPointType pGeo3 = mapTransform->TransformPoint(point3);
ProjPointType pGeo4 = mapTransform->TransformPoint(point4);
/** INVERSE : From long/lat to InputVectorData projection*/
typedef otb::GenericMapProjection<otb::FORWARD> InverseMapProjectionType;
InverseMapProjectionType::Pointer mapInverseTransform = InverseMapProjectionType::New();
typedef itk::Transform<double, 2, 2> GenericTransformType;
GenericTransformType::Pointer outputTransform ;
if(!this->GetInput()->GetProjectionRef().empty())
{
mapInverseTransform->SetWkt(this->GetInput()->GetProjectionRef());
outputTransform = mapInverseTransform.GetPointer();
//Case of kml
if(mapInverseTransform->GetMapProjection() == NULL)
outputTransform = itk::IdentityTransform< double, 2 >::New();
}
else
outputTransform = itk::IdentityTransform< double, 2 >::New();
/** Finally Project the four corners in the InputDataVector Projection*/
ProjPointType pCarto1 = /*mapInverseTransform*/ outputTransform->TransformPoint(pGeo1);
ProjPointType pCarto2 = /*mapInverseTransform*/ outputTransform->TransformPoint(pGeo2);
ProjPointType pCarto3 = /*mapInverseTransform*/ outputTransform ->TransformPoint(pGeo3);
ProjPointType pCarto4 = /*mapInverseTransform*/ outputTransform->TransformPoint(pGeo4);
/** Fill the vertex List : First Convert Point To*/
regionCorners->InsertElement(regionCorners->Size(),this->PointToContinuousIndex(
pCarto1
));
regionCorners->InsertElement(regionCorners->Size(),this->PointToContinuousIndex(
pCarto2
));
regionCorners->InsertElement(regionCorners->Size(),this->PointToContinuousIndex(
pCarto3
));
regionCorners->InsertElement(regionCorners->Size(),this->PointToContinuousIndex(
pCarto4
));
regionCorners->InsertElement(regionCorners->Size(),this->PointToContinuousIndex(
genericTransform->TransformPoint(point1)
));
regionCorners->InsertElement(regionCorners->Size(),this->PointToContinuousIndex(
genericTransform->TransformPoint(point2)
));
regionCorners->InsertElement(regionCorners->Size(),this->PointToContinuousIndex(
genericTransform->TransformPoint(point3)
));
regionCorners->InsertElement(regionCorners->Size(),this->PointToContinuousIndex(
genericTransform->TransformPoint(point4)
));
/** Due to The projection : the Projected ROI can be rotated */
m_GeoROI = this->ComputeVertexListBoudingRegion(regionCorners.GetPointer());
...
...
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