diff --git a/src/main/scala/com/phasmidsoftware/kmldoc/KML.scala b/src/main/scala/com/phasmidsoftware/kmldoc/KML.scala
index fdf6fc2..5a3776c 100644
--- a/src/main/scala/com/phasmidsoftware/kmldoc/KML.scala
+++ b/src/main/scala/com/phasmidsoftware/kmldoc/KML.scala
@@ -416,7 +416,6 @@ case class Placemark(Geometry: Seq[Geometry])(val featureData: FeatureData) exte
for (ls <- lso) yield Placemark(ls)(featureData)
}
-
/**
* Merge this mergeable object with t
.
*
@@ -496,7 +495,7 @@ case class Placemark(Geometry: Seq[Geometry])(val featureData: FeatureData) exte
private def joinMatchingPlacemarks(name: String, feature: Feature, mergeName: Boolean) = feature match {
case q: Placemark if q.name.matches(name) => merge(q, mergeName)
- case _ => None
+ case _ => None // FIXME can result in this Placemark being lost if name doesn't match q.name
}
}
diff --git a/src/test/resources/emptyDescriptor.kml b/src/test/resources/emptyDescriptor.kml
new file mode 100644
index 0000000..d8db9eb
--- /dev/null
+++ b/src/test/resources/emptyDescriptor.kml
@@ -0,0 +1,193 @@
+
+
+
+ MA - Boston NE: Historic New England Railroads
+
+
+ MA-Boston NE
+
+
+ RDK1: 56: Wilmington Jct. to Tewksbury Jct.]]>
+ #line-993399-5000
+
+ 1
+
+ -71.154392,42.584563,0
+ -71.17272,42.5936,0
+ -71.182786,42.598702,0
+ -71.190312,42.602425,0
+ -71.20756,42.61094,0
+ -71.207843,42.61112,0
+ -71.209012,42.612099,0
+ -71.21204,42.61479,0
+ -71.212424,42.615004,0
+ -71.21282,42.61517,0
+ -71.213325,42.615241,0
+ -71.213722,42.615289,0
+ -71.214162,42.615352,0
+ -71.2146,42.61539,0
+ -71.215342,42.61536,0
+ -71.216587,42.615178,0
+ -71.223979,42.613342,0
+ -71.225084,42.613102,0
+ -71.225438,42.613041,0
+ -71.225717,42.613007,0
+ -71.226039,42.612991,0
+ -71.227369,42.612983,0
+ -71.231843,42.613094,0
+ -71.232283,42.613109,0
+ -71.232723,42.613173,0
+ -71.233131,42.613228,0
+ -71.233528,42.613315,0
+
+
+
+
+
+ K374
K147
RDK1: 56 - Peabody to Wilmington Jct.]]>
+ #line-6600CC-5000
+
+ 1
+
+ -70.8931562,42.5287745,0
+ -70.8935907,42.5281648,0
+ -70.8938509,42.5278416,0
+ -70.8939669,42.5277146,0
+ -70.8941097,42.5275816,0
+ -70.8943873,42.5273197,0
+ -70.8944913,42.5272021,0
+ -70.8946301,42.5270074,0
+ -70.8948755,42.5266437,0
+ -70.8950395,42.5263835,0
+ -70.8952115,42.526157,0
+ -70.8955662,42.5257473,0
+ -70.8957063,42.5256099,0
+ -70.895884,42.5254686,0
+ -70.8960543,42.5253732,0
+ -70.8962542,42.5252778,0
+ -70.8976274,42.5247134,0
+ -70.8986051,42.5243428,0
+ -70.8997142,42.5239198,0
+ -70.9008702,42.5234819,0
+ -70.9020062,42.5230707,0
+ -70.903995,42.5222948,0
+ -70.9051665,42.5218071,0
+ -70.9060885,42.5214616,0
+ -70.906669,42.5212532,0
+ -70.906929,42.5211811,0
+ -70.9072937,42.521115,0
+ -70.907713,42.5210872,0
+ -70.908143,42.5211008,0
+ -70.9084884,42.5211448,0
+ -70.9088243,42.5212165,0
+ -70.9091073,42.5213025,0
+ -70.9103545,42.5217917,0
+ -70.9112059,42.5221314,0
+ -70.912009,42.5224483,0
+ -70.9123799,42.5226022,0
+ -70.9127026,42.5227244,0
+ -70.9130212,42.5228437,0
+ -70.9132808,42.5229314,0
+ -70.9141349,42.5231663,0
+ -70.9151392,42.5234289,0
+ -70.9160847,42.5236945,0
+ -70.9169859,42.5239364,0
+ -70.9187454,42.5244142,0
+ -70.9196227,42.5246503,0
+ -70.920622,42.5249161,0
+ -70.921538,42.5251523,0
+ -70.9224915,42.5253984,0
+ -70.9232989,42.5256089,0
+ -70.9243557,42.5258871,0
+ -70.92475,42.52602,0
+ -70.93033,42.52819,0
+ -70.93159,42.52887,0
+ -70.93412,42.53068,0
+ -70.93614,42.53197,0
+ -70.93725,42.53253,0
+ -70.938399,42.533018,0
+ -70.939536,42.533429,0
+ -70.94018,42.533587,0
+ -70.94081,42.53373,0
+ -70.95578,42.5367,0
+ -70.957797,42.537271,0
+ -70.95962,42.53786,0
+ -70.9609,42.53821,0
+ -70.961895,42.53841,0
+ -70.96344,42.5386,0
+ -70.96585,42.53875,0
+ -70.96703,42.5389,0
+ -70.986378,42.54271,0
+ -70.9904,42.54347,0
+ -70.99112,42.54358,0
+ -70.991786,42.543643,0
+ -70.992708,42.543675,0
+ -70.994275,42.543738,0
+ -70.995069,42.543785,0
+ -70.99571,42.54388,0
+ -70.99676,42.54408,0
+ -70.99752,42.54431,0
+ -70.99829,42.54466,0
+ -70.99897,42.54506,0
+ -70.99946,42.54541,0
+ -70.9999,42.54582,0
+ -71.000648,42.546726,0
+ -71.00157,42.548496,0
+ -71.002386,42.550219,0
+ -71.002879,42.551183,0
+ -71.003158,42.551895,0
+ -71.00333,42.55251,0
+ -71.00462,42.55993,0
+ -71.0048,42.56048,0
+ -71.00527,42.56133,0
+ -71.005754,42.561931,0
+ -71.006591,42.562738,0
+ -71.007278,42.563227,0
+ -71.00799,42.56361,0
+ -71.008501,42.563844,0
+ -71.009402,42.564223,0
+ -71.014166,42.566041,0
+ -71.01614,42.566878,0
+ -71.01781,42.56749,0
+ -71.018393,42.567668,0
+ -71.019037,42.567858,0
+ -71.02281,42.56874,0
+ -71.0238,42.569012,0
+ -71.024637,42.569154,0
+ -71.02568,42.56923,0
+ -71.027706,42.569233,0
+ -71.029165,42.56917,0
+ -71.030431,42.569154,0
+ -71.031075,42.569185,0
+ -71.031654,42.569249,0
+ -71.035409,42.569628,0
+ -71.04939,42.57094,0
+ -71.055686,42.571572,0
+ -71.060386,42.571951,0
+ -71.061308,42.57203,0
+ -71.062188,42.572061,0
+ -71.064312,42.572061,0
+ -71.06663,42.572046,0
+ -71.072402,42.572046,0
+ -71.084268,42.571967,0
+ -71.086929,42.571935,0
+ -71.090598,42.571967,0
+ -71.096649,42.572156,0
+ -71.099074,42.572219,0
+ -71.099696,42.572235,0
+ -71.100276,42.572283,0
+ -71.10126,42.57244,0
+ -71.11686,42.57547,0
+ -71.12643,42.57723,0
+ -71.13037,42.57801,0
+ -71.13306,42.57861,0
+ -71.15044,42.58268,0
+ -71.15116,42.58295,0
+ -71.15335,42.584,0
+ -71.15467,42.58472,0
+
+
+
+
+
+
diff --git a/src/test/scala/com/phasmidsoftware/kmldoc/KmlSpec.scala b/src/test/scala/com/phasmidsoftware/kmldoc/KmlSpec.scala
index ceab66f..3f14e56 100644
--- a/src/test/scala/com/phasmidsoftware/kmldoc/KmlSpec.scala
+++ b/src/test/scala/com/phasmidsoftware/kmldoc/KmlSpec.scala
@@ -4252,6 +4252,34 @@ class KmlSpec extends AnyFlatSpec with should.Matchers {
}
}
+ // TODO Issue #19
+ ignore should "extract and render placemarks without descriptor" in {
+ val url = KML.getClass.getResource("/emptyDescriptor.kml")
+ val xml: Elem = XML.loadFile(url.getFile)
+ extractMulti[Seq[KML]](xml) match {
+ case Success(ks) =>
+ ks.size shouldBe 1
+ val kml = KML_Binding(ks.head, xml.scope)
+ val filename = "emptyDescriptor_out.kml"
+ val fw = new FileWriter(filename)
+ fw.write(
+ """
+ |""".stripMargin)
+ Renderer.render(kml, FormatXML(), StateR().setName("kml")) match {
+ case Success(w) =>
+ fw.write(w)
+ fw.close()
+ val copy: Elem = parseUnparsed(w)
+ val ksy: Try[scala.Seq[KML]] = extractMulti[Seq[KML]](copy)
+ ksy should matchPattern { case Success(_ :: Nil) => }
+ case Failure(x) =>
+ x.printStackTrace()
+ fail("see exception above")
+ }
+ case Failure(x) => fail(x)
+ }
+ }
+
behavior of "merge"
val kd: KmlData = KmlData(None)