@@ -99,6 +99,7 @@ package builder {
99
99
sealed trait Fields [T ] {
100
100
def conformsTo (schema : Schema ): Boolean
101
101
def fields : Seq [Field ]
102
+ def values (t : T ): Seq [AnyRef ]
102
103
def unapply (feature : Feature ): Option [T ]
103
104
def update (feature : Feature , value : T ): Unit
104
105
@@ -151,7 +152,7 @@ package builder {
151
152
featureFactory : org.opengis.feature.FeatureFactory )
152
153
: T => Feature = {
153
154
t =>
154
- val feature = featureFactory.createSimpleFeature(Array .empty , schema, null )
155
+ val feature = featureFactory.createSimpleFeature(values(t).toArray , schema, " " )
155
156
update(feature, t)
156
157
feature
157
158
}
@@ -165,6 +166,10 @@ package builder {
165
166
def conformsTo (schema : Schema ): Boolean =
166
167
(tFields conformsTo schema) && (uFields conformsTo schema)
167
168
def fields = tFields.fields ++ uFields.fields
169
+ def values (x : T ~ U ): Seq [AnyRef ] = {
170
+ val (t ~ u) = x
171
+ tFields.values(t) ++ uFields.values(u)
172
+ }
168
173
def update (feature : Feature , value : T ~ U ) {
169
174
val (t ~ u) = value
170
175
tFields(feature) = t
@@ -182,6 +187,7 @@ package builder {
182
187
def conformsTo (schema : Schema ): Boolean = schema.fields.exists(field =>
183
188
field.name == name && field.binding.isAssignableFrom(clazz))
184
189
def fields = Seq (schemaBuilder.Field (name, clazz))
190
+ def values (t : T ): Seq [AnyRef ] = Seq (t)
185
191
def update (feature : Feature , value : T ) {
186
192
feature.setAttribute(name, value)
187
193
}
0 commit comments