How to Update Z in PointZ and PolylineZ ?

3495
2
05-31-2014 08:03 PM
MichelMorgan1
New Contributor
I'm using FileGeoDB API 1.3, and trying to update Z values in a feature class of PointZ or PolylineZ type. I am not finding a function called SetZ or similar. Here are the steps I'm taking:

Row row;

//then get the row from a query

PointShapeBuffer geom;
Point* point;

row.GetGeometry(geom);
geom.GetPoint(point);

double x,y,z;

x=point[0].x;
y=point[0].y;
//z=point[0].z;   // does not exist.

geom.GetZ(z); // here is how I could get z

z=z+10;

// SetZ(z); does not exist. What are the alternatives ?
// point[0].z=z;    does not exist either

row.SetGeometry(geom);

Thanks for your help
0 Kudos
2 Replies
VinceAngelo
Esri Esteemed Contributor
There's an example on how to use the shape buffer in the samples directory.
ShapeBuffer.cpp shows that the GetPoints/GetZ/GetM requests are for referenced
values in the structure itself, so a "Set" or "Put" is not necessary -- any changes
to the array contents are immediately reflected in the object.

Your "GetZ" code above would likely result in memory corruption -- didn't the
compiler warn you about conflicting types?

In the future, please use the CODE tags for source ("#" button in the editor)
to improve readability.

- V
0 Kudos
MichelMorgan1
New Contributor
Thank you for your response. These samples were really helpful. I started my way through the api by using the intellisense, but the samples are a better start.

I wrote that example from the memory (not compiled as is) so I didn't get compiler warnings. Now I am using the proper pointers/references and everything looks great

Thanks
MM
0 Kudos