Skip to content

Commit

Permalink
minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
workingDog committed Apr 29, 2014
1 parent a684469 commit 81c648d
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 31 deletions.
4 changes: 1 addition & 3 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 0 additions & 20 deletions .idea/libraries/scala_2_10_3.xml

This file was deleted.

Binary file modified bin/scalakml.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ organization := "com.kodekutters"

version := "1.0"

scalaVersion := "2.10.3"
scalaVersion := "2.10.4"
10 changes: 9 additions & 1 deletion scalakml.iml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="scala" name="Scala">
<configuration>
<option name="compilerLibraryLevel" value="Global" />
<option name="compilerLibraryName" value="scala-2.10.4" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="scala-2.10.3" level="project" />
<orderEntry type="library" name="scalaxal" level="project" />
<orderEntry type="library" name="scala-library" level="project" />
</component>
</module>

6 changes: 4 additions & 2 deletions src/main/scala/com/scalakml/example/WriteExample1.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.scalakml.example

import com.scalakml.io.{KmlPrintWriter, KmlFileReader}
import com.scalakml.io.{KmlPrintWriter}
import xml.PrettyPrinter
import com.scalakml.kml._
import com.scalakml.kml.FeaturePart
import com.scalakml.kml.Point
import com.scalakml.kml.Placemark
import scala.Some


/**
* Author: Ringo Wathelet
Expand All @@ -17,6 +17,7 @@ import scala.Some
object WriteExample1 {
def main(args: Array[String]) {
println("....WriteExample1 start...\n")

// create a Point at a location
val point = Point(coordinates = Option(Seq.empty :+ new Location(151.21037, -33.8526)))
// create a Placemark with the point, and a name
Expand All @@ -25,6 +26,7 @@ object WriteExample1 {
val kml = Kml(feature = Option(placemark))
// write the kml to the output file
new KmlPrintWriter("./kml-files/Sydney-oz.kml").write(Option(kml), new PrettyPrinter(80, 3))

println("\n....WriteExample1 done...")
}
}
2 changes: 1 addition & 1 deletion src/main/scala/com/scalakml/example/WriteExample4.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ object WriteExample4 {
// create a scala Kml object with a Placemark that contains a Point
val kml = new Kml(new Placemark("Sydney", new Point(RelativeToGround, 151.21037, -33.8526, 12345.0)))
// write the kml object to System.out as xml
new KmlPrintWriter().write(Option(kml), new PrettyPrinter(80, 3))
new KmlPrintWriter().write(kml, new PrettyPrinter(80, 3))
}
}
1 change: 1 addition & 0 deletions src/main/scala/com/scalakml/io/KmlFromXml.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import scala.xml._
import com.scalaxal.io.XalFromXml._
import scala.language.postfixOps
import scala.language.implicitConversions
import scala.collection.mutable

/**
* @author Ringo Wathelet
Expand Down
17 changes: 17 additions & 0 deletions src/main/scala/com/scalakml/io/KmlPrintWriter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ package com.scalakml.io
import java.io._
import xml.{dtd, XML, PrettyPrinter}
import scala.Some
import com.scalakml.kml.Kml

/**
* @author Ringo Wathelet
Expand Down Expand Up @@ -82,6 +83,22 @@ class KmlPrintWriter(writer: Option[PrintWriter] = Some(new PrintWriter(System.o
}
}

/**
* convenience method
* @param value the Kml element
* @param pretty the pretty printer to use
*/
def write(value: Kml, pretty: PrettyPrinter) = write[Option[Kml]](Option(value), pretty)

/**
* convenience method
* @param value the Kml element
*/
def write(value: Kml) = write[Option[Kml]](Option(value))

/**
* close the writer
*/
def close() = if (writer.isDefined) writer.get.close()

}
11 changes: 8 additions & 3 deletions src/main/scala/com/scalakml/kml/Kml.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ package com.scalakml.kml
import com.scalakml.atom._
import com.scalaxal.xAL.AddressDetails
import com.scalakml.gx.LatLonQuad
import scala.collection.mutable

/**
* package of classes and constructs for the Google KML Version 2.2 model
Expand Down Expand Up @@ -1006,8 +1007,8 @@ case class FeaturePart(

/**
* returns a new object with value added to the sequence
* @param value to add
* @return a new object with value added to the sequence
* @param value to add to styleSelector
* @return a new FeaturePart with value added to the sequence of styleSelector
*/
def addToStyleSelector(value: StyleSelector) = {
this.copy(styleSelector = if (styleSelector == Nil) (Seq.empty :+ value) else (styleSelector :+ value))
Expand Down Expand Up @@ -1063,6 +1064,9 @@ case class Placemark(
objectSimpleExtensionGroup: Seq[Any] = Nil) extends Feature {

def this(geom: Geometry) = this(Option(geom))
def this(geom: Geometry, featurePart: FeaturePart) = this(Option(geom), featurePart)
def this(geom: Geometry, featurePart: FeaturePart, id: String) = this(Option(geom), featurePart, Option(id))
def this(geom: Geometry, featurePart: FeaturePart, id: String, targetId: String) = this(Option(geom), featurePart, Option(id), Option(targetId))
def this(name: String) = this(None, new FeaturePart(name = Option(name)))
def this(name: String, geom: Geometry) = this(Option(geom), new FeaturePart(name = Option(name)))
def this(name: String, geom: Geometry, id: String) = this(Option(geom), new FeaturePart(name = Option(name)), Option(id))
Expand Down Expand Up @@ -1460,7 +1464,8 @@ case class Document(featurePart: FeaturePart = new FeaturePart(),

def this(feature: Feature) = this(new FeaturePart(), Nil, (Seq.empty :+ feature))
def this(name: String, feature: Feature) = this(new FeaturePart(name = Option(name)), Nil, (Seq.empty :+ feature))
def this(name: String, feature: Feature, schema: Schema) =
def this(name: String, schema: Schema) = this(new FeaturePart(name = Option(name)), (Seq.empty :+ schema), Nil)
def this(name: String, schema: Schema, feature: Feature) =
this(new FeaturePart(name = Option(name)), (Seq.empty :+ schema), (Seq.empty :+ feature))

/**
Expand Down

0 comments on commit 81c648d

Please sign in to comment.