polygon label work in progress
This commit is contained in:
parent
c4bd3d090a
commit
f65331d84e
3 changed files with 22 additions and 4 deletions
|
@ -19,6 +19,7 @@ public class BinaryMapDataObject {
|
|||
protected int[] types = null;
|
||||
protected int[] additionalTypes = null;
|
||||
protected int objectType = RenderingRulesStorage.POINT_RULES;
|
||||
protected int[] labelCoordinates = null;
|
||||
|
||||
protected TIntObjectHashMap<String> objectNames = null;
|
||||
protected TIntArrayList namesOrder = null;
|
||||
|
@ -33,7 +34,7 @@ public class BinaryMapDataObject {
|
|||
|
||||
|
||||
public BinaryMapDataObject(long id, int[] coordinates, int[][] polygonInnerCoordinates, int objectType, boolean area,
|
||||
int[] types, int[] additionalTypes){
|
||||
int[] types, int[] additionalTypes, int[] labelCoordinates){
|
||||
this.polygonInnerCoordinates = polygonInnerCoordinates;
|
||||
this.coordinates = coordinates;
|
||||
this.additionalTypes = additionalTypes;
|
||||
|
@ -41,6 +42,7 @@ public class BinaryMapDataObject {
|
|||
this.id = id;
|
||||
this.objectType = objectType;
|
||||
this.area = area;
|
||||
this.labelCoordinates = labelCoordinates;
|
||||
}
|
||||
|
||||
protected void setCoordinates(int[] coordinates) {
|
||||
|
@ -282,6 +284,18 @@ public class BinaryMapDataObject {
|
|||
}
|
||||
}
|
||||
|
||||
//do we need it? use precision?
|
||||
if (equals) {
|
||||
if (labelCoordinates == null || thatObj.labelCoordinates == null) {
|
||||
equals = labelCoordinates == thatObj.labelCoordinates;
|
||||
//do we need it? precision?
|
||||
// } else {
|
||||
// for(int i = 0; i < labelCoordinates.length && equals; i++) {
|
||||
// equals = labelCoordinates[i] == thatObj.labelCoordinates[i];
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
return equals;
|
||||
}
|
||||
// thatObj.mapIndex.decodeType(thatObj.types[0])
|
||||
|
@ -367,4 +381,8 @@ public class BinaryMapDataObject {
|
|||
public int getObjectType() {
|
||||
return objectType;
|
||||
}
|
||||
|
||||
public int[] getLabelCoordinates() {
|
||||
return labelCoordinates;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1917,7 +1917,8 @@ public class BinaryMapIndexReader {
|
|||
|
||||
BinaryMapDataObject bm =
|
||||
new BinaryMapDataObject(o.id, o.coordinates, o.polygonInnerCoordinates, o.objectType, o.area,
|
||||
types.toArray(), additionalTypes.isEmpty() ? null : additionalTypes.toArray());
|
||||
types.toArray(), additionalTypes.isEmpty() ? null : additionalTypes.toArray(),
|
||||
o.labelCoordinates);
|
||||
if (o.namesOrder != null) {
|
||||
bm.objectNames = new TIntObjectHashMap<>();
|
||||
bm.namesOrder = new TIntArrayList();
|
||||
|
|
|
@ -50,7 +50,7 @@ public class OsmMapUtils {
|
|||
}
|
||||
|
||||
public static LatLon getComplexPolyCenter(Collection<Node> nodes) {
|
||||
double precision = 1e-4; //where to put constant?
|
||||
double precision = 1e-4; //where to set precision constant?
|
||||
|
||||
final List<List<LatLon>> rings = new ArrayList<>();
|
||||
List<LatLon> outerRing = new ArrayList<>();
|
||||
|
@ -59,7 +59,6 @@ public class OsmMapUtils {
|
|||
}
|
||||
rings.add(outerRing);
|
||||
return getPolylabelPoint(rings, precision);
|
||||
//return getPolylabelPoint(new Polygon(points), precision);
|
||||
}
|
||||
|
||||
public static LatLon getWeightCenter(Collection<LatLon> nodes) {
|
||||
|
|
Loading…
Reference in a new issue