Class SVGConfiguration

java.lang.Object
com.deltaxml.core.config.SVGConfiguration

public class SVGConfiguration extends Object
Specifies configuration options for SVG comparison. These configuration options can be specified on a DocumentComparator to configure its behaviour when comparing SVG.
Since:
12.2
  • Constructor Details

    • SVGConfiguration

      public SVGConfiguration()
      Initialise a new SVGConfiguration with default settings.
  • Method Details

    • setEnabled

      public void setEnabled(boolean value)
      Sets whether the DocumentComparator should do SVG comparison. SVG comparison is recommended as it will use SVG XML-aware features when comparing two SVG images to ensure that the result can be rendered.
      Parameters:
      value - whether to use SVG comparison
    • isEnabled

      public boolean isEnabled()
      Returns whether SVG comparison is enabled.
      Returns:
      a boolean describing the enabled state of SVG comparison
    • setSVGComparisonGranularity

      public void setSVGComparisonGranularity(SVGGranularity svgComparisonGranularity)
      Sets the SVGGranularity at which the differences between two SVG images will be represented. The default is DETAILED_ADJACENT.
      Parameters:
      svgComparisonGranularity - an instance of SVGGranularity
    • getSVGComparisonGranularity

      public SVGGranularity getSVGComparisonGranularity()
      Returns the SVGGranularity setting for SVG comparison results.
      Returns:
      an instance of SVGGranularity
    • setZIndex

      public void setZIndex(boolean value)
      Sets whether the DocumentComparator should show Z-Index changes in a SVG comparison. Z-Index changes in SVG comparisons are recommended as it will recognise Z-index changes and render the changes with an alternate colour.
      Parameters:
      value - whether to show Z-index changes in the SVG comparison
    • isZIndexEnabled

      public boolean isZIndexEnabled()
      Returns whether Z-index changes are shown in the SVG Comparisons.
      Returns:
      a boolean describing the enabled state of Z-Index changes within the SVG Comparison.
    • setFallback

      public void setFallback(boolean value)
      Sets whether to fall back SVGGranularity.ADJACENT. SVG comparison granularity will fall back to SVGGranularity.ADJACENT if SVG exceeds the percentage of changed elements defined by FallbackChangePercentage.
      Parameters:
      value - whether to fall back to SVGGranularity.ADJACENT if percentage of changed elements is above the FallbackChangePercentage threshold.
    • isFallbackEnabled

      public boolean isFallbackEnabled()
      Returns enabled state of fall back feature in the SVG comparison.
      Returns:
      a boolean describing the enabled state of SVG comparison fallback.
    • setFallbackChangePercentage

      public void setFallbackChangePercentage(double fallbackChangePercentage)
      Sets fall back change percentage setting for SVG comparison results. This is the percentage of changed elements in the SVG comparison before the images are deemed too different and we therefore show the images side by side using SVGGranularity.ADJACENT. The default value is 30.00%.
      Parameters:
      fallbackChangePercentage - the threshold value for changed elements before falling back to SVGGranularity.ADJACENT.
    • getFallbackChangePercentage

      public double getFallbackChangePercentage()
      Gets the fallback change percentage setting for SVG comparison results.
      Returns:
      the fallback threshold percentage as a Double.
    • setInputASVGMarkupStyle

      public void setInputASVGMarkupStyle(String inputASVGMarkupStyle)
      Sets the Input A SVG markup style used for SVG comparison results. The default is "red" and XML Compare expects the style in the same format.
      Parameters:
      inputASVGMarkupStyle - the Input A SVG markup style.
    • getInputASVGMarkupStyle

      public String getInputASVGMarkupStyle()
      Gets the Input A SVG markup style used for SVG comparison results.
      Returns:
      the Input A SVG markup style.
    • setInputBSVGMarkupStyle

      public void setInputBSVGMarkupStyle(String inputBSVGMarkupStyle)
      Sets the Input B SVG markup style used for SVG comparison results. The default is "green" and XML Compare expects the style in the same format.
      Parameters:
      inputBSVGMarkupStyle - the Input B SVG markup style.
    • getInputBSVGMarkupStyle

      public String getInputBSVGMarkupStyle()
      Gets the current Input B SVG markup style used for SVG comparison results.
      Returns:
      the Input B SVG markup style.
    • setZIndexSVGMarkupStyle

      public void setZIndexSVGMarkupStyle(String zIndexSVGMarkupStyle)
      Sets the Z Index SVG markup style used for SVG comparison results. The default is "purple" and XML Compare expects the style in the same format.
      Parameters:
      zIndexSVGMarkupStyle - the Z index SVG markup style.
    • getZIndexSVGMarkupStyle

      public String getZIndexSVGMarkupStyle()
      Gets the current Input Z SVG markup style used for SVG comparison results.
      Returns:
      the Input Z SVG markup style.
    • setNumericToleranceValue

      public void setNumericToleranceValue(String numericToleranceValue)
      Sets the numeric tolerance value for SVG comparison results. This value is used to check if co-ordinate values are within specified tolerance and therefore can be considered having negligible change. The default value is 1%.
      Parameters:
      numericToleranceValue - a value for SVG numeric tolerance either fixed value or percentage
    • getNumericToleranceValue

      public String getNumericToleranceValue()
      Gets the numeric tolerance value for SVG comparison results.
      Returns:
      the string value of the SVG numeric tolerance
    • enableNumericTolerance

      public void enableNumericTolerance(boolean value)
      Sets whether to use a numeric tolerance. SVG comparison will check co-ordinate values are within specified tolerance and therefore can be considered having negligible change.
      Parameters:
      value - whether to use a numeric tolerance in SVG comparison.
    • isNumericToleranceEnabled

      public boolean isNumericToleranceEnabled()
      Determines whether to use numeric tolerance in the SVG comparison.
      Returns:
      a boolean describing the enabled state of SVG comparison numeric tolerance
    • setXpathToReferencedSVG

      public void setXpathToReferencedSVG(String xPathToReferencedSVG)
      Sets XPath to the referenced SVG. This is a xpath to an attribute referencing SVG relative to its parent element. For example. with an HTML input documents, XPath to the referenced SVG will be *:img/@src. This configuration assumes SVG can be created at the same place as that of its reference. It also assumes that SVG doesn't require a container around it. For example, if the DITA files are compared using XML Compare then this configuration will not work as DITA expects an SVG within a svg-container element. While applying SVG comparison to format like DITA XML Compare will need a special filter to consider svg-container.
      Parameters:
      xPathToReferencedSVG - XPath to the referenced SVG.
    • getXpathToReferencedSVG

      public String getXpathToReferencedSVG()
      Gets the XPath to the referenced SVG.
      Returns:
      the XPath to the referenced SVG.