package org.geometrycommands;

import com.vividsolutions.jts.geom.Geometry;

/**
 * Calculate the input Geometries Envelope
 * @author Jared Erickson
 */
public class EnvelopeCommand extends GeometryCommand<GeometryOptions> {

    /**
     * Get the Command's name
     * @return The Command's name
     */
    @Override
    public String getName() {
        return "envelope";
    }

    /**
     * Get a new GeometryOptions
     * @return A new GeometryOptions
     */
    @Override
    public GeometryOptions getOptions() {
        return new GeometryOptions();
    }

    /**
     * Calculate the input Geometries Envelope
     * @param geometry The input Geometry
     * @param options The GeometryOptions
     * @throws Exception if an error occurs
     */
    @Override
    protected void processGeometry(Geometry geometry, GeometryOptions options) throws Exception {
        Geometry outputGeometry = geometry.getEnvelope();
        System.out.println(writeGeoemtry(outputGeometry, options));
    }
}

@@ -59,24 +59,164 @@
 ts.geom.
-Geometry
+Envelope;%0Aimport com.vividsolutions.jts.geom.Geometry;%0Aimport org.geometrycommands.EnvelopeCommand.EnvelopeOptions;%0Aimport org.kohsuke.args4j.Option
 ;%0A%0A/**%0A 
@@ -340,24 +340,24 @@
 Command%3C
-Geometry
+Envelope
 Options%3E
@@ -539,32 +539,32 @@
 * Get a new 
-Geometry
+Envelope
 Options%0A    
@@ -576,32 +576,32 @@
 eturn A new 
-Geometry
+Envelope
 Options%0A    
@@ -629,24 +629,24 @@
  public 
-Geometry
+Envelope
 Options 
@@ -679,24 +679,24 @@
 urn new 
-Geometry
+Envelope
 Options(
@@ -828,24 +828,24 @@
 ons The 
-Geometry
+Envelope
 Options%0A
@@ -964,24 +964,24 @@
 ometry, 
-Geometry
+Envelope
 Options 
@@ -1008,16 +1008,171 @@
 ption %7B%0A
+        Envelope env = geometry.getEnvelopeInternal();%0A        if (options.getExpandBy() %3E 0) %7B%0A            env.expandBy(options.getExpandBy());%0A        %7D%0A
         
@@ -1213,17 +1213,32 @@
 .get
-Envelope(
+Factory().toGeometry(env
 );%0A 
@@ -1309,11 +1309,779 @@
 );%0A    %7D
+%0A%0A    /**%0A     * The EnvelopeOptions%0A     */%0A    public static class EnvelopeOptions extends GeometryOptions %7B%0A%0A        /**%0A         * The distance to expand the Envelope%0A         */%0A        @Option(name = %22-expandBy%22, usage = %22The distance to expand the Envelope%22, required = false)%0A        private double expandBy;%0A%0A        /**%0A         * Get the distance to expand the Envelope%0A         * @return The distance to expand the Envelope%0A         */%0A        public double getExpandBy() %7B%0A            return expandBy;%0A        %7D%0A%0A        /**%0A         * Set the distance to expand the Envelope%0A         * @param expandBy The distance to expand the Envelope%0A         */%0A        public void setExpandBy(double expandBy) %7B%0A            this.expandBy = expandBy;%0A        %7D%0A    %7D
 %0A%7D%0A

Add expandBy option to the EnvelopeCommand