Closed animesh-sharama closed 3 years ago
Depends what you are trying to accomplish, what about this:
public class MyPolygon{
S2Polygon poly;
String attribute;
public MyPolygon(S2Polygon poly, String attirbute){
this.poly = poly;
this.attribyte = attribute;
}
}
Add getters/setters as you see fit.
The custom class MyPolygon cannot be used inside the S2PointIndex I guess https://github.com/cpovirk/s2-geometry-library-java/blob/moesync/src/com/google/common/geometry/S2PointIndex.java
It looks like you're supposed to use the templated add(): https://github.com/cpovirk/s2-geometry-library-java/blob/moesync/src/com/google/common/geometry/S2PointIndex.java#L101
Here's the not very clear documentation pointer: https://github.com/cpovirk/s2-geometry-library-java/blob/moesync/src/com/google/common/geometry/S2PointIndex.java#L38
Yeah wrapping is usually better, although depends a bit on what you're doing. Feel free to reopen this if you have additional details to add to the conversation.
Hi, I would like to add additional attribute to the S2Polygon class since its final I can't extend it. The only way I can think of it is by replicating the class and adding additional constructor.
Is there any better way of doing it or the recommendation for such use case?
Original issue - https://github.com/google/s2geometry/issues/116