Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Main Repositories
otb
Commits
b29256fa
Commit
b29256fa
authored
May 29, 2012
by
Otmane Lahlou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: speed up removing geometries within a roi
parent
0cb689ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
18 deletions
+15
-18
Code/Visualization/otbVectorDataEditionModel.cxx
Code/Visualization/otbVectorDataEditionModel.cxx
+15
-18
No files found.
Code/Visualization/otbVectorDataEditionModel.cxx
View file @
b29256fa
...
...
@@ -252,9 +252,9 @@ void VectorDataEditionModel
// and delete them
itk
::
PreOrderTreeIterator
<
VectorDataType
::
DataTreeType
>
it
(
this
->
GetVectorData
()
->
GetDataTree
());
it
.
GoToBegin
();
int
count
=
0
;
int
nbGeomDeleted
=
0
;
std
::
vector
<
unsigned
int
>
geomToDelete
;
//
int count = 0;
//
int nbGeomDeleted = 0;
while
(
!
it
.
IsAtEnd
()
)
{
if
(
it
.
Get
()
->
IsPointFeature
()
||
it
.
Get
()
->
IsLineFeature
()
||
it
.
Get
()
->
IsPolygonFeature
())
...
...
@@ -262,25 +262,22 @@ void VectorDataEditionModel
// check if the geometry intersects or is within the bounding box
if
(
it
.
Get
()
->
Intersects
(
regionNode
)
||
it
.
Get
()
->
Within
(
regionNode
))
{
geomToDelete
.
push_back
(
count
);
// this->SetSelectedGeometry(count);
// this->DeleteGeometry();
nbGeomDeleted
++
;
// Remove the node
it
.
Remove
();
// must go the to begin, because the iterator seems lost when
// removing a node from its tree
it
.
GoToBegin
();
//nbGeomDeleted++;
}
count
++
;
//
count++;
}
++
it
;
}
for
(
unsigned
int
idx
=
0
;
idx
<
geomToDelete
.
size
();
idx
++
)
{
this
->
SetSelectedGeometry
(
geomToDelete
[
idx
]
-
idx
);
this
->
DeleteGeometry
();
}
chrono
.
Stop
();
std
::
cout
<<
"
\t
VectorDataEditionModel::DeleteWithinROI -> "
<<
nbGeomDeleted
<<
" geometries deleted / "
<<
count
<<
" in "
<<
chrono
.
GetMeanTime
()
<<
" seconds."
<<
std
::
endl
;
// chrono.Stop();
// std::cout<< "\tVectorDataEditionModel::DeleteWithinROI -> "<< nbGeomDeleted << " geometries deleted / "
// << count <<" in " << chrono.GetMeanTime() << " seconds." <<std::endl;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment