Skip to content

Commit

Permalink
Better way to format this script
Browse files Browse the repository at this point in the history
  • Loading branch information
akidee committed Apr 14, 2012
1 parent 4cf38fb commit 2f848f8
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions src/index.coffee
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
_geos = require("../build/Release/geos")
exports.WKTReader = _geos.WKTReader
WKTWriter = _geos.WKTWriter
_Geometry = _geos.Geometry
exports.GeometryFactory = _geos.GeometryFactory
exports.PrecisionModel = _geos.PrecisionModel
exports.Quadtree = _geos.Quadtree
exports.geosversion = _geos.geosversion
exports.jtsport = _geos.jtsport
{
_Geometry
WKTWriter
GeoJSONWriter
} = exports = module.exports = require("../build/Release/geos")

_Geometry = exports.Geometry

Geometry = ->
throw new Error "Do not call Geometry constructor directly. Use WKTReader.read instead."

Geometry.prototype= _Geometry.prototype
Geometry.prototype = _Geometry.prototype

Geometry.prototype.toGeoJSON = Geometry.prototype.toJSON

exports.Geometry = Geometry


_setRoundingPrecision = WKTWriter.prototype.setRoundingPrecision

WKTWriter.prototype.setRoundingPrecision = (decimals) ->
if not (typeof decimals == "number") then throw new Error "TypeError: input must be of type number (int)"
else
_setRoundingPrecision.call @, decimals

exports.WKTWriter = WKTWriter

GeoJSONWriter = _geos.GeoJSONWriter

_write = GeoJSONWriter.prototype.write

Expand Down Expand Up @@ -54,6 +50,4 @@ _setRoundingPrecision = GeoJSONWriter.prototype.setRoundingPrecision
GeoJSONWriter.prototype.setRoundingPrecision = (decimals) ->
if not (typeof decimals == "number") then throw new Error "TypeError: input must be of type Number (int)"
else
_setRoundingPrecision.call @, decimals

exports.GeoJSONWriter = GeoJSONWriter
_setRoundingPrecision.call @, decimals

0 comments on commit 2f848f8

Please sign in to comment.