Example usage for java.awt.geom AffineTransform getShearY

List of usage examples for java.awt.geom AffineTransform getShearY

Introduction

In this page you can find the example usage for java.awt.geom AffineTransform getShearY.

Prototype

public double getShearY() 

Source Link

Document

Returns the Y coordinate shearing element (m10) of the 3x3 affine transformation matrix.

Usage

From source file:Main.java

public void paint(Graphics g) {
    Shape shape = new Rectangle2D.Float(100, 50, 80, 80);

    Graphics2D g2 = (Graphics2D) g;

    AffineTransform at = new AffineTransform();
    at.setToQuadrantRotation(2, 0.5, 0.5);

    System.out.println(at.getShearY());

    g2.setTransform(at);/*from ww w. j  a  va 2s  .co m*/
    g2.draw(shape);

}

From source file:Matrix.java

/**
 * Set the values of the matrix from the AffineTransform.
 * // w  ww .  j ava2  s  . c o  m
 * @param af The transform to get the values from.
 */
public void setFromAffineTransform(AffineTransform af) {
    single[0] = (float) af.getScaleX();
    single[1] = (float) af.getShearY();
    single[3] = (float) af.getShearX();
    single[4] = (float) af.getScaleY();
    single[6] = (float) af.getTranslateX();
    single[7] = (float) af.getTranslateY();
}

From source file:org.apache.fop.render.pcl.PCLRenderingUtil.java

/**
 * Determines the print direction based on the given transformation matrix. This method
 * only detects right angles (0, 90, 180, 270). If any other angle is determined, 0 is
 * returned.//from  w  ww. j a  va2  s.  co m
 * @param transform the transformation matrix
 * @return the angle in degrees of the print direction.
 */
public static int determinePrintDirection(AffineTransform transform) {
    int newDir;
    if (transform.getScaleX() == 0 && transform.getScaleY() == 0 && transform.getShearX() == 1
            && transform.getShearY() == -1) {
        newDir = 90;
    } else if (transform.getScaleX() == -1 && transform.getScaleY() == -1 && transform.getShearX() == 0
            && transform.getShearY() == 0) {
        newDir = 180;
    } else if (transform.getScaleX() == 0 && transform.getScaleY() == 0 && transform.getShearX() == -1
            && transform.getShearY() == 1) {
        newDir = 270;
    } else {
        newDir = 0;
    }
    return newDir;
}

From source file:org.geoserver.data.test.MockData.java

void coverageInfo(QName name, File coverageFile, String styleName) throws Exception {
    String coverage = name.getLocalPart();

    File coverageDir = new File(coverages, coverage);
    coverageDir.mkdir();//from   w  w  w .j  av  a  2 s .  c o m

    File info = new File(coverageDir, "info.xml");
    info.createNewFile();

    // let's grab the necessary metadata
    AbstractGridFormat format = (AbstractGridFormat) GridFormatFinder.findFormat(coverageFile);
    GridCoverage2DReader reader;
    try {
        reader = (GridCoverage2DReader) format.getReader(coverageFile);
    } catch (Exception e) {
        String message = "Exception while trying to read " + coverageFile.getCanonicalPath() + " with format"
                + format.getName();
        throw new RuntimeException(message, e);
    }

    if (reader == null) {
        throw new RuntimeException(
                "No reader for " + coverageFile.getCanonicalPath() + " with format " + format.getName());
    }
    // basic info
    FileWriter writer = new FileWriter(info);
    writer.write("<coverage format=\"" + coverage + "\">\n");
    writer.write("<name>" + coverage + "</name>\n");
    writer.write("<label>" + coverage + "</label>\n");
    writer.write("<description>" + coverage + " description</description>\n");
    writer.write(
            "<metadataLink about = \"http://www.remotesensing.org:16080/websites/geotiff/geotiff.html\" metadataType = \"other\" />");
    writer.write("<keywords>WCS," + coverage + " </keywords>\n");
    if (styleName == null)
        styleName = "raster";
    writer.write("<styles default=\"" + styleName + "\"/>\n");

    // envelope
    CoordinateReferenceSystem crs = reader.getCoordinateReferenceSystem();
    GeneralEnvelope envelope = reader.getOriginalEnvelope();
    GeneralEnvelope wgs84envelope = CoverageStoreUtils.getWGS84LonLatEnvelope(envelope);
    final String nativeCrsName = CRS.lookupIdentifier(crs, false);
    writer.write("<envelope crs=\"" + crs.toString().replaceAll("\"", "'") + "\" srsName=\"" + nativeCrsName
            + "\">\n");
    writer.write("<pos>" + wgs84envelope.getMinimum(0) + " " + wgs84envelope.getMinimum(1) + "</pos>\n");
    writer.write("<pos>" + wgs84envelope.getMaximum(0) + " " + wgs84envelope.getMaximum(1) + "</pos>\n");
    writer.write("</envelope>\n");

    /**
     * Now reading a fake small GridCoverage just to retrieve meta information:
     * - calculating a new envelope which is 1/20 of the original one
     * - reading the GridCoverage subset
     */

    final ParameterValueGroup readParams = reader.getFormat().getReadParameters();
    final Map parameters = CoverageUtils.getParametersKVP(readParams);
    double[] minCP = envelope.getLowerCorner().getCoordinate();
    double[] maxCP = new double[] { minCP[0] + (envelope.getSpan(0) / 20.0),
            minCP[1] + (envelope.getSpan(1) / 20.0) };
    final GeneralEnvelope subEnvelope = new GeneralEnvelope(minCP, maxCP);
    subEnvelope.setCoordinateReferenceSystem(reader.getCoordinateReferenceSystem());

    parameters.put(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString(),
            new GridGeometry2D(reader.getOriginalGridRange(), subEnvelope));
    GridCoverage2D gc = (GridCoverage2D) reader.read(CoverageUtils.getParameters(readParams, parameters, true));

    // grid geometry
    final GridGeometry geometry = gc.getGridGeometry();
    final int dimensions = geometry.getGridRange().getDimension();
    String lower = "";
    String upper = "";
    for (int i = 0; i < dimensions; i++) {
        lower = lower + geometry.getGridRange().getLow(i) + " ";
        upper = upper + geometry.getGridRange().getHigh(i) + " ";
    }
    writer.write("<grid dimension = \"" + dimensions + "\">\n");
    writer.write("<low>" + lower + "</low>\n");
    writer.write("<high>" + upper + "</high>\n");
    final CoordinateSystem cs = crs.getCoordinateSystem();
    for (int i = 0; i < cs.getDimension(); i++) {
        writer.write("<axisName>" + cs.getAxis(i).getName().getCode() + "</axisName>\n");
    }
    if (geometry.getGridToCRS() instanceof AffineTransform) {
        AffineTransform aTX = (AffineTransform) geometry.getGridToCRS();
        writer.write("<geoTransform>");
        writer.write("<scaleX>" + aTX.getScaleX() + "</scaleX>\n");
        writer.write("<scaleY>" + aTX.getScaleY() + "</scaleY>\n");
        writer.write("<shearX>" + aTX.getShearX() + "</shearX>\n");
        writer.write("<shearY>" + aTX.getShearY() + "</shearY>\n");
        writer.write("<translateX>" + aTX.getTranslateX() + "</translateX>\n");
        writer.write("<translateY>" + aTX.getTranslateY() + "</translateY>\n");
        writer.write("</geoTransform>\n");
    }
    writer.write("</grid>\n");

    // coverage dimensions
    final GridSampleDimension[] sd = gc.getSampleDimensions();
    for (int i = 0; i < sd.length; i++) {
        writer.write("<CoverageDimension>\n");
        writer.write("<name>" + sd[i].getDescription().toString() + "</name>\n");
        writer.write("<interval>\n");
        writer.write("<min>" + sd[i].getMinimumValue() + "</min>\n");
        writer.write("<max>" + sd[i].getMaximumValue() + "</max>\n");
        writer.write("</interval>\n");
        final List<Category> categories = sd[i].getCategories();
        if (categories != null && categories.size() >= 1) {
            writer.write("<nullValues>\n");
            for (Iterator<Category> it = sd[i].getCategories().iterator(); it.hasNext();) {
                Category cat = (Category) it.next();
                if ((cat != null) && cat.getName().toString().equalsIgnoreCase("no data")) {
                    double min = cat.getRange().getMinimum();
                    double max = cat.getRange().getMaximum();
                    writer.write("<value>" + min + "</value>\n");
                    if (min != max)
                        writer.write("<value>" + max + "</value>\n");
                }
            }
            writer.write("</nullValues>\n");
        } else
            writer.write("<nullValues/>\n");
        writer.write("</CoverageDimension>\n");
    }

    // supported crs
    writer.write("<supportedCRSs>\n");
    writer.write("<requestCRSs>" + nativeCrsName + "</requestCRSs>\n");
    writer.write("<responseCRSs>" + nativeCrsName + "</responseCRSs>\n");
    writer.write("</supportedCRSs>\n");

    // supported formats
    writer.write("<supportedFormats nativeFormat = \"" + format.getName() + "\">\n");
    writer.write("<formats>ARCGRID,ARCGRID-GZIP,GEOTIFF,PNG,GIF,TIFF</formats>\n");
    writer.write("</supportedFormats>\n");

    // supported interpolations
    writer.write("<supportedInterpolations default = \"nearest neighbor\">\n");
    writer.write("<interpolationMethods>nearest neighbor</interpolationMethods>\n");
    writer.write("</supportedInterpolations>\n");

    // the end
    writer.write("</coverage>\n");
    writer.flush();
    writer.close();
}

From source file:org.jcurl.core.base.CurveTransformedTest.java

public void testAffineTransformRotate() {
    final Rock v0 = new RockDouble(1, 1.5, 0.3);
    final double[] d = { v0.getY(), -v0.getX(), v0.getX(), v0.getY(), 0, 0 };
    final AffineTransform at = new AffineTransform(d);
    final double v = v0.distance(0, 0);
    at.scale(1 / v, 1 / v);/*from w  w w .  j ava 2 s  . c om*/
    assertEquals(AffineTransform.TYPE_GENERAL_ROTATION, at.getType());
    assertEquals("", 1.0, at.getDeterminant(), 1e-9);
    assertEquals("", 0.8320502943378437, at.getScaleX(), 1e-9);
    assertEquals("", at.getScaleX(), at.getScaleY(), 1e-9);
    assertEquals("", 0.5547001962252291, at.getShearX(), 1e-9);
    assertEquals("", -at.getShearX(), at.getShearY(), 1e-9);
    assertEquals("", 0.0, at.getTranslateX(), 1e-9);
    assertEquals("", 0.0, at.getTranslateY(), 1e-9);
    Point2D p = null;
    p = at.transform(new Point2D.Double(1, 0), null);
    assertEquals("Point2D.Double[0.8320502943378437, -0.5547001962252291]", p.toString());
    assertEquals("", 1.0, p.distanceSq(0, 0), 1e-9);
    p = at.transform(new Point2D.Double(0, 1), null);
    assertEquals("Point2D.Double[0.5547001962252291, 0.8320502943378437]", p.toString());
    assertEquals("", 1.0, p.distanceSq(0, 0), 1e-9);
    p = at.transform(new Point2D.Double(0.75, 1.5), null);
    assertEquals("Point2D.Double[1.4560880150912265, 0.8320502943378438]", p.toString());
    p = at.transform(new Point2D.Double(1.5, 3.0), null);
    assertEquals("Point2D.Double[2.912176030182453, 1.6641005886756877]", p.toString());
}

From source file:org.jcurl.core.base.CurveTransformedTest.java

/**
 * Test the transformation from a Rock Coordinates (rc) System at wc(3,3.5)
 * with positive y axis along wc(2,4.2) into World Coordinates (wc). Uses a
 * Point rc(5,1.3) = wc(8,2.5)./*from  w ww. j ava  2s . c o  m*/
 */
public void testAffineTransformRotateShift() {
    final Point2D p0_wc = new Point2D.Double(3, 3.5);
    final Rock v0_wc = new RockDouble(2, 4.2, 0.3);
    final double v = v0_wc.distance(0, 0);
    final double[] d = { v0_wc.getY(), -v0_wc.getX(), v0_wc.getX(), v0_wc.getY(), 0, 0 };
    final AffineTransform at = new AffineTransform(d);
    at.scale(1 / v, 1 / v);
    assertEquals(AffineTransform.TYPE_GENERAL_ROTATION + AffineTransform.TYPE_UNIFORM_SCALE, at.getType());
    assertEquals(1.0, at.getDeterminant());
    assertEquals(0.9028605188239303, at.getScaleX());
    assertEquals(at.getScaleX(), at.getScaleY());
    assertEquals(0.42993358039234775, at.getShearX());
    assertEquals(-at.getShearX(), at.getShearY());
    assertEquals(0, at.getTranslateX());
    assertEquals(0, at.getTranslateY());
    Point2D p = null;
    p = at.transform(new Point2D.Double(5, 1.3), null);
    assertEquals("Point2D.Double[5.073216248629703, -0.9759492274906292]", p.toString());

    at.preConcatenate(AffineTransform.getTranslateInstance(p0_wc.getX(), p0_wc.getY()));
    assertEquals(AffineTransform.TYPE_GENERAL_ROTATION + AffineTransform.TYPE_TRANSLATION
            + AffineTransform.TYPE_UNIFORM_SCALE, at.getType());
    assertEquals(1.0, at.getDeterminant());
    assertEquals(0.9028605188239303, at.getScaleX());
    assertEquals(at.getScaleX(), at.getScaleY());
    assertEquals(0.42993358039234775, at.getShearX());
    assertEquals(-at.getShearX(), at.getShearY());
    assertEquals(p0_wc.getX(), at.getTranslateX());
    assertEquals(p0_wc.getY(), at.getTranslateY());

    p = at.transform(new Point2D.Double(5, 1.3), null);
    assertEquals("Point2D.Double[8.073216248629702, 2.524050772509371]", p.toString());
}

From source file:org.jcurl.core.base.CurveTransformedTest.java

/**
 * Test the transformation from a Rock Coordinates (rc) System at wc(3,3.5)
 * with positive y axis along wc(2,4.2) into World Coordinates (wc). Uses a
 * Point rc(5,1.3) = wc(8,2.5).// w ww  .j a va 2  s.c om
 * 
 * @see CurveTransformed#createRc2Wc(AffineTransform, Point2D, Point2D)
 */
public void testCreateRc2Wc() {
    final Point2D p0_wc = new Point2D.Double(3, 3.5);
    final Rock v0_wc = new RockDouble(2, 4.2, 0.3);
    final AffineTransform at = CurveTransformed.createRc2Wc(null, p0_wc, v0_wc);
    assertEquals(AffineTransform.TYPE_GENERAL_ROTATION + AffineTransform.TYPE_TRANSLATION, at.getType());
    assertEquals(1.0, at.getDeterminant());
    assertEquals(0.9028605188239303, at.getScaleX());
    assertEquals(at.getScaleX(), at.getScaleY());
    assertEquals(0.42993358039234775, at.getShearX());
    assertEquals(-at.getShearX(), at.getShearY());
    assertEquals(p0_wc.getX(), at.getTranslateX());
    assertEquals(p0_wc.getY(), at.getTranslateY());

    final Point2D rc = new Point2D.Double(5, 1.3);
    final Point2D wc = at.transform(rc, null);
    assertEquals("Point2D.Double[8.073216248629704, 2.524050772509371]", wc.toString());

    // angle in rc:
    double ang = Math.atan2(rc.getY(), rc.getX());
    assertEquals(14.574216198038739, rad2deg(ang));

    // wc rotation:
    ang = Math.atan2(at.getShearY(), at.getScaleY());
    assertEquals(-25.463345061871614, rad2deg(ang));
    final double[] d = new double[6];
    at.getMatrix(d);
    ang = Math.atan2(-d[2], d[3]);
    assertEquals(-25.463345061871614, rad2deg(ang));

    // angle in wc:
    ang = Math.atan2(wc.getY(), wc.getX());
    assertEquals(17.36159358309492, rad2deg(ang));
}

From source file:org.vfny.geoserver.global.xml.XMLConfigWriter.java

protected static void storeCoverage(CoverageInfoDTO cv, File dir) throws ConfigurationException {
    if (LOGGER.isLoggable(Level.FINE)) {
        LOGGER.fine("In method storeCoverage");
    }//w w w  .j a  v  a2 s.com

    File f = WriterUtils.initWriteFile(new File(dir, "info.xml"), false);

    try {
        Writer fw = new OutputStreamWriter(new FileOutputStream(f), getDefaultEncoding());
        WriterHelper cw = new WriterHelper(fw);
        Map m = new HashMap();

        if ((cv.getFormatId() != null) && (cv.getFormatId() != "")) {
            m.put("format", cv.getFormatId());
        }

        cw.openTag("coverage", m);

        if ((cv.getName() != null) && (cv.getName() != "")) {
            cw.textTag("name", cv.getName());
        }

        if ((cv.getLabel() != null) && (cv.getLabel() != "")) {
            cw.textTag("label", cv.getLabel());
        }

        if ((cv.getDescription() != null) && (cv.getDescription() != "")) {
            cw.textTag("description", cv.getDescription());
        }

        if ((cv.getWmsPath() != null) && (cv.getWmsPath() != "")) {
            cw.textTag("wmspath", cv.getWmsPath());
        }

        m = new HashMap();

        if ((cv.getMetadataLink() != null)) {
            m.put("about", cv.getMetadataLink().getAbout());
            m.put("type", cv.getMetadataLink().getType());
            m.put("metadataType", cv.getMetadataLink().getMetadataType());

            cw.openTag("metadataLink", m);
            cw.writeln(cv.getMetadataLink().getContent());
            cw.closeTag("metadataLink");
        }

        if ((cv.getKeywords() != null) && (cv.getKeywords().size() != 0)) {
            String s = "";
            Iterator i = cv.getKeywords().iterator();

            if (i.hasNext()) {
                s = i.next().toString();

                while (i.hasNext()) {
                    s = s + "," + i.next().toString();
                }
            }

            cw.textTag("keywords", s);
        }

        if ((cv.getDefaultStyle() != null) && (cv.getDefaultStyle() != "")) {
            cw.comment("the default style this CoverageInfoDTO can be represented by.\n"
                    + "at least must contain the \"default\" attribute ");
            m = new HashMap();
            m.put("default", cv.getDefaultStyle());

            final ArrayList styles = cv.getStyles();

            if (styles.isEmpty()) {
                cw.attrTag("styles", m);
            } else {
                cw.openTag("styles", m);

                Iterator s_IT = styles.iterator();

                while (s_IT.hasNext())
                    cw.textTag("style", (String) s_IT.next());

                cw.closeTag("styles");
            }
        }

        // //
        // storing the envelope.
        // The native crs wkt is stored as the crs attribute. The user defined srs identifier as
        // the srsName atribute
        // //
        if (cv.getEnvelope() != null) {
            GeneralEnvelope e = cv.getEnvelope();
            m = new HashMap();

            String userDefinedCrsIdentifier = cv.getUserDefinedCrsIdentifier();
            if ((userDefinedCrsIdentifier != null) && (userDefinedCrsIdentifier != "")) {
                m.put("srsName", userDefinedCrsIdentifier);
            }

            String nativeCrsWkt = cv.getNativeCrsWKT();
            m.put("crs", nativeCrsWkt.replaceAll("\"", "'").replaceAll("\r\n", "\n"));

            if (!e.isNull()) {
                cw.comment("crs: native CRS definition, srsName: user defined CRS identifier");
                cw.openTag("envelope", m);
                cw.textTag("pos", e.getLowerCorner().getOrdinate(0) + " " + e.getLowerCorner().getOrdinate(1));
                cw.textTag("pos", e.getUpperCorner().getOrdinate(0) + " " + e.getUpperCorner().getOrdinate(1));
                cw.closeTag("envelope");
            }
        }

        // //
        // AlFa: storing the grid-geometry
        // //
        if (cv.getGrid() != null) {
            GridGeometry g = cv.getGrid();
            MathTransform tx = g.getGridToCRS();

            InternationalString[] dimNames = cv.getDimensionNames();
            m = new HashMap();

            m.put("dimension", new Integer(g.getGridRange().getDimension()));

            String lowers = "";
            String upers = "";

            for (int r = 0; r < g.getGridRange().getDimension(); r++) {
                lowers += (g.getGridRange().getLow(r) + " ");
                upers += (g.getGridRange().getHigh(r) + " ");
            }

            cw.openTag("grid", m);
            cw.textTag("low", lowers);
            cw.textTag("high", upers);

            if (dimNames != null) {
                for (int dn = 0; dn < dimNames.length; dn++)
                    cw.textTag("axisName", dimNames[dn].toString());
            }

            // //
            // AlFa: storing geo-transform
            // //
            if (tx instanceof AffineTransform) {
                AffineTransform aTX = (AffineTransform) tx;
                cw.openTag("geoTransform");
                cw.textTag("scaleX", String.valueOf(aTX.getScaleX()));
                cw.textTag("scaleY", String.valueOf(aTX.getScaleY()));
                cw.textTag("shearX", String.valueOf(aTX.getShearX()));
                cw.textTag("shearY", String.valueOf(aTX.getShearY()));
                cw.textTag("translateX", String.valueOf(aTX.getTranslateX()));
                cw.textTag("translateY", String.valueOf(aTX.getTranslateY()));
                cw.closeTag("geoTransform");
            }

            cw.closeTag("grid");
        }

        if (cv.getDimensions() != null) {
            CoverageDimension[] dims = cv.getDimensions();

            for (int d = 0; d < dims.length; d++) {
                Double[] nulls = dims[d].getNullValues();
                cw.openTag("CoverageDimension");
                cw.textTag("name", dims[d].getName());
                cw.textTag("description", dims[d].getDescription());

                if (dims[d].getRange() != null) {
                    cw.openTag("interval");
                    cw.textTag("min", Double.toString(dims[d].getRange().getMinimum(true)));
                    cw.textTag("max", Double.toString(dims[d].getRange().getMaximum(true)));
                    cw.closeTag("interval");
                } else {
                    cw.openTag("interval");
                    cw.textTag("min", Double.toString(Double.NEGATIVE_INFINITY));
                    cw.textTag("max", Double.toString(Double.POSITIVE_INFINITY));
                    cw.closeTag("interval");
                }

                if (nulls != null) {
                    cw.openTag("nullValues");
                    for (int n = 0; n < nulls.length; n++) {
                        cw.textTag("value", nulls[n].toString());
                    }
                    cw.closeTag("nullValues");
                }
                cw.closeTag("CoverageDimension");
            }
        }

        cw.openTag("supportedCRSs");

        if ((cv.getRequestCRSs() != null) && (cv.getRequestCRSs().size() != 0)) {
            String s = "";
            Iterator i = cv.getRequestCRSs().iterator();

            if (i.hasNext()) {
                s = i.next().toString();

                while (i.hasNext()) {
                    s = s + "," + i.next().toString();
                }
            }

            cw.textTag("requestCRSs", s);
        }

        if ((cv.getResponseCRSs() != null) && (cv.getResponseCRSs().size() != 0)) {
            String s = "";
            Iterator i = cv.getResponseCRSs().iterator();

            if (i.hasNext()) {
                s = i.next().toString();

                while (i.hasNext()) {
                    s = s + "," + i.next().toString();
                }
            }

            cw.textTag("responseCRSs", s);
        }

        cw.closeTag("supportedCRSs");

        m = new HashMap();

        if ((cv.getNativeFormat() != null) && (cv.getNativeFormat() != "")) {
            m.put("nativeFormat", cv.getNativeFormat());
        }

        cw.openTag("supportedFormats", m);

        if ((cv.getSupportedFormats() != null) && (cv.getSupportedFormats().size() != 0)) {
            String s = "";
            Iterator i = cv.getSupportedFormats().iterator();

            if (i.hasNext()) {
                s = i.next().toString();

                while (i.hasNext()) {
                    s = s + "," + i.next().toString();
                }
            }

            cw.textTag("formats", s);
        }

        cw.closeTag("supportedFormats");

        m = new HashMap();

        if ((cv.getDefaultInterpolationMethod() != null) && (cv.getDefaultInterpolationMethod() != "")) {
            m.put("default", cv.getDefaultInterpolationMethod());
        }

        cw.openTag("supportedInterpolations", m);

        if ((cv.getInterpolationMethods() != null) && (cv.getInterpolationMethods().size() != 0)) {
            String s = "";
            Iterator i = cv.getInterpolationMethods().iterator();

            if (i.hasNext()) {
                s = i.next().toString();

                while (i.hasNext()) {
                    s = s + "," + i.next().toString();
                }
            }

            cw.textTag("interpolationMethods", s);
        }

        cw.closeTag("supportedInterpolations");

        // ///////////////////////////////////////////////////////////////////////
        //
        // STORING READ PARAMETERS
        //
        // ///////////////////////////////////////////////////////////////////////
        if ((cv.getParameters() != null) && (cv.getParameters().size() != 0)) {
            cw.openTag("parameters");
            final Iterator i = cv.getParameters().keySet().iterator();
            final HashMap temp = new HashMap();

            while (i.hasNext()) {
                String key = (String) i.next();
                if (cv.getParameters().get(key) != null) {
                    temp.put("name", key);
                    temp.put("value", cv.getParameters().get(key).toString().replaceAll("\"", "'"));
                }
                cw.attrTag("parameter", temp);
            }

            cw.closeTag("parameters");
        }

        cw.closeTag("coverage");
        fw.close();
    } catch (IOException e) {
        throw new ConfigurationException(e);
    }
}