Convert Polygon/Polyline shapebuffer

3336
4
05-13-2013 05:18 AM
teamIgal
Deactivated User
Hello,

I want to insert new Polygon in the feature class in the GDB.
So i am trying to insert it using SetGeometry, which can recieve only ShapeBuffer.

Is there a proper way to convert Polygon to shapebuffer?

Thanks,
Team Igal
0 Kudos
4 Replies
VinceAngelo
Esri Esteemed Contributor
ShapeBuffer.cpp in the samples/ShapeBuffer directory of the API seems to provide
an example of what's necessary.  You can roll your own helper functions, but either
way, it's probably wise to review the shapefile reference PDFs in the doc directory.

- V
0 Kudos
teamIgal
Deactivated User
Hello,

i saw the samples in the ShapeBuffer.cpp, but it's not quite what i am looking for.
Can you please provide some code example to a transform between runtime objects, such as polyline to shapebuffer?

Thanks,
Team Igal
0 Kudos
VinceAngelo
Esri Esteemed Contributor
Between LineGeomTest and LineZGeomTest, it looks like the bases are covered --
conversion in both directions, with multiple dimensions -- what more do you need?

Perhaps it will help if you think of it as a "packing" exercise, instead of transformation.

- V
0 Kudos
DavidSousa
Occasional Contributor
It is not necessary to convert your PolyLine shape buffer to a ShapeBuffer because it already is one.

ShapeBuffer is the base class for all of the other shape buffer types.  Since SetGeometry accepts a ShapeBuffer object, that means you can pass an instance of the base class or any of the derived classes.  This is a fundamental object oriented programming technique of C++.

Here is a small extract from the ShapeBuffer sample program:


    MultiPartShapeBuffer lineGeometry;
    row.GetGeometry(lineGeometry);

    int numPts;
    lineGeometry.GetNumPoints(numPts);


Please note that lineGeometry is declared as a MultiPartShapeBuffer, and that we are able to pass it to GetGeometry with no problem.
0 Kudos