Select to view content in your preferred language

First Point in Polyline has no Z-value

604
3
04-17-2013 05:45 AM
RainaldSuchan1
Deactivated User
I am trying to create a polyline of 3D points. So the coordinates have a z-value.
But at the end the first point of the created polyline has a z-value of 0.0 and not the specified value. What's wrong in my code?

[PHP]
private void createPolyline(){
Polyline polyLine = new Polyline();
Point p1 = new Point(1413500.0, 6022400.0, 234.0);
Point p2 = new Point(1413600.0, 6022600.0, 243.0);
Point p3 = new Point(1413800.0, 6022700.0, 257.0);
polyLine.startPath(p1);
polyLine.lineTo(p2);
polyLine.lineTo(p3);

MultiPath path = (MultiPath)polyLine;
for(int i = 0; i < polyLine.getPointCount(); i++){
  Point point = path.getPoint(i);
  double x = point.getX();
  double y = point.getY();
  double z = point.getZ();
  Log.i(TAG, "Point " + i + "=> Coords x: " + x + ",y: " + y + ",z: " + z);  
}
}
[/PHP]
0 Kudos
3 Replies
RainaldSuchan1
Deactivated User
To make that more clear: The first point I add to the polyline has the coordinates:

X: 1413500.0
Y: 6022400.0
Z: 234.0

But when I get this point back from the created polyline it has a z-Value of 0.0:

X: 1413500.0
Y: 6022400.0
Z: 0.0

Is that a bug?
0 Kudos
TrevorHart1
Emerging Contributor
Probably not a bug. The docs show this;

startPath (double x, double y)

Which suggests its only expecting 2D points.

Do all of the points have a zero Y value?
0 Kudos
RainaldSuchan1
Deactivated User
Its only the first point in the polyline which has a zero Z value after creating the polyline. All the others have the correct z value as I set at the beginning.

I am using the startPath(Point point) and the Point has a constructor with x, y and z values. So it should work.

Also I am using the lineTo(Point point) with 3D points and this works! All the other points except the first one have correct z values.

So if lineTo(Point point) works correct with 3D Points, why is startPoint(Point point) not working with 3D points? That makes no sense for me.
0 Kudos