Source code:
fire.require(
function(){
var output = $("#output > pre > code");
output.append("Creating polygon square...<br/>");
var pm = new fire.gear.geom.PrecisionModel(fire.gear.geom.PrecisionModel.FLOATING);
var factory = new fire.gear.geom.GeometryFactory(pm);
var c1 = new fire.gear.geom.Coordinate(8, 43);
var c2 = new fire.gear.geom.Coordinate(8, 44);
var c3 = new fire.gear.geom.Coordinate(9, 44);
var c4 = new fire.gear.geom.Coordinate(9, 43);
var shell = factory.createLinearRing([c1,c2,c3,c4,c1]);
var holes = null;
var pg = factory.createPolygon(shell, holes);
output.append("Area: " + pg.getArea() + "<br/>");
output.append("Length: " + pg.getLength() + "<br/>");
var coords = pg.getExteriorRing().getCoordinates();
output.append("Exterior: " + coords + "<br/>");
var pt1 = factory.createPoint(new fire.gear.geom.Coordinate(7, 42));
var pt2 = factory.createPoint(new fire.gear.geom.Coordinate(8.5, 43.5));
output.append("Distance to " + pt1.toString() + " is " + pg.distance(pt1) + "<br/>");
output.append("Distance to " + pt2.toString() + " is " + pg.distance(pt2) + "<br/>");
output.append("intersects " + pt1.toString() + ": " + pg.intersects(pt1) + "<br/>");
output.append("intersects " + pt2.toString() + ": " + pg.intersects(pt2) + "<br/>");
var buffer = pg.buffer(0.5);
output.append("Buffer: " + buffer.toString() + "<br/>");
output.append("Buffer area: " + buffer.getArea() + "<br/>");
} , {
modules : [fire.Modules.GEAR]
,mode : fire.Mode.BUILD
,otherScripts: []
,relative: "../lib/fire/"
}
);