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
21039eb8
Commit
21039eb8
authored
14 years ago
by
Julien Malik
Browse files
Options
Downloads
Patches
Plain Diff
BUG: Avoid cross heap pb when writing vector data on windows
parent
cc9b60f0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/IO/otbOGRIOHelper.txx
+17
-29
17 additions, 29 deletions
Code/IO/otbOGRIOHelper.txx
Code/IO/otbOGRVectorDataIO.txx
+2
-2
2 additions, 2 deletions
Code/IO/otbOGRVectorDataIO.txx
with
19 additions
and
31 deletions
Code/IO/otbOGRIOHelper.txx
+
17
−
29
View file @
21039eb8
...
...
@@ -72,7 +72,7 @@ OGRIOHelper<TVectorData>
LinePointerType line = LineType::New();
OGRPoint * ogrTmpPoint =
new OGR
Point
(
);
OGRPoint * ogrTmpPoint =
(OGRPoint *)OGRGeometryFactory::createGeometry(wkb
Point);
for (int pIndex = 0; pIndex < ogrLine->getNumPoints(); ++pIndex)
{
...
...
@@ -95,7 +95,7 @@ OGRIOHelper<TVectorData>
line->AddVertex(vertex);
}
delete
ogrTmpPoint;
OGRGeometryFactory::destroyGeometry(
ogrTmpPoint
)
;
DataNodePointerType node = DataNodeType::New();
node->SetLine(line);
...
...
@@ -116,8 +116,7 @@ OGRIOHelper<TVectorData>
itkGenericExceptionMacro(<< "Failed to convert OGRGeometry to OGRPolygon");
}
OGRPoint * ogrTmpPoint = new OGRPoint();
OGRPoint * ogrTmpPoint = (OGRPoint *)OGRGeometryFactory::createGeometry(wkbPoint);
OGRLinearRing * ogrRing = ogrPolygon->getExteriorRing();
PolygonPointerType extRing = PolygonType::New();
...
...
@@ -167,7 +166,7 @@ OGRIOHelper<TVectorData>
intRings->PushBack(ring);
}
delete
ogrTmpPoint;
OGRGeometryFactory::destroyGeometry(
ogrTmpPoint
)
;
DataNodePointerType node = DataNodeType::New();
node->SetPolygonExteriorRing(extRing);
...
...
@@ -726,8 +725,8 @@ unsigned int OGRIOHelper<TVectorData>
{
//Build the ogrObject
OGRPolygon * ogrPolygon =
new OGR
Polygon
(
);
OGRLinearRing * ogrExternalRing =
new OGR
LinearRing
(
);
OGRPolygon * ogrPolygon =
(OGRPolygon *)OGRGeometryFactory::createGeometry(wkb
Polygon);
OGRLinearRing * ogrExternalRing =
(OGRLinearRing *)OGRGeometryFactory::createGeometry(wkb
LinearRing);
VertexListConstPointerType vertexList = dataNode->GetPolygonExteriorRing()->GetVertexList();
typename VertexListType::ConstIterator vIt = vertexList->Begin();
...
...
@@ -748,13 +747,13 @@ unsigned int OGRIOHelper<TVectorData>
ogrPolygon->addRing(ogrExternalRing);
// Close the polygon
ogrPolygon->closeRings();
delete
ogrExternalRing;
OGRGeometryFactory::destroyGeometry(
ogrExternalRing
)
;
// Retrieving internal rings as well
for (typename PolygonListType::Iterator pIt = dataNode->GetPolygonInteriorRings()->Begin();
pIt != dataNode->GetPolygonInteriorRings()->End(); ++pIt)
{
OGRLinearRing * ogrInternalRing =
new OGR
LinearRing
(
);
OGRLinearRing * ogrInternalRing =
(OGRLinearRing *)OGRGeometryFactory::createGeometry(wkb
LinearRing);
vertexList = pIt.Get()->GetVertexList();
vIt = vertexList->Begin();
...
...
@@ -771,7 +770,7 @@ unsigned int OGRIOHelper<TVectorData>
++vIt;
}
ogrPolygon->addRing(ogrInternalRing);
delete
ogrInternalRing;
OGRGeometryFactory::destroyGeometry(
ogrInternalRing
)
;
}
//Save it in the structure
...
...
@@ -796,7 +795,7 @@ unsigned int OGRIOHelper<TVectorData>
ogrCollection->addGeometry(ogrPolygon);
}
delete
ogrPolygon;
OGRGeometryFactory::destroyGeometry(
ogrPolygon
)
;
break;
}
case FEATURE_MULTIPOINT:
...
...
@@ -806,8 +805,7 @@ unsigned int OGRIOHelper<TVectorData>
itkExceptionMacro(<< "Problem while creating multipoint.");
}
OGRMultiPoint* ogrMultiPoint= new OGRMultiPoint();
OGRMultiPoint* ogrMultiPoint= (OGRMultiPoint* )OGRGeometryFactory::createGeometry(wkbMultiPoint);
OGRFeature *ogrFeature;
ogrFeature = OGRFeature::CreateFeature(ogrCurrentLayer->GetLayerDefn());
...
...
@@ -831,8 +829,8 @@ unsigned int OGRIOHelper<TVectorData>
}
// Instanciate a new ogrMultiLineString feature
OGRMultiLineString* ogrMultiLineString=
new OGR
MultiLineString
(
);
OGRMultiLineString* ogrMultiLineString=
(OGRMultiLineString* )OGRGeometryFactory::createGeometry(wkb
MultiLineString);
OGRFeature *ogrFeature;
ogrFeature = OGRFeature::CreateFeature(ogrCurrentLayer->GetLayerDefn());
...
...
@@ -855,14 +853,13 @@ unsigned int OGRIOHelper<TVectorData>
}
// Instanciate a new multipolygon feature
OGRMultiPolygon* ogrMutliPolygon = new OGRMultiPolygon();
OGRMultiPolygon* ogrMultiPolygon= (OGRMultiPolygon* )OGRGeometryFactory::createGeometry(wkbMultiPolygon);
OGRFeature *ogrFeature;
ogrFeature = OGRFeature::CreateFeature(ogrCurrentLayer->GetLayerDefn());
ogrFeature->SetField("Name", dataNode->GetNodeId());
ogrFeature->GetDefnRef()->SetGeomType(wkbMultiPolygon);
ogrFeature->SetGeometry(ogrMu
t
liPolygon);
ogrFeature->SetGeometry(ogrMul
t
iPolygon);
if (ogrCurrentLayer->CreateFeature(ogrFeature) != OGRERR_NONE)
{
...
...
@@ -878,7 +875,7 @@ unsigned int OGRIOHelper<TVectorData>
itkExceptionMacro(<< "Problem while creating collection.");
}
OGRGeometryCollection* ogrCollectionGeometry =
new OGR
GeometryCollection
(
);
OGRGeometryCollection* ogrCollectionGeometry =
(OGRGeometryCollection* )OGRGeometryFactory::createGeometry(wkb
GeometryCollection);
OGRFeature *ogrFeature;
...
...
@@ -900,16 +897,7 @@ unsigned int OGRIOHelper<TVectorData>
return m_Kept;
}
/*
template<class TLabelObject, class TPolygon>
inline typename OGRIOHelper<TLabelObject,TPolygon>
::PolygonPointerType
OGRIOHelper<TLabelObject,TPolygon>
::operator()(const LabelObjectType * labelObject)
{
}
*/
} // end namespace otb
...
...
This diff is collapsed.
Click to expand it.
Code/IO/otbOGRVectorDataIO.txx
+
2
−
2
View file @
21039eb8
...
...
@@ -250,7 +250,7 @@ void OGRVectorDataIO<TData>::Write(const VectorDataConstPointerType data, char *
OGRSpatialReference * oSRS = NULL;
if (projectionInformationAvailable)
{
oSRS =
new OGR
SpatialReference(projectionRefWkt.c_str());
oSRS =
static_cast<OGRSpatialReference *>(OSRNew
SpatialReference(projectionRefWkt.c_str())
)
;
}
// Retrieving root node
...
...
@@ -279,7 +279,7 @@ void OGRVectorDataIO<TData>::Write(const VectorDataConstPointerType data, char *
if (oSRS != NULL)
{
delete
oSRS;
OSRDestroySpatialReference(
oSRS
)
;
}
chrono.Stop();
...
...
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