21 package org.matsim.utils.gis.matsim2esri.network;
23 import java.lang.reflect.Constructor;
24 import java.lang.reflect.InvocationTargetException;
26 import org.geotools.api.referencing.crs.CoordinateReferenceSystem;
44 private CoordinateReferenceSystem
crs;
59 this.featureGeneratorPrototypeContructor =
PolygonFeatureGenerator.class.getConstructor(FEATURE_GENERATOR_PROTOTYPECONSTRUCTOR);
60 }
catch (SecurityException e) {
62 }
catch (NoSuchMethodException e) {
67 this.widthCalculatorPrototypeContructor =
LanesBasedWidthCalculator.class.getConstructor(WIDTH_CALCULATOR_PROTOTYPECONSTRUCTOR);
68 }
catch (SecurityException e) {
70 }
catch (NoSuchMethodException e) {
82 ret = this.featureGeneratorPrototypeContructor.newInstance(widthCalc, this.crs);
84 }
catch (IllegalArgumentException e) {
86 }
catch (InstantiationException e) {
88 }
catch (IllegalAccessException e) {
90 }
catch (InvocationTargetException e) {
94 "Could not instantiate feature generator from prototype! " + this.featureGeneratorPrototypeContructor.getDeclaringClass().getCanonicalName(),
102 ret = this.widthCalculatorPrototypeContructor.newInstance(this.network, this.widthCoefficient);
104 }
catch (IllegalArgumentException e) {
106 }
catch (InstantiationException e) {
108 }
catch (IllegalAccessException e) {
110 }
catch (InvocationTargetException e) {
114 "Could not instantiate width calculator from prototype!",
121 this.widthCoefficient = coef;
131 Constructor<? extends WidthCalculator> c = prototype.getConstructor(WIDTH_CALCULATOR_PROTOTYPECONSTRUCTOR);
133 this.widthCalculatorPrototypeContructor = c;
136 throw new IllegalArgumentException(
"Wrong prototype constructor!");
138 }
catch (SecurityException e) {
140 }
catch (NoSuchMethodException e) {
148 Constructor<? extends FeatureGenerator> c = prototype.getConstructor(FEATURE_GENERATOR_PROTOTYPECONSTRUCTOR);
150 this.featureGeneratorPrototypeContructor = c;
153 throw new IllegalArgumentException(
"Wrong prototype constructor!");
155 }
catch (SecurityException e) {
157 }
catch (NoSuchMethodException e) {
void setFeatureGeneratorPrototype(final Class<? extends FeatureGenerator > prototype)
Constructor<? extends WidthCalculator > widthCalculatorPrototypeContructor
FeatureGeneratorBuilderImpl(final Network network, final String coordinateSystem)
static final Class [] WIDTH_CALCULATOR_PROTOTYPECONSTRUCTOR
void setWidthCoefficient(final double coef)
void setCoordinateReferenceSystem(final CoordinateReferenceSystem crs)
void setWidthCalculatorPrototype(final Class<? extends WidthCalculator > prototype)
CoordinateReferenceSystem crs
Constructor<? extends FeatureGenerator > featureGeneratorPrototypeContructor
WidthCalculator createWidthCalculator()
FeatureGenerator createFeatureGenerator()
static final Class [] FEATURE_GENERATOR_PROTOTYPECONSTRUCTOR