Skip to content

Commit

Permalink
Store winding rule in general path element.
Browse files Browse the repository at this point in the history
Signed-off-by: Stephan Beisken <sbeisken@gmail.com>
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
johnmay authored and egonw committed Dec 18, 2013
1 parent 725e4b8 commit 01b8463
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
23 changes: 19 additions & 4 deletions src/main/org/openscience/cdk/renderer/elements/GeneralPath.java
Expand Up @@ -24,6 +24,7 @@
package org.openscience.cdk.renderer.elements;

import java.awt.Color;
import java.awt.geom.PathIterator;
import java.util.List;

import org.openscience.cdk.annotations.TestClass;
Expand All @@ -46,22 +47,36 @@ public class GeneralPath implements IRenderingElement{
/** The elements in the path. */
public final List<PathElement> elements;

/** Winding rule for determining path interior. */
public final int winding;

/**
* @see PathIterator#WIND_EVEN_ODD
*/
public static final int WIND_EVEN_ODD = 0;

/**
* @see PathIterator#WIND_NON_ZERO
*/
public static final int WIND_NON_ZERO = 1;

/**
* Make a path from a list of path elements.
*
*
* @param elements the elements that make up the path
* @param color the color of the path
*/
@TestMethod("testConstructor")
public GeneralPath(List<PathElement> elements, Color color) {
this.elements = elements;
this.color = color;
this.color = color;
this.winding = WIND_EVEN_ODD;
}

/** {@inheritDoc} */
@TestMethod("testAccept")
public void accept( IRenderingVisitor v ) {
v.visit( this );
public void accept(IRenderingVisitor v) {
v.visit(this);
}

}
Expand Up @@ -467,8 +467,7 @@ public boolean isDone() {
}

public int getWindingRule() {

return WIND_EVEN_ODD;
return path.winding;
}

public int currentSegment( double[] coords ) {
Expand Down

0 comments on commit 01b8463

Please sign in to comment.