提交 d3b2588b authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Use only one factory in GeometryTarget()

上级 0eabe18c
...@@ -75,6 +75,11 @@ public final class JTSUtils { ...@@ -75,6 +75,11 @@ public final class JTSUtils {
this.dimensionSystem = dimensionSystem; this.dimensionSystem = dimensionSystem;
} }
private GeometryTarget(int dimensionSystem, GeometryFactory factory) {
this.dimensionSystem = dimensionSystem;
this.factory = factory;
}
@Override @Override
protected void startPoint(int srid) { protected void startPoint(int srid) {
init(POINT, srid); init(POINT, srid);
...@@ -125,7 +130,7 @@ public final class JTSUtils { ...@@ -125,7 +130,7 @@ public final class JTSUtils {
@Override @Override
protected Target startCollectionItem(int index, int total) { protected Target startCollectionItem(int index, int total) {
return new GeometryTarget(dimensionSystem); return new GeometryTarget(dimensionSystem, factory);
} }
@Override @Override
...@@ -134,9 +139,11 @@ public final class JTSUtils { ...@@ -134,9 +139,11 @@ public final class JTSUtils {
} }
private void init(int type, int srid) { private void init(int type, int srid) {
factory = new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING), srid, if (factory == null) {
factory = new GeometryFactory(new PrecisionModel(), srid,
(dimensionSystem & DIMENSION_SYSTEM_XYM) != 0 ? PackedCoordinateSequenceFactory.DOUBLE_FACTORY (dimensionSystem & DIMENSION_SYSTEM_XYM) != 0 ? PackedCoordinateSequenceFactory.DOUBLE_FACTORY
: CoordinateArraySequenceFactory.instance()); : CoordinateArraySequenceFactory.instance());
}
this.type = type; this.type = type;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论