Switch to _ member names for easer code grokking.

This commit is contained in:
Michael Bayne
2013-03-06 10:35:56 -08:00
parent fc4cf07ca3
commit 73fc54dff0
2 changed files with 362 additions and 362 deletions
+181 -181
View File
@@ -31,37 +31,37 @@ public class Area implements IShape, Cloneable
int coordsIndex = 0; int coordsIndex = 0;
for (PathIterator pi = s.pathIterator(null); !pi.isDone(); pi.next()) { for (PathIterator pi = s.pathIterator(null); !pi.isDone(); pi.next()) {
coords = adjustSize(coords, coordsIndex + 6); _coords = adjustSize(_coords, coordsIndex + 6);
rules = adjustSize(rules, rulesIndex + 1); _rules = adjustSize(_rules, rulesIndex + 1);
offsets = adjustSize(offsets, rulesIndex + 1); _offsets = adjustSize(_offsets, rulesIndex + 1);
rules[rulesIndex] = pi.currentSegment(segmentCoords); _rules[rulesIndex] = pi.currentSegment(segmentCoords);
offsets[rulesIndex] = coordsIndex; _offsets[rulesIndex] = coordsIndex;
switch (rules[rulesIndex]) { switch (_rules[rulesIndex]) {
case PathIterator.SEG_MOVETO: case PathIterator.SEG_MOVETO:
coords[coordsIndex++] = segmentCoords[0]; _coords[coordsIndex++] = segmentCoords[0];
coords[coordsIndex++] = segmentCoords[1]; _coords[coordsIndex++] = segmentCoords[1];
lastMoveX = segmentCoords[0]; lastMoveX = segmentCoords[0];
lastMoveY = segmentCoords[1]; lastMoveY = segmentCoords[1];
++moveToCount; ++_moveToCount;
break; break;
case PathIterator.SEG_LINETO: case PathIterator.SEG_LINETO:
if ((segmentCoords[0] != lastMoveX) || (segmentCoords[1] != lastMoveY)) { if ((segmentCoords[0] != lastMoveX) || (segmentCoords[1] != lastMoveY)) {
coords[coordsIndex++] = segmentCoords[0]; _coords[coordsIndex++] = segmentCoords[0];
coords[coordsIndex++] = segmentCoords[1]; _coords[coordsIndex++] = segmentCoords[1];
} else { } else {
--rulesIndex; --rulesIndex;
} }
break; break;
case PathIterator.SEG_QUADTO: case PathIterator.SEG_QUADTO:
System.arraycopy(segmentCoords, 0, coords, coordsIndex, 4); System.arraycopy(segmentCoords, 0, _coords, coordsIndex, 4);
coordsIndex += 4; coordsIndex += 4;
isPolygonal = false; _isPolygonal = false;
break; break;
case PathIterator.SEG_CUBICTO: case PathIterator.SEG_CUBICTO:
System.arraycopy(segmentCoords, 0, coords, coordsIndex, 6); System.arraycopy(segmentCoords, 0, _coords, coordsIndex, 6);
coordsIndex += 6; coordsIndex += 6;
isPolygonal = false; _isPolygonal = false;
break; break;
case PathIterator.SEG_CLOSE: case PathIterator.SEG_CLOSE:
break; break;
@@ -69,44 +69,44 @@ public class Area implements IShape, Cloneable
++rulesIndex; ++rulesIndex;
} }
if ((rulesIndex != 0) && (rules[rulesIndex - 1] != PathIterator.SEG_CLOSE)) { if ((rulesIndex != 0) && (_rules[rulesIndex - 1] != PathIterator.SEG_CLOSE)) {
rules[rulesIndex] = PathIterator.SEG_CLOSE; _rules[rulesIndex] = PathIterator.SEG_CLOSE;
offsets[rulesIndex] = coordsSize; _offsets[rulesIndex] = _coordsSize;
} }
rulesSize = rulesIndex; _rulesSize = rulesIndex;
coordsSize = coordsIndex; _coordsSize = coordsIndex;
} }
/** /**
* Returns true if this area is polygonal. * Returns true if this area is polygonal.
*/ */
public boolean isPolygonal () { public boolean isPolygonal () {
return isPolygonal; return _isPolygonal;
} }
/** /**
* Returns true if this area is rectangular. * Returns true if this area is rectangular.
*/ */
public boolean isRectangular () { public boolean isRectangular () {
return (isPolygonal) && (rulesSize <= 5) && (coordsSize <= 8) && return (_isPolygonal) && (_rulesSize <= 5) && (_coordsSize <= 8) &&
(coords[1] == coords[3]) && (coords[7] == coords[5]) && (_coords[1] == _coords[3]) && (_coords[7] == _coords[5]) &&
(coords[0] == coords[6]) && (coords[2] == coords[4]); (_coords[0] == _coords[6]) && (_coords[2] == _coords[4]);
} }
/** /**
* Returns true if this area encloses only a single contiguous space. * Returns true if this area encloses only a single contiguous space.
*/ */
public boolean isSingular () { public boolean isSingular () {
return (moveToCount <= 1); return (_moveToCount <= 1);
} }
/** /**
* Resets this area to empty. * Resets this area to empty.
*/ */
public void reset () { public void reset () {
coordsSize = 0; _coordsSize = 0;
rulesSize = 0; _rulesSize = 0;
} }
/** /**
@@ -199,7 +199,7 @@ public class Area implements IShape, Cloneable
@Override // from interface IShape @Override // from interface IShape
public boolean isEmpty () { public boolean isEmpty () {
return (rulesSize == 0) && (coordsSize == 0); return (_rulesSize == 0) && (_coordsSize == 0);
} }
@Override // from interface IShape @Override // from interface IShape
@@ -246,13 +246,13 @@ public class Area implements IShape, Cloneable
@Override // from interface IShape @Override // from interface IShape
public Rectangle bounds (Rectangle target) { public Rectangle bounds (Rectangle target) {
double maxX = coords[0], maxY = coords[1]; double maxX = _coords[0], maxY = _coords[1];
double minX = coords[0], minY = coords[1]; double minX = _coords[0], minY = _coords[1];
for (int i = 0; i < coordsSize;) { for (int i = 0; i < _coordsSize;) {
minX = Math.min(minX, coords[i]); minX = Math.min(minX, _coords[i]);
maxX = Math.max(maxX, coords[i++]); maxX = Math.max(maxX, _coords[i++]);
minY = Math.min(minY, coords[i]); minY = Math.min(minY, _coords[i]);
maxY = Math.max(maxY, coords[i++]); maxY = Math.max(maxY, _coords[i++]);
} }
return new Rectangle(minX, minY, maxX - minX, maxY - minY); return new Rectangle(minX, minY, maxX - minX, maxY - minY);
} }
@@ -288,33 +288,33 @@ public class Area implements IShape, Cloneable
private void addCurvePolygon (Area area) { private void addCurvePolygon (Area area) {
CurveCrossingHelper crossHelper = new CurveCrossingHelper( CurveCrossingHelper crossHelper = new CurveCrossingHelper(
new double[][] { coords, area.coords }, new double[][] {_coords, area._coords},
new int[] { coordsSize, area.coordsSize }, new int[] {_coordsSize, area._coordsSize},
new int[][] { rules, area.rules }, new int[][] {_rules, area._rules},
new int[] { rulesSize, area.rulesSize }, new int[] {_rulesSize, area._rulesSize},
new int[][] { offsets, area.offsets }); new int[][] {_offsets, area._offsets});
IntersectPoint[] intersectPoints = crossHelper.findCrossing(); IntersectPoint[] intersectPoints = crossHelper.findCrossing();
if (intersectPoints.length == 0) { if (intersectPoints.length == 0) {
if (area.contains(bounds())) { if (area.contains(bounds())) {
copy(area, this); copy(area, this);
} else if (!contains(area.bounds())) { } else if (!contains(area.bounds())) {
coords = adjustSize(coords, coordsSize + area.coordsSize); _coords = adjustSize(_coords, _coordsSize + area._coordsSize);
System.arraycopy(area.coords, 0, coords, coordsSize, area.coordsSize); System.arraycopy(area._coords, 0, _coords, _coordsSize, area._coordsSize);
coordsSize += area.coordsSize; _coordsSize += area._coordsSize;
rules = adjustSize(rules, rulesSize + area.rulesSize); _rules = adjustSize(_rules, _rulesSize + area._rulesSize);
System.arraycopy(area.rules, 0, rules, rulesSize, area.rulesSize); System.arraycopy(area._rules, 0, _rules, _rulesSize, area._rulesSize);
rulesSize += area.rulesSize; _rulesSize += area._rulesSize;
offsets = adjustSize(offsets, rulesSize + area.rulesSize); _offsets = adjustSize(_offsets, _rulesSize + area._rulesSize);
System.arraycopy(area.offsets, 0, offsets, rulesSize, area.rulesSize); System.arraycopy(area._offsets, 0, _offsets, _rulesSize, area._rulesSize);
} }
return; return;
} }
double[] resultCoords = new double[coordsSize + area.coordsSize + intersectPoints.length]; double[] resultCoords = new double[_coordsSize + area._coordsSize + intersectPoints.length];
int[] resultRules = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultRules = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int[] resultOffsets = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultOffsets = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int resultCoordPos = 0; int resultCoordPos = 0;
int resultRulesPos = 0; int resultRulesPos = 0;
boolean isCurrentArea = true; boolean isCurrentArea = true;
@@ -329,20 +329,20 @@ public class Area implements IShape, Cloneable
int curIndex = point.endIndex(true); int curIndex = point.endIndex(true);
if (curIndex < 0) { if (curIndex < 0) {
isCurrentArea = !isCurrentArea; isCurrentArea = !isCurrentArea;
} else if (area.containsExact(coords[2 * curIndex], coords[2 * curIndex + 1]) > 0) { } else if (area.containsExact(_coords[2 * curIndex], _coords[2 * curIndex + 1]) > 0) {
isCurrentArea = false; isCurrentArea = false;
} else { } else {
isCurrentArea = true; isCurrentArea = true;
} }
IntersectPoint nextPoint = nextIntersectPoint(intersectPoints, point, isCurrentArea); IntersectPoint nextPoint = nextIntersectPoint(intersectPoints, point, isCurrentArea);
double[] coords = (isCurrentArea) ? this.coords : area.coords; double[] coords = (isCurrentArea) ? this._coords : area._coords;
int[] offsets = (isCurrentArea) ? this.offsets : area.offsets; int[] offsets = (isCurrentArea) ? this._offsets : area._offsets;
int[] rules = (isCurrentArea) ? this.rules : area.rules; int[] rules = (isCurrentArea) ? this._rules : area._rules;
int offset = point.ruleIndex(isCurrentArea); int offset = point.ruleIndex(isCurrentArea);
boolean isCopyUntilZero = false; boolean isCopyUntilZero = false;
if ((point.ruleIndex(isCurrentArea) > nextPoint.ruleIndex(isCurrentArea))) { if ((point.ruleIndex(isCurrentArea) > nextPoint.ruleIndex(isCurrentArea))) {
int rulesSize = (isCurrentArea) ? this.rulesSize : area.rulesSize; int rulesSize = (isCurrentArea) ? this._rulesSize : area._rulesSize;
resultCoordPos = includeCoordsAndRules(offset + 1, rulesSize, rules, offsets, resultCoordPos = includeCoordsAndRules(offset + 1, rulesSize, rules, offsets,
resultRules, resultOffsets, resultCoords, coords, resultRulesPos, resultRules, resultOffsets, resultCoords, coords, resultRulesPos,
resultCoordPos, point, isCurrentArea, false, 0); resultCoordPos, point, isCurrentArea, false, 0);
@@ -365,38 +365,38 @@ public class Area implements IShape, Cloneable
resultRules[resultRulesPos++] = PathIterator.SEG_CLOSE; resultRules[resultRulesPos++] = PathIterator.SEG_CLOSE;
resultOffsets[resultRulesPos - 1] = resultCoordPos; resultOffsets[resultRulesPos - 1] = resultCoordPos;
this.coords = resultCoords; this._coords = resultCoords;
this.rules = resultRules; this._rules = resultRules;
this.offsets = resultOffsets; this._offsets = resultOffsets;
this.coordsSize = resultCoordPos; this._coordsSize = resultCoordPos;
this.rulesSize = resultRulesPos; this._rulesSize = resultRulesPos;
} }
private void addPolygon (Area area) { private void addPolygon (Area area) {
CrossingHelper crossHelper = new CrossingHelper( CrossingHelper crossHelper = new CrossingHelper(
new double[][] { coords, area.coords }, new double[][] {_coords, area._coords},
new int[] { coordsSize, area.coordsSize }); new int[] {_coordsSize, area._coordsSize});
IntersectPoint[] intersectPoints = crossHelper.findCrossing(); IntersectPoint[] intersectPoints = crossHelper.findCrossing();
if (intersectPoints.length == 0) { if (intersectPoints.length == 0) {
if (area.contains(bounds())) { if (area.contains(bounds())) {
copy(area, this); copy(area, this);
} else if (!contains(area.bounds())) { } else if (!contains(area.bounds())) {
coords = adjustSize(coords, coordsSize + area.coordsSize); _coords = adjustSize(_coords, _coordsSize + area._coordsSize);
System.arraycopy(area.coords, 0, coords, coordsSize, area.coordsSize); System.arraycopy(area._coords, 0, _coords, _coordsSize, area._coordsSize);
coordsSize += area.coordsSize; _coordsSize += area._coordsSize;
rules = adjustSize(rules, rulesSize + area.rulesSize); _rules = adjustSize(_rules, _rulesSize + area._rulesSize);
System.arraycopy(area.rules, 0, rules, rulesSize, area.rulesSize); System.arraycopy(area._rules, 0, _rules, _rulesSize, area._rulesSize);
rulesSize += area.rulesSize; _rulesSize += area._rulesSize;
offsets = adjustSize(offsets, rulesSize + area.rulesSize); _offsets = adjustSize(_offsets, _rulesSize + area._rulesSize);
System.arraycopy(area.offsets, 0, offsets, rulesSize, area.rulesSize); System.arraycopy(area._offsets, 0, _offsets, _rulesSize, area._rulesSize);
} }
return; return;
} }
double[] resultCoords = new double[coordsSize + area.coordsSize + intersectPoints.length]; double[] resultCoords = new double[_coordsSize + area._coordsSize + intersectPoints.length];
int[] resultRules = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultRules = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int[] resultOffsets = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultOffsets = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int resultCoordPos = 0; int resultCoordPos = 0;
int resultRulesPos = 0; int resultRulesPos = 0;
boolean isCurrentArea = true; boolean isCurrentArea = true;
@@ -413,18 +413,18 @@ public class Area implements IShape, Cloneable
int curIndex = point.endIndex(true); int curIndex = point.endIndex(true);
if (curIndex < 0) { if (curIndex < 0) {
isCurrentArea = !isCurrentArea; isCurrentArea = !isCurrentArea;
} else if (area.containsExact(coords[2 * curIndex], coords[2 * curIndex + 1]) > 0) { } else if (area.containsExact(_coords[2 * curIndex], _coords[2 * curIndex + 1]) > 0) {
isCurrentArea = false; isCurrentArea = false;
} else { } else {
isCurrentArea = true; isCurrentArea = true;
} }
IntersectPoint nextPoint = nextIntersectPoint(intersectPoints, point, isCurrentArea); IntersectPoint nextPoint = nextIntersectPoint(intersectPoints, point, isCurrentArea);
double[] coords = (isCurrentArea) ? this.coords : area.coords; double[] coords = (isCurrentArea) ? this._coords : area._coords;
int offset = 2 * point.endIndex(isCurrentArea); int offset = 2 * point.endIndex(isCurrentArea);
if ((offset >= 0) && if ((offset >= 0) &&
(nextPoint.begIndex(isCurrentArea) < point.endIndex(isCurrentArea))) { (nextPoint.begIndex(isCurrentArea) < point.endIndex(isCurrentArea))) {
int coordSize = (isCurrentArea) ? this.coordsSize : area.coordsSize; int coordSize = (isCurrentArea) ? this._coordsSize : area._coordsSize;
int length = coordSize - offset; int length = coordSize - offset;
System.arraycopy(coords, offset, resultCoords, resultCoordPos, length); System.arraycopy(coords, offset, resultCoords, resultCoordPos, length);
@@ -453,20 +453,20 @@ public class Area implements IShape, Cloneable
resultRules[resultRulesPos - 1] = PathIterator.SEG_CLOSE; resultRules[resultRulesPos - 1] = PathIterator.SEG_CLOSE;
resultOffsets[resultRulesPos - 1] = resultCoordPos; resultOffsets[resultRulesPos - 1] = resultCoordPos;
coords = resultCoords; _coords = resultCoords;
rules = resultRules; _rules = resultRules;
offsets = resultOffsets; _offsets = resultOffsets;
coordsSize = resultCoordPos; _coordsSize = resultCoordPos;
rulesSize = resultRulesPos; _rulesSize = resultRulesPos;
} }
private void intersectCurvePolygon (Area area) { private void intersectCurvePolygon (Area area) {
CurveCrossingHelper crossHelper = new CurveCrossingHelper( CurveCrossingHelper crossHelper = new CurveCrossingHelper(
new double[][] { coords, area.coords }, new double[][] {_coords, area._coords},
new int[] { coordsSize, area.coordsSize }, new int[] {_coordsSize, area._coordsSize},
new int[][] { rules, area.rules }, new int[][] {_rules, area._rules},
new int[] { rulesSize, area.rulesSize }, new int[] {_rulesSize, area._rulesSize},
new int[][] { offsets, area.offsets }); new int[][] {_offsets, area._offsets});
IntersectPoint[] intersectPoints = crossHelper.findCrossing(); IntersectPoint[] intersectPoints = crossHelper.findCrossing();
if (intersectPoints.length == 0) { if (intersectPoints.length == 0) {
if (contains(area.bounds())) { if (contains(area.bounds())) {
@@ -477,9 +477,9 @@ public class Area implements IShape, Cloneable
return; return;
} }
double[] resultCoords = new double[coordsSize + area.coordsSize + intersectPoints.length]; double[] resultCoords = new double[_coordsSize + area._coordsSize + intersectPoints.length];
int[] resultRules = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultRules = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int[] resultOffsets = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultOffsets = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int resultCoordPos = 0; int resultCoordPos = 0;
int resultRulesPos = 0; int resultRulesPos = 0;
boolean isCurrentArea = true; boolean isCurrentArea = true;
@@ -495,23 +495,23 @@ public class Area implements IShape, Cloneable
int curIndex = point.endIndex(true); int curIndex = point.endIndex(true);
if ((curIndex < 0) || if ((curIndex < 0) ||
(area.containsExact(coords[2 * curIndex], coords[2 * curIndex + 1]) == 0)) { (area.containsExact(_coords[2 * curIndex], _coords[2 * curIndex + 1]) == 0)) {
isCurrentArea = !isCurrentArea; isCurrentArea = !isCurrentArea;
} else if (area.containsExact(coords[2 * curIndex], coords[2 * curIndex + 1]) > 0) { } else if (area.containsExact(_coords[2 * curIndex], _coords[2 * curIndex + 1]) > 0) {
isCurrentArea = true; isCurrentArea = true;
} else { } else {
isCurrentArea = false; isCurrentArea = false;
} }
nextPoint = nextIntersectPoint(intersectPoints, point, isCurrentArea); nextPoint = nextIntersectPoint(intersectPoints, point, isCurrentArea);
double[] coords = (isCurrentArea) ? this.coords : area.coords; double[] coords = (isCurrentArea) ? this._coords : area._coords;
int[] offsets = (isCurrentArea) ? this.offsets : area.offsets; int[] offsets = (isCurrentArea) ? this._offsets : area._offsets;
int[] rules = (isCurrentArea) ? this.rules : area.rules; int[] rules = (isCurrentArea) ? this._rules : area._rules;
int offset = point.ruleIndex(isCurrentArea); int offset = point.ruleIndex(isCurrentArea);
boolean isCopyUntilZero = false; boolean isCopyUntilZero = false;
if (point.ruleIndex(isCurrentArea) > nextPoint.ruleIndex(isCurrentArea)) { if (point.ruleIndex(isCurrentArea) > nextPoint.ruleIndex(isCurrentArea)) {
int rulesSize = (isCurrentArea) ? this.rulesSize : area.rulesSize; int rulesSize = (isCurrentArea) ? this._rulesSize : area._rulesSize;
resultCoordPos = includeCoordsAndRules( resultCoordPos = includeCoordsAndRules(
offset + 1, rulesSize, rules, offsets, resultRules, resultOffsets, offset + 1, rulesSize, rules, offsets, resultRules, resultOffsets,
resultCoords, coords, resultRulesPos, resultCoordPos, point, isCurrentArea, resultCoords, coords, resultRulesPos, resultCoordPos, point, isCurrentArea,
@@ -554,17 +554,17 @@ public class Area implements IShape, Cloneable
} }
resultOffsets[resultRulesPos - 1] = resultCoordPos; resultOffsets[resultRulesPos - 1] = resultCoordPos;
coords = resultCoords; _coords = resultCoords;
rules = resultRules; _rules = resultRules;
offsets = resultOffsets; _offsets = resultOffsets;
coordsSize = resultCoordPos; _coordsSize = resultCoordPos;
rulesSize = resultRulesPos; _rulesSize = resultRulesPos;
} }
private void intersectPolygon (Area area) { private void intersectPolygon (Area area) {
CrossingHelper crossHelper = new CrossingHelper( CrossingHelper crossHelper = new CrossingHelper(
new double[][] { coords, area.coords }, new double[][] {_coords, area._coords},
new int[] { coordsSize, area.coordsSize }); new int[] {_coordsSize, area._coordsSize});
IntersectPoint[] intersectPoints = crossHelper.findCrossing(); IntersectPoint[] intersectPoints = crossHelper.findCrossing();
if (intersectPoints.length == 0) { if (intersectPoints.length == 0) {
if (contains(area.bounds())) { if (contains(area.bounds())) {
@@ -575,9 +575,9 @@ public class Area implements IShape, Cloneable
return; return;
} }
double[] resultCoords = new double[coordsSize + area.coordsSize + intersectPoints.length]; double[] resultCoords = new double[_coordsSize + area._coordsSize + intersectPoints.length];
int[] resultRules = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultRules = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int[] resultOffsets = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultOffsets = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int resultCoordPos = 0; int resultCoordPos = 0;
int resultRulesPos = 0; int resultRulesPos = 0;
boolean isCurrentArea = true; boolean isCurrentArea = true;
@@ -594,20 +594,20 @@ public class Area implements IShape, Cloneable
int curIndex = point.endIndex(true); int curIndex = point.endIndex(true);
if ((curIndex < 0) || if ((curIndex < 0) ||
(area.containsExact(coords[2 * curIndex], coords[2 * curIndex + 1]) == 0)) { (area.containsExact(_coords[2 * curIndex], _coords[2 * curIndex + 1]) == 0)) {
isCurrentArea = !isCurrentArea; isCurrentArea = !isCurrentArea;
} else if (area.containsExact(coords[2 * curIndex], coords[2 * curIndex + 1]) > 0) { } else if (area.containsExact(_coords[2 * curIndex], _coords[2 * curIndex + 1]) > 0) {
isCurrentArea = true; isCurrentArea = true;
} else { } else {
isCurrentArea = false; isCurrentArea = false;
} }
IntersectPoint nextPoint = nextIntersectPoint(intersectPoints, point, isCurrentArea); IntersectPoint nextPoint = nextIntersectPoint(intersectPoints, point, isCurrentArea);
double[] coords = (isCurrentArea) ? this.coords : area.coords; double[] coords = (isCurrentArea) ? this._coords : area._coords;
int offset = 2 * point.endIndex(isCurrentArea); int offset = 2 * point.endIndex(isCurrentArea);
if ((offset >= 0) && if ((offset >= 0) &&
(nextPoint.begIndex(isCurrentArea) < point.endIndex(isCurrentArea))) { (nextPoint.begIndex(isCurrentArea) < point.endIndex(isCurrentArea))) {
int coordSize = (isCurrentArea) ? this.coordsSize : area.coordsSize; int coordSize = (isCurrentArea) ? this._coordsSize : area._coordsSize;
int length = coordSize - offset; int length = coordSize - offset;
System.arraycopy(coords, offset, resultCoords, resultCoordPos, length); System.arraycopy(coords, offset, resultCoords, resultCoordPos, length);
@@ -636,29 +636,29 @@ public class Area implements IShape, Cloneable
resultRules[resultRulesPos - 1] = PathIterator.SEG_CLOSE; resultRules[resultRulesPos - 1] = PathIterator.SEG_CLOSE;
resultOffsets[resultRulesPos - 1] = resultCoordPos; resultOffsets[resultRulesPos - 1] = resultCoordPos;
coords = resultCoords; _coords = resultCoords;
rules = resultRules; _rules = resultRules;
offsets = resultOffsets; _offsets = resultOffsets;
coordsSize = resultCoordPos; _coordsSize = resultCoordPos;
rulesSize = resultRulesPos; _rulesSize = resultRulesPos;
} }
private void subtractCurvePolygon (Area area) { private void subtractCurvePolygon (Area area) {
CurveCrossingHelper crossHelper = new CurveCrossingHelper( CurveCrossingHelper crossHelper = new CurveCrossingHelper(
new double[][] { coords, area.coords }, new double[][] {_coords, area._coords},
new int[] { coordsSize, area.coordsSize }, new int[] {_coordsSize, area._coordsSize},
new int[][] { rules, area.rules }, new int[][] {_rules, area._rules},
new int[] { rulesSize, area.rulesSize }, new int[] {_rulesSize, area._rulesSize},
new int[][] { offsets, area.offsets }); new int[][] {_offsets, area._offsets});
IntersectPoint[] intersectPoints = crossHelper.findCrossing(); IntersectPoint[] intersectPoints = crossHelper.findCrossing();
if (intersectPoints.length == 0 && contains(area.bounds())) { if (intersectPoints.length == 0 && contains(area.bounds())) {
copy(area, this); copy(area, this);
return; return;
} }
double[] resultCoords = new double[coordsSize + area.coordsSize + intersectPoints.length]; double[] resultCoords = new double[_coordsSize + area._coordsSize + intersectPoints.length];
int[] resultRules = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultRules = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int[] resultOffsets = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultOffsets = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int resultCoordPos = 0; int resultCoordPos = 0;
int resultRulesPos = 0; int resultRulesPos = 0;
boolean isCurrentArea = true; boolean isCurrentArea = true;
@@ -670,10 +670,10 @@ public class Area implements IShape, Cloneable
do { do {
resultCoords[resultCoordPos++] = point.x(); resultCoords[resultCoordPos++] = point.x();
resultCoords[resultCoordPos++] = point.y(); resultCoords[resultCoordPos++] = point.y();
int curIndex = offsets[point.ruleIndex(true)] % coordsSize; int curIndex = _offsets[point.ruleIndex(true)] % _coordsSize;
if (area.containsExact(coords[curIndex], coords[curIndex + 1]) == 0) { if (area.containsExact(_coords[curIndex], _coords[curIndex + 1]) == 0) {
isCurrentArea = !isCurrentArea; isCurrentArea = !isCurrentArea;
} else if (area.containsExact(coords[curIndex], coords[curIndex + 1]) > 0) { } else if (area.containsExact(_coords[curIndex], _coords[curIndex + 1]) > 0) {
isCurrentArea = false; isCurrentArea = false;
} else { } else {
isCurrentArea = true; isCurrentArea = true;
@@ -682,9 +682,9 @@ public class Area implements IShape, Cloneable
IntersectPoint nextPoint = (isCurrentArea) ? IntersectPoint nextPoint = (isCurrentArea) ?
nextIntersectPoint(intersectPoints, point, isCurrentArea) : nextIntersectPoint(intersectPoints, point, isCurrentArea) :
prevIntersectPoint(intersectPoints, point, isCurrentArea); prevIntersectPoint(intersectPoints, point, isCurrentArea);
double[] coords = (isCurrentArea) ? this.coords : area.coords; double[] coords = (isCurrentArea) ? this._coords : area._coords;
int[] offsets = (isCurrentArea) ? this.offsets : area.offsets; int[] offsets = (isCurrentArea) ? this._offsets : area._offsets;
int[] rules = (isCurrentArea) ? this.rules : area.rules; int[] rules = (isCurrentArea) ? this._rules : area._rules;
int offset = (isCurrentArea) ? point.ruleIndex(isCurrentArea) : int offset = (isCurrentArea) ? point.ruleIndex(isCurrentArea) :
nextPoint.ruleIndex(isCurrentArea); nextPoint.ruleIndex(isCurrentArea);
boolean isCopyUntilZero = false; boolean isCopyUntilZero = false;
@@ -693,7 +693,7 @@ public class Area implements IShape, Cloneable
(point.ruleIndex(isCurrentArea) > nextPoint.ruleIndex(isCurrentArea))) || (point.ruleIndex(isCurrentArea) > nextPoint.ruleIndex(isCurrentArea))) ||
((!isCurrentArea) && ((!isCurrentArea) &&
(nextPoint.ruleIndex(isCurrentArea) > nextPoint.ruleIndex(isCurrentArea)))) { (nextPoint.ruleIndex(isCurrentArea) > nextPoint.ruleIndex(isCurrentArea)))) {
int rulesSize = (isCurrentArea) ? this.rulesSize : area.rulesSize; int rulesSize = (isCurrentArea) ? this._rulesSize : area._rulesSize;
resultCoordPos = includeCoordsAndRules( resultCoordPos = includeCoordsAndRules(
offset + 1, rulesSize, rules, offsets, resultRules, resultOffsets, resultCoords, offset + 1, rulesSize, rules, offsets, resultRules, resultOffsets, resultCoords,
coords, resultRulesPos, resultCoordPos, point, isCurrentArea, false, 2); coords, resultRulesPos, resultCoordPos, point, isCurrentArea, false, 2);
@@ -727,17 +727,17 @@ public class Area implements IShape, Cloneable
resultRules[resultRulesPos++] = PathIterator.SEG_CLOSE; resultRules[resultRulesPos++] = PathIterator.SEG_CLOSE;
resultOffsets[resultRulesPos - 1] = resultCoordPos; resultOffsets[resultRulesPos - 1] = resultCoordPos;
coords = resultCoords; _coords = resultCoords;
rules = resultRules; _rules = resultRules;
offsets = resultOffsets; _offsets = resultOffsets;
coordsSize = resultCoordPos; _coordsSize = resultCoordPos;
rulesSize = resultRulesPos; _rulesSize = resultRulesPos;
} }
private void subtractPolygon (Area area) { private void subtractPolygon (Area area) {
CrossingHelper crossHelper = new CrossingHelper( CrossingHelper crossHelper = new CrossingHelper(
new double[][] { coords, area.coords }, new double[][] {_coords, area._coords},
new int[] { coordsSize, area.coordsSize }); new int[] {_coordsSize, area._coordsSize});
IntersectPoint[] intersectPoints = crossHelper.findCrossing(); IntersectPoint[] intersectPoints = crossHelper.findCrossing();
if (intersectPoints.length == 0) { if (intersectPoints.length == 0) {
if (contains(area.bounds())) { if (contains(area.bounds())) {
@@ -748,9 +748,9 @@ public class Area implements IShape, Cloneable
} }
double[] resultCoords = new double[ double[] resultCoords = new double[
2 * (coordsSize + area.coordsSize + intersectPoints.length)]; 2 * (_coordsSize + area._coordsSize + intersectPoints.length)];
int[] resultRules = new int[2 * (rulesSize + area.rulesSize + intersectPoints.length)]; int[] resultRules = new int[2 * (_rulesSize + area._rulesSize + intersectPoints.length)];
int[] resultOffsets = new int[2 * (rulesSize + area.rulesSize + intersectPoints.length)]; int[] resultOffsets = new int[2 * (_rulesSize + area._rulesSize + intersectPoints.length)];
int resultCoordPos = 0; int resultCoordPos = 0;
int resultRulesPos = 0; int resultRulesPos = 0;
boolean isCurrentArea = true; boolean isCurrentArea = true;
@@ -770,13 +770,13 @@ public class Area implements IShape, Cloneable
int curIndex = point.endIndex(true); int curIndex = point.endIndex(true);
if ((curIndex < 0) || if ((curIndex < 0) ||
(area.isVertex(coords[2 * curIndex], coords[2 * curIndex + 1]) && (area.isVertex(_coords[2 * curIndex], _coords[2 * curIndex + 1]) &&
crossHelper.containsPoint(new double[] { coords[2 * curIndex], crossHelper.containsPoint(new double[] { _coords[2 * curIndex],
coords[2 * curIndex + 1] }) && _coords[2 * curIndex + 1] }) &&
(coords[2 * curIndex] != point.x() || (_coords[2 * curIndex] != point.x() ||
coords[2 * curIndex + 1] != point.y()))) { _coords[2 * curIndex + 1] != point.y()))) {
isCurrentArea = !isCurrentArea; isCurrentArea = !isCurrentArea;
} else if (area.containsExact(coords[2 * curIndex], coords[2 * curIndex + 1]) > 0) { } else if (area.containsExact(_coords[2 * curIndex], _coords[2 * curIndex + 1]) > 0) {
isCurrentArea = false; isCurrentArea = false;
} else { } else {
isCurrentArea = true; isCurrentArea = true;
@@ -795,7 +795,7 @@ public class Area implements IShape, Cloneable
IntersectPoint nextPoint = (isCurrentArea) ? IntersectPoint nextPoint = (isCurrentArea) ?
nextIntersectPoint(intersectPoints, point, isCurrentArea) : nextIntersectPoint(intersectPoints, point, isCurrentArea) :
prevIntersectPoint(intersectPoints, point, isCurrentArea); prevIntersectPoint(intersectPoints, point, isCurrentArea);
double[] coords = (isCurrentArea) ? this.coords : area.coords; double[] coords = (isCurrentArea) ? this._coords : area._coords;
int offset = (isCurrentArea) ? 2 * point.endIndex(isCurrentArea) : int offset = (isCurrentArea) ? 2 * point.endIndex(isCurrentArea) :
2 * nextPoint.endIndex(isCurrentArea); 2 * nextPoint.endIndex(isCurrentArea);
@@ -806,7 +806,7 @@ public class Area implements IShape, Cloneable
((!isCurrentArea) && ((!isCurrentArea) &&
(nextPoint.endIndex(isCurrentArea) < nextPoint.begIndex(isCurrentArea))))) { (nextPoint.endIndex(isCurrentArea) < nextPoint.begIndex(isCurrentArea))))) {
int coordSize = (isCurrentArea) ? this.coordsSize : area.coordsSize; int coordSize = (isCurrentArea) ? this._coordsSize : area._coordsSize;
int length = coordSize - offset; int length = coordSize - offset;
if (isCurrentArea) { if (isCurrentArea) {
@@ -854,11 +854,11 @@ public class Area implements IShape, Cloneable
resultRules[resultRulesPos - 1] = PathIterator.SEG_CLOSE; resultRules[resultRulesPos - 1] = PathIterator.SEG_CLOSE;
resultOffsets[resultRulesPos - 1] = resultCoordPos; resultOffsets[resultRulesPos - 1] = resultCoordPos;
coords = resultCoords; _coords = resultCoords;
rules = resultRules; _rules = resultRules;
offsets = resultOffsets; _offsets = resultOffsets;
coordsSize = resultCoordPos; _coordsSize = resultCoordPos;
rulesSize = resultRulesPos; _rulesSize = resultRulesPos;
} }
private IntersectPoint nextIntersectPoint (IntersectPoint[] iPoints, private IntersectPoint nextIntersectPoint (IntersectPoint[] iPoints,
@@ -1039,12 +1039,12 @@ public class Area implements IShape, Cloneable
} }
private void copy (Area src, Area dst) { private void copy (Area src, Area dst) {
dst.coordsSize = src.coordsSize; dst._coordsSize = src._coordsSize;
dst.coords = Platform.clone(src.coords); dst._coords = Platform.clone(src._coords);
dst.rulesSize = src.rulesSize; dst._rulesSize = src._rulesSize;
dst.rules = Platform.clone(src.rules); dst._rules = Platform.clone(src._rules);
dst.moveToCount = src.moveToCount; dst._moveToCount = src._moveToCount;
dst.offsets = Platform.clone(src.offsets); dst._offsets = Platform.clone(src._offsets);
} }
private int containsExact (double x, double y) { private int containsExact (double x, double y) {
@@ -1129,8 +1129,8 @@ public class Area implements IShape, Cloneable
} }
private boolean isVertex (double x, double y) { private boolean isVertex (double x, double y) {
for (int i = 0; i < coordsSize;) { for (int i = 0; i < _coordsSize;) {
if (x == coords[i++] && y == coords[i++]) { if (x == _coords[i++] && y == _coords[i++]) {
return true; return true;
} }
} }
@@ -1172,11 +1172,11 @@ public class Area implements IShape, Cloneable
} }
@Override public boolean isDone () { @Override public boolean isDone () {
return curRuleIndex >= rulesSize; return curRuleIndex >= _rulesSize;
} }
@Override public void next () { @Override public void next () {
switch (rules[curRuleIndex]) { switch (_rules[curRuleIndex]) {
case PathIterator.SEG_MOVETO: case PathIterator.SEG_MOVETO:
case PathIterator.SEG_LINETO: case PathIterator.SEG_LINETO:
curCoordIndex += 2; curCoordIndex += 2;
@@ -1199,19 +1199,19 @@ public class Area implements IShape, Cloneable
int count = 0; int count = 0;
// the fallthrough below is on purpose // the fallthrough below is on purpose
switch (rules[curRuleIndex]) { switch (_rules[curRuleIndex]) {
case PathIterator.SEG_CUBICTO: case PathIterator.SEG_CUBICTO:
c[4] = coords[curCoordIndex + 4]; c[4] = _coords[curCoordIndex + 4];
c[5] = coords[curCoordIndex + 5]; c[5] = _coords[curCoordIndex + 5];
count = 1; count = 1;
case PathIterator.SEG_QUADTO: case PathIterator.SEG_QUADTO:
c[2] = coords[curCoordIndex + 2]; c[2] = _coords[curCoordIndex + 2];
c[3] = coords[curCoordIndex + 3]; c[3] = _coords[curCoordIndex + 3];
count += 1; count += 1;
case PathIterator.SEG_MOVETO: case PathIterator.SEG_MOVETO:
case PathIterator.SEG_LINETO: case PathIterator.SEG_LINETO:
c[0] = coords[curCoordIndex]; c[0] = _coords[curCoordIndex];
c[1] = coords[curCoordIndex + 1]; c[1] = _coords[curCoordIndex + 1];
count += 1; count += 1;
} }
@@ -1219,28 +1219,28 @@ public class Area implements IShape, Cloneable
transform.transform(c, 0, c, 0, count); transform.transform(c, 0, c, 0, count);
} }
return rules[curRuleIndex]; return _rules[curRuleIndex];
} }
} }
/** The coordinates array of the shape vertices. */ /** The coordinates array of the shape vertices. */
private double[] coords = new double[20]; private double[] _coords = new double[20];
/** The coordinates quantity. */ /** The coordinates quantity. */
private int coordsSize = 0; private int _coordsSize = 0;
/** The rules array for the drawing of the shape edges. */ /** The _rules array for the drawing of the shape edges. */
private int[] rules = new int[10]; private int[] _rules = new int[10];
/** The rules quantity. */ /** The _rules quantity. */
private int rulesSize = 0; private int _rulesSize = 0;
/** offsets[i] - index in array of coords and i - index in array of rules. */ /** _offsets[i] - index in array of _coords and i - index in array of _rules. */
private int[] offsets = new int[10]; private int[] _offsets = new int[10];
/** The quantity of MOVETO rule occurrences. */ /** The quantity of MOVETO rule occurrences. */
private int moveToCount = 0; private int _moveToCount = 0;
/** True if the shape is polygonal. */ /** True if the shape is polygonal. */
private boolean isPolygonal = true; private boolean _isPolygonal = true;
} }
+181 -181
View File
@@ -31,37 +31,37 @@ public class Area implements IShape, Cloneable
int coordsIndex = 0; int coordsIndex = 0;
for (PathIterator pi = s.pathIterator(null); !pi.isDone(); pi.next()) { for (PathIterator pi = s.pathIterator(null); !pi.isDone(); pi.next()) {
coords = adjustSize(coords, coordsIndex + 6); _coords = adjustSize(_coords, coordsIndex + 6);
rules = adjustSize(rules, rulesIndex + 1); _rules = adjustSize(_rules, rulesIndex + 1);
offsets = adjustSize(offsets, rulesIndex + 1); _offsets = adjustSize(_offsets, rulesIndex + 1);
rules[rulesIndex] = pi.currentSegment(segmentCoords); _rules[rulesIndex] = pi.currentSegment(segmentCoords);
offsets[rulesIndex] = coordsIndex; _offsets[rulesIndex] = coordsIndex;
switch (rules[rulesIndex]) { switch (_rules[rulesIndex]) {
case PathIterator.SEG_MOVETO: case PathIterator.SEG_MOVETO:
coords[coordsIndex++] = segmentCoords[0]; _coords[coordsIndex++] = segmentCoords[0];
coords[coordsIndex++] = segmentCoords[1]; _coords[coordsIndex++] = segmentCoords[1];
lastMoveX = segmentCoords[0]; lastMoveX = segmentCoords[0];
lastMoveY = segmentCoords[1]; lastMoveY = segmentCoords[1];
++moveToCount; ++_moveToCount;
break; break;
case PathIterator.SEG_LINETO: case PathIterator.SEG_LINETO:
if ((segmentCoords[0] != lastMoveX) || (segmentCoords[1] != lastMoveY)) { if ((segmentCoords[0] != lastMoveX) || (segmentCoords[1] != lastMoveY)) {
coords[coordsIndex++] = segmentCoords[0]; _coords[coordsIndex++] = segmentCoords[0];
coords[coordsIndex++] = segmentCoords[1]; _coords[coordsIndex++] = segmentCoords[1];
} else { } else {
--rulesIndex; --rulesIndex;
} }
break; break;
case PathIterator.SEG_QUADTO: case PathIterator.SEG_QUADTO:
System.arraycopy(segmentCoords, 0, coords, coordsIndex, 4); System.arraycopy(segmentCoords, 0, _coords, coordsIndex, 4);
coordsIndex += 4; coordsIndex += 4;
isPolygonal = false; _isPolygonal = false;
break; break;
case PathIterator.SEG_CUBICTO: case PathIterator.SEG_CUBICTO:
System.arraycopy(segmentCoords, 0, coords, coordsIndex, 6); System.arraycopy(segmentCoords, 0, _coords, coordsIndex, 6);
coordsIndex += 6; coordsIndex += 6;
isPolygonal = false; _isPolygonal = false;
break; break;
case PathIterator.SEG_CLOSE: case PathIterator.SEG_CLOSE:
break; break;
@@ -69,44 +69,44 @@ public class Area implements IShape, Cloneable
++rulesIndex; ++rulesIndex;
} }
if ((rulesIndex != 0) && (rules[rulesIndex - 1] != PathIterator.SEG_CLOSE)) { if ((rulesIndex != 0) && (_rules[rulesIndex - 1] != PathIterator.SEG_CLOSE)) {
rules[rulesIndex] = PathIterator.SEG_CLOSE; _rules[rulesIndex] = PathIterator.SEG_CLOSE;
offsets[rulesIndex] = coordsSize; _offsets[rulesIndex] = _coordsSize;
} }
rulesSize = rulesIndex; _rulesSize = rulesIndex;
coordsSize = coordsIndex; _coordsSize = coordsIndex;
} }
/** /**
* Returns true if this area is polygonal. * Returns true if this area is polygonal.
*/ */
public boolean isPolygonal () { public boolean isPolygonal () {
return isPolygonal; return _isPolygonal;
} }
/** /**
* Returns true if this area is rectangular. * Returns true if this area is rectangular.
*/ */
public boolean isRectangular () { public boolean isRectangular () {
return (isPolygonal) && (rulesSize <= 5) && (coordsSize <= 8) && return (_isPolygonal) && (_rulesSize <= 5) && (_coordsSize <= 8) &&
(coords[1] == coords[3]) && (coords[7] == coords[5]) && (_coords[1] == _coords[3]) && (_coords[7] == _coords[5]) &&
(coords[0] == coords[6]) && (coords[2] == coords[4]); (_coords[0] == _coords[6]) && (_coords[2] == _coords[4]);
} }
/** /**
* Returns true if this area encloses only a single contiguous space. * Returns true if this area encloses only a single contiguous space.
*/ */
public boolean isSingular () { public boolean isSingular () {
return (moveToCount <= 1); return (_moveToCount <= 1);
} }
/** /**
* Resets this area to empty. * Resets this area to empty.
*/ */
public void reset () { public void reset () {
coordsSize = 0; _coordsSize = 0;
rulesSize = 0; _rulesSize = 0;
} }
/** /**
@@ -199,7 +199,7 @@ public class Area implements IShape, Cloneable
@Override // from interface IShape @Override // from interface IShape
public boolean isEmpty () { public boolean isEmpty () {
return (rulesSize == 0) && (coordsSize == 0); return (_rulesSize == 0) && (_coordsSize == 0);
} }
@Override // from interface IShape @Override // from interface IShape
@@ -246,13 +246,13 @@ public class Area implements IShape, Cloneable
@Override // from interface IShape @Override // from interface IShape
public Rectangle bounds (Rectangle target) { public Rectangle bounds (Rectangle target) {
float maxX = coords[0], maxY = coords[1]; float maxX = _coords[0], maxY = _coords[1];
float minX = coords[0], minY = coords[1]; float minX = _coords[0], minY = _coords[1];
for (int i = 0; i < coordsSize;) { for (int i = 0; i < _coordsSize;) {
minX = Math.min(minX, coords[i]); minX = Math.min(minX, _coords[i]);
maxX = Math.max(maxX, coords[i++]); maxX = Math.max(maxX, _coords[i++]);
minY = Math.min(minY, coords[i]); minY = Math.min(minY, _coords[i]);
maxY = Math.max(maxY, coords[i++]); maxY = Math.max(maxY, _coords[i++]);
} }
return new Rectangle(minX, minY, maxX - minX, maxY - minY); return new Rectangle(minX, minY, maxX - minX, maxY - minY);
} }
@@ -288,33 +288,33 @@ public class Area implements IShape, Cloneable
private void addCurvePolygon (Area area) { private void addCurvePolygon (Area area) {
CurveCrossingHelper crossHelper = new CurveCrossingHelper( CurveCrossingHelper crossHelper = new CurveCrossingHelper(
new float[][] { coords, area.coords }, new float[][] {_coords, area._coords},
new int[] { coordsSize, area.coordsSize }, new int[] {_coordsSize, area._coordsSize},
new int[][] { rules, area.rules }, new int[][] {_rules, area._rules},
new int[] { rulesSize, area.rulesSize }, new int[] {_rulesSize, area._rulesSize},
new int[][] { offsets, area.offsets }); new int[][] {_offsets, area._offsets});
IntersectPoint[] intersectPoints = crossHelper.findCrossing(); IntersectPoint[] intersectPoints = crossHelper.findCrossing();
if (intersectPoints.length == 0) { if (intersectPoints.length == 0) {
if (area.contains(bounds())) { if (area.contains(bounds())) {
copy(area, this); copy(area, this);
} else if (!contains(area.bounds())) { } else if (!contains(area.bounds())) {
coords = adjustSize(coords, coordsSize + area.coordsSize); _coords = adjustSize(_coords, _coordsSize + area._coordsSize);
System.arraycopy(area.coords, 0, coords, coordsSize, area.coordsSize); System.arraycopy(area._coords, 0, _coords, _coordsSize, area._coordsSize);
coordsSize += area.coordsSize; _coordsSize += area._coordsSize;
rules = adjustSize(rules, rulesSize + area.rulesSize); _rules = adjustSize(_rules, _rulesSize + area._rulesSize);
System.arraycopy(area.rules, 0, rules, rulesSize, area.rulesSize); System.arraycopy(area._rules, 0, _rules, _rulesSize, area._rulesSize);
rulesSize += area.rulesSize; _rulesSize += area._rulesSize;
offsets = adjustSize(offsets, rulesSize + area.rulesSize); _offsets = adjustSize(_offsets, _rulesSize + area._rulesSize);
System.arraycopy(area.offsets, 0, offsets, rulesSize, area.rulesSize); System.arraycopy(area._offsets, 0, _offsets, _rulesSize, area._rulesSize);
} }
return; return;
} }
float[] resultCoords = new float[coordsSize + area.coordsSize + intersectPoints.length]; float[] resultCoords = new float[_coordsSize + area._coordsSize + intersectPoints.length];
int[] resultRules = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultRules = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int[] resultOffsets = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultOffsets = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int resultCoordPos = 0; int resultCoordPos = 0;
int resultRulesPos = 0; int resultRulesPos = 0;
boolean isCurrentArea = true; boolean isCurrentArea = true;
@@ -329,20 +329,20 @@ public class Area implements IShape, Cloneable
int curIndex = point.endIndex(true); int curIndex = point.endIndex(true);
if (curIndex < 0) { if (curIndex < 0) {
isCurrentArea = !isCurrentArea; isCurrentArea = !isCurrentArea;
} else if (area.containsExact(coords[2 * curIndex], coords[2 * curIndex + 1]) > 0) { } else if (area.containsExact(_coords[2 * curIndex], _coords[2 * curIndex + 1]) > 0) {
isCurrentArea = false; isCurrentArea = false;
} else { } else {
isCurrentArea = true; isCurrentArea = true;
} }
IntersectPoint nextPoint = nextIntersectPoint(intersectPoints, point, isCurrentArea); IntersectPoint nextPoint = nextIntersectPoint(intersectPoints, point, isCurrentArea);
float[] coords = (isCurrentArea) ? this.coords : area.coords; float[] coords = (isCurrentArea) ? this._coords : area._coords;
int[] offsets = (isCurrentArea) ? this.offsets : area.offsets; int[] offsets = (isCurrentArea) ? this._offsets : area._offsets;
int[] rules = (isCurrentArea) ? this.rules : area.rules; int[] rules = (isCurrentArea) ? this._rules : area._rules;
int offset = point.ruleIndex(isCurrentArea); int offset = point.ruleIndex(isCurrentArea);
boolean isCopyUntilZero = false; boolean isCopyUntilZero = false;
if ((point.ruleIndex(isCurrentArea) > nextPoint.ruleIndex(isCurrentArea))) { if ((point.ruleIndex(isCurrentArea) > nextPoint.ruleIndex(isCurrentArea))) {
int rulesSize = (isCurrentArea) ? this.rulesSize : area.rulesSize; int rulesSize = (isCurrentArea) ? this._rulesSize : area._rulesSize;
resultCoordPos = includeCoordsAndRules(offset + 1, rulesSize, rules, offsets, resultCoordPos = includeCoordsAndRules(offset + 1, rulesSize, rules, offsets,
resultRules, resultOffsets, resultCoords, coords, resultRulesPos, resultRules, resultOffsets, resultCoords, coords, resultRulesPos,
resultCoordPos, point, isCurrentArea, false, 0); resultCoordPos, point, isCurrentArea, false, 0);
@@ -365,38 +365,38 @@ public class Area implements IShape, Cloneable
resultRules[resultRulesPos++] = PathIterator.SEG_CLOSE; resultRules[resultRulesPos++] = PathIterator.SEG_CLOSE;
resultOffsets[resultRulesPos - 1] = resultCoordPos; resultOffsets[resultRulesPos - 1] = resultCoordPos;
this.coords = resultCoords; this._coords = resultCoords;
this.rules = resultRules; this._rules = resultRules;
this.offsets = resultOffsets; this._offsets = resultOffsets;
this.coordsSize = resultCoordPos; this._coordsSize = resultCoordPos;
this.rulesSize = resultRulesPos; this._rulesSize = resultRulesPos;
} }
private void addPolygon (Area area) { private void addPolygon (Area area) {
CrossingHelper crossHelper = new CrossingHelper( CrossingHelper crossHelper = new CrossingHelper(
new float[][] { coords, area.coords }, new float[][] {_coords, area._coords},
new int[] { coordsSize, area.coordsSize }); new int[] {_coordsSize, area._coordsSize});
IntersectPoint[] intersectPoints = crossHelper.findCrossing(); IntersectPoint[] intersectPoints = crossHelper.findCrossing();
if (intersectPoints.length == 0) { if (intersectPoints.length == 0) {
if (area.contains(bounds())) { if (area.contains(bounds())) {
copy(area, this); copy(area, this);
} else if (!contains(area.bounds())) { } else if (!contains(area.bounds())) {
coords = adjustSize(coords, coordsSize + area.coordsSize); _coords = adjustSize(_coords, _coordsSize + area._coordsSize);
System.arraycopy(area.coords, 0, coords, coordsSize, area.coordsSize); System.arraycopy(area._coords, 0, _coords, _coordsSize, area._coordsSize);
coordsSize += area.coordsSize; _coordsSize += area._coordsSize;
rules = adjustSize(rules, rulesSize + area.rulesSize); _rules = adjustSize(_rules, _rulesSize + area._rulesSize);
System.arraycopy(area.rules, 0, rules, rulesSize, area.rulesSize); System.arraycopy(area._rules, 0, _rules, _rulesSize, area._rulesSize);
rulesSize += area.rulesSize; _rulesSize += area._rulesSize;
offsets = adjustSize(offsets, rulesSize + area.rulesSize); _offsets = adjustSize(_offsets, _rulesSize + area._rulesSize);
System.arraycopy(area.offsets, 0, offsets, rulesSize, area.rulesSize); System.arraycopy(area._offsets, 0, _offsets, _rulesSize, area._rulesSize);
} }
return; return;
} }
float[] resultCoords = new float[coordsSize + area.coordsSize + intersectPoints.length]; float[] resultCoords = new float[_coordsSize + area._coordsSize + intersectPoints.length];
int[] resultRules = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultRules = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int[] resultOffsets = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultOffsets = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int resultCoordPos = 0; int resultCoordPos = 0;
int resultRulesPos = 0; int resultRulesPos = 0;
boolean isCurrentArea = true; boolean isCurrentArea = true;
@@ -413,18 +413,18 @@ public class Area implements IShape, Cloneable
int curIndex = point.endIndex(true); int curIndex = point.endIndex(true);
if (curIndex < 0) { if (curIndex < 0) {
isCurrentArea = !isCurrentArea; isCurrentArea = !isCurrentArea;
} else if (area.containsExact(coords[2 * curIndex], coords[2 * curIndex + 1]) > 0) { } else if (area.containsExact(_coords[2 * curIndex], _coords[2 * curIndex + 1]) > 0) {
isCurrentArea = false; isCurrentArea = false;
} else { } else {
isCurrentArea = true; isCurrentArea = true;
} }
IntersectPoint nextPoint = nextIntersectPoint(intersectPoints, point, isCurrentArea); IntersectPoint nextPoint = nextIntersectPoint(intersectPoints, point, isCurrentArea);
float[] coords = (isCurrentArea) ? this.coords : area.coords; float[] coords = (isCurrentArea) ? this._coords : area._coords;
int offset = 2 * point.endIndex(isCurrentArea); int offset = 2 * point.endIndex(isCurrentArea);
if ((offset >= 0) && if ((offset >= 0) &&
(nextPoint.begIndex(isCurrentArea) < point.endIndex(isCurrentArea))) { (nextPoint.begIndex(isCurrentArea) < point.endIndex(isCurrentArea))) {
int coordSize = (isCurrentArea) ? this.coordsSize : area.coordsSize; int coordSize = (isCurrentArea) ? this._coordsSize : area._coordsSize;
int length = coordSize - offset; int length = coordSize - offset;
System.arraycopy(coords, offset, resultCoords, resultCoordPos, length); System.arraycopy(coords, offset, resultCoords, resultCoordPos, length);
@@ -453,20 +453,20 @@ public class Area implements IShape, Cloneable
resultRules[resultRulesPos - 1] = PathIterator.SEG_CLOSE; resultRules[resultRulesPos - 1] = PathIterator.SEG_CLOSE;
resultOffsets[resultRulesPos - 1] = resultCoordPos; resultOffsets[resultRulesPos - 1] = resultCoordPos;
coords = resultCoords; _coords = resultCoords;
rules = resultRules; _rules = resultRules;
offsets = resultOffsets; _offsets = resultOffsets;
coordsSize = resultCoordPos; _coordsSize = resultCoordPos;
rulesSize = resultRulesPos; _rulesSize = resultRulesPos;
} }
private void intersectCurvePolygon (Area area) { private void intersectCurvePolygon (Area area) {
CurveCrossingHelper crossHelper = new CurveCrossingHelper( CurveCrossingHelper crossHelper = new CurveCrossingHelper(
new float[][] { coords, area.coords }, new float[][] {_coords, area._coords},
new int[] { coordsSize, area.coordsSize }, new int[] {_coordsSize, area._coordsSize},
new int[][] { rules, area.rules }, new int[][] {_rules, area._rules},
new int[] { rulesSize, area.rulesSize }, new int[] {_rulesSize, area._rulesSize},
new int[][] { offsets, area.offsets }); new int[][] {_offsets, area._offsets});
IntersectPoint[] intersectPoints = crossHelper.findCrossing(); IntersectPoint[] intersectPoints = crossHelper.findCrossing();
if (intersectPoints.length == 0) { if (intersectPoints.length == 0) {
if (contains(area.bounds())) { if (contains(area.bounds())) {
@@ -477,9 +477,9 @@ public class Area implements IShape, Cloneable
return; return;
} }
float[] resultCoords = new float[coordsSize + area.coordsSize + intersectPoints.length]; float[] resultCoords = new float[_coordsSize + area._coordsSize + intersectPoints.length];
int[] resultRules = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultRules = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int[] resultOffsets = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultOffsets = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int resultCoordPos = 0; int resultCoordPos = 0;
int resultRulesPos = 0; int resultRulesPos = 0;
boolean isCurrentArea = true; boolean isCurrentArea = true;
@@ -495,23 +495,23 @@ public class Area implements IShape, Cloneable
int curIndex = point.endIndex(true); int curIndex = point.endIndex(true);
if ((curIndex < 0) || if ((curIndex < 0) ||
(area.containsExact(coords[2 * curIndex], coords[2 * curIndex + 1]) == 0)) { (area.containsExact(_coords[2 * curIndex], _coords[2 * curIndex + 1]) == 0)) {
isCurrentArea = !isCurrentArea; isCurrentArea = !isCurrentArea;
} else if (area.containsExact(coords[2 * curIndex], coords[2 * curIndex + 1]) > 0) { } else if (area.containsExact(_coords[2 * curIndex], _coords[2 * curIndex + 1]) > 0) {
isCurrentArea = true; isCurrentArea = true;
} else { } else {
isCurrentArea = false; isCurrentArea = false;
} }
nextPoint = nextIntersectPoint(intersectPoints, point, isCurrentArea); nextPoint = nextIntersectPoint(intersectPoints, point, isCurrentArea);
float[] coords = (isCurrentArea) ? this.coords : area.coords; float[] coords = (isCurrentArea) ? this._coords : area._coords;
int[] offsets = (isCurrentArea) ? this.offsets : area.offsets; int[] offsets = (isCurrentArea) ? this._offsets : area._offsets;
int[] rules = (isCurrentArea) ? this.rules : area.rules; int[] rules = (isCurrentArea) ? this._rules : area._rules;
int offset = point.ruleIndex(isCurrentArea); int offset = point.ruleIndex(isCurrentArea);
boolean isCopyUntilZero = false; boolean isCopyUntilZero = false;
if (point.ruleIndex(isCurrentArea) > nextPoint.ruleIndex(isCurrentArea)) { if (point.ruleIndex(isCurrentArea) > nextPoint.ruleIndex(isCurrentArea)) {
int rulesSize = (isCurrentArea) ? this.rulesSize : area.rulesSize; int rulesSize = (isCurrentArea) ? this._rulesSize : area._rulesSize;
resultCoordPos = includeCoordsAndRules( resultCoordPos = includeCoordsAndRules(
offset + 1, rulesSize, rules, offsets, resultRules, resultOffsets, offset + 1, rulesSize, rules, offsets, resultRules, resultOffsets,
resultCoords, coords, resultRulesPos, resultCoordPos, point, isCurrentArea, resultCoords, coords, resultRulesPos, resultCoordPos, point, isCurrentArea,
@@ -554,17 +554,17 @@ public class Area implements IShape, Cloneable
} }
resultOffsets[resultRulesPos - 1] = resultCoordPos; resultOffsets[resultRulesPos - 1] = resultCoordPos;
coords = resultCoords; _coords = resultCoords;
rules = resultRules; _rules = resultRules;
offsets = resultOffsets; _offsets = resultOffsets;
coordsSize = resultCoordPos; _coordsSize = resultCoordPos;
rulesSize = resultRulesPos; _rulesSize = resultRulesPos;
} }
private void intersectPolygon (Area area) { private void intersectPolygon (Area area) {
CrossingHelper crossHelper = new CrossingHelper( CrossingHelper crossHelper = new CrossingHelper(
new float[][] { coords, area.coords }, new float[][] {_coords, area._coords},
new int[] { coordsSize, area.coordsSize }); new int[] {_coordsSize, area._coordsSize});
IntersectPoint[] intersectPoints = crossHelper.findCrossing(); IntersectPoint[] intersectPoints = crossHelper.findCrossing();
if (intersectPoints.length == 0) { if (intersectPoints.length == 0) {
if (contains(area.bounds())) { if (contains(area.bounds())) {
@@ -575,9 +575,9 @@ public class Area implements IShape, Cloneable
return; return;
} }
float[] resultCoords = new float[coordsSize + area.coordsSize + intersectPoints.length]; float[] resultCoords = new float[_coordsSize + area._coordsSize + intersectPoints.length];
int[] resultRules = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultRules = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int[] resultOffsets = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultOffsets = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int resultCoordPos = 0; int resultCoordPos = 0;
int resultRulesPos = 0; int resultRulesPos = 0;
boolean isCurrentArea = true; boolean isCurrentArea = true;
@@ -594,20 +594,20 @@ public class Area implements IShape, Cloneable
int curIndex = point.endIndex(true); int curIndex = point.endIndex(true);
if ((curIndex < 0) || if ((curIndex < 0) ||
(area.containsExact(coords[2 * curIndex], coords[2 * curIndex + 1]) == 0)) { (area.containsExact(_coords[2 * curIndex], _coords[2 * curIndex + 1]) == 0)) {
isCurrentArea = !isCurrentArea; isCurrentArea = !isCurrentArea;
} else if (area.containsExact(coords[2 * curIndex], coords[2 * curIndex + 1]) > 0) { } else if (area.containsExact(_coords[2 * curIndex], _coords[2 * curIndex + 1]) > 0) {
isCurrentArea = true; isCurrentArea = true;
} else { } else {
isCurrentArea = false; isCurrentArea = false;
} }
IntersectPoint nextPoint = nextIntersectPoint(intersectPoints, point, isCurrentArea); IntersectPoint nextPoint = nextIntersectPoint(intersectPoints, point, isCurrentArea);
float[] coords = (isCurrentArea) ? this.coords : area.coords; float[] coords = (isCurrentArea) ? this._coords : area._coords;
int offset = 2 * point.endIndex(isCurrentArea); int offset = 2 * point.endIndex(isCurrentArea);
if ((offset >= 0) && if ((offset >= 0) &&
(nextPoint.begIndex(isCurrentArea) < point.endIndex(isCurrentArea))) { (nextPoint.begIndex(isCurrentArea) < point.endIndex(isCurrentArea))) {
int coordSize = (isCurrentArea) ? this.coordsSize : area.coordsSize; int coordSize = (isCurrentArea) ? this._coordsSize : area._coordsSize;
int length = coordSize - offset; int length = coordSize - offset;
System.arraycopy(coords, offset, resultCoords, resultCoordPos, length); System.arraycopy(coords, offset, resultCoords, resultCoordPos, length);
@@ -636,29 +636,29 @@ public class Area implements IShape, Cloneable
resultRules[resultRulesPos - 1] = PathIterator.SEG_CLOSE; resultRules[resultRulesPos - 1] = PathIterator.SEG_CLOSE;
resultOffsets[resultRulesPos - 1] = resultCoordPos; resultOffsets[resultRulesPos - 1] = resultCoordPos;
coords = resultCoords; _coords = resultCoords;
rules = resultRules; _rules = resultRules;
offsets = resultOffsets; _offsets = resultOffsets;
coordsSize = resultCoordPos; _coordsSize = resultCoordPos;
rulesSize = resultRulesPos; _rulesSize = resultRulesPos;
} }
private void subtractCurvePolygon (Area area) { private void subtractCurvePolygon (Area area) {
CurveCrossingHelper crossHelper = new CurveCrossingHelper( CurveCrossingHelper crossHelper = new CurveCrossingHelper(
new float[][] { coords, area.coords }, new float[][] {_coords, area._coords},
new int[] { coordsSize, area.coordsSize }, new int[] {_coordsSize, area._coordsSize},
new int[][] { rules, area.rules }, new int[][] {_rules, area._rules},
new int[] { rulesSize, area.rulesSize }, new int[] {_rulesSize, area._rulesSize},
new int[][] { offsets, area.offsets }); new int[][] {_offsets, area._offsets});
IntersectPoint[] intersectPoints = crossHelper.findCrossing(); IntersectPoint[] intersectPoints = crossHelper.findCrossing();
if (intersectPoints.length == 0 && contains(area.bounds())) { if (intersectPoints.length == 0 && contains(area.bounds())) {
copy(area, this); copy(area, this);
return; return;
} }
float[] resultCoords = new float[coordsSize + area.coordsSize + intersectPoints.length]; float[] resultCoords = new float[_coordsSize + area._coordsSize + intersectPoints.length];
int[] resultRules = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultRules = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int[] resultOffsets = new int[rulesSize + area.rulesSize + intersectPoints.length]; int[] resultOffsets = new int[_rulesSize + area._rulesSize + intersectPoints.length];
int resultCoordPos = 0; int resultCoordPos = 0;
int resultRulesPos = 0; int resultRulesPos = 0;
boolean isCurrentArea = true; boolean isCurrentArea = true;
@@ -670,10 +670,10 @@ public class Area implements IShape, Cloneable
do { do {
resultCoords[resultCoordPos++] = point.x(); resultCoords[resultCoordPos++] = point.x();
resultCoords[resultCoordPos++] = point.y(); resultCoords[resultCoordPos++] = point.y();
int curIndex = offsets[point.ruleIndex(true)] % coordsSize; int curIndex = _offsets[point.ruleIndex(true)] % _coordsSize;
if (area.containsExact(coords[curIndex], coords[curIndex + 1]) == 0) { if (area.containsExact(_coords[curIndex], _coords[curIndex + 1]) == 0) {
isCurrentArea = !isCurrentArea; isCurrentArea = !isCurrentArea;
} else if (area.containsExact(coords[curIndex], coords[curIndex + 1]) > 0) { } else if (area.containsExact(_coords[curIndex], _coords[curIndex + 1]) > 0) {
isCurrentArea = false; isCurrentArea = false;
} else { } else {
isCurrentArea = true; isCurrentArea = true;
@@ -682,9 +682,9 @@ public class Area implements IShape, Cloneable
IntersectPoint nextPoint = (isCurrentArea) ? IntersectPoint nextPoint = (isCurrentArea) ?
nextIntersectPoint(intersectPoints, point, isCurrentArea) : nextIntersectPoint(intersectPoints, point, isCurrentArea) :
prevIntersectPoint(intersectPoints, point, isCurrentArea); prevIntersectPoint(intersectPoints, point, isCurrentArea);
float[] coords = (isCurrentArea) ? this.coords : area.coords; float[] coords = (isCurrentArea) ? this._coords : area._coords;
int[] offsets = (isCurrentArea) ? this.offsets : area.offsets; int[] offsets = (isCurrentArea) ? this._offsets : area._offsets;
int[] rules = (isCurrentArea) ? this.rules : area.rules; int[] rules = (isCurrentArea) ? this._rules : area._rules;
int offset = (isCurrentArea) ? point.ruleIndex(isCurrentArea) : int offset = (isCurrentArea) ? point.ruleIndex(isCurrentArea) :
nextPoint.ruleIndex(isCurrentArea); nextPoint.ruleIndex(isCurrentArea);
boolean isCopyUntilZero = false; boolean isCopyUntilZero = false;
@@ -693,7 +693,7 @@ public class Area implements IShape, Cloneable
(point.ruleIndex(isCurrentArea) > nextPoint.ruleIndex(isCurrentArea))) || (point.ruleIndex(isCurrentArea) > nextPoint.ruleIndex(isCurrentArea))) ||
((!isCurrentArea) && ((!isCurrentArea) &&
(nextPoint.ruleIndex(isCurrentArea) > nextPoint.ruleIndex(isCurrentArea)))) { (nextPoint.ruleIndex(isCurrentArea) > nextPoint.ruleIndex(isCurrentArea)))) {
int rulesSize = (isCurrentArea) ? this.rulesSize : area.rulesSize; int rulesSize = (isCurrentArea) ? this._rulesSize : area._rulesSize;
resultCoordPos = includeCoordsAndRules( resultCoordPos = includeCoordsAndRules(
offset + 1, rulesSize, rules, offsets, resultRules, resultOffsets, resultCoords, offset + 1, rulesSize, rules, offsets, resultRules, resultOffsets, resultCoords,
coords, resultRulesPos, resultCoordPos, point, isCurrentArea, false, 2); coords, resultRulesPos, resultCoordPos, point, isCurrentArea, false, 2);
@@ -727,17 +727,17 @@ public class Area implements IShape, Cloneable
resultRules[resultRulesPos++] = PathIterator.SEG_CLOSE; resultRules[resultRulesPos++] = PathIterator.SEG_CLOSE;
resultOffsets[resultRulesPos - 1] = resultCoordPos; resultOffsets[resultRulesPos - 1] = resultCoordPos;
coords = resultCoords; _coords = resultCoords;
rules = resultRules; _rules = resultRules;
offsets = resultOffsets; _offsets = resultOffsets;
coordsSize = resultCoordPos; _coordsSize = resultCoordPos;
rulesSize = resultRulesPos; _rulesSize = resultRulesPos;
} }
private void subtractPolygon (Area area) { private void subtractPolygon (Area area) {
CrossingHelper crossHelper = new CrossingHelper( CrossingHelper crossHelper = new CrossingHelper(
new float[][] { coords, area.coords }, new float[][] {_coords, area._coords},
new int[] { coordsSize, area.coordsSize }); new int[] {_coordsSize, area._coordsSize});
IntersectPoint[] intersectPoints = crossHelper.findCrossing(); IntersectPoint[] intersectPoints = crossHelper.findCrossing();
if (intersectPoints.length == 0) { if (intersectPoints.length == 0) {
if (contains(area.bounds())) { if (contains(area.bounds())) {
@@ -748,9 +748,9 @@ public class Area implements IShape, Cloneable
} }
float[] resultCoords = new float[ float[] resultCoords = new float[
2 * (coordsSize + area.coordsSize + intersectPoints.length)]; 2 * (_coordsSize + area._coordsSize + intersectPoints.length)];
int[] resultRules = new int[2 * (rulesSize + area.rulesSize + intersectPoints.length)]; int[] resultRules = new int[2 * (_rulesSize + area._rulesSize + intersectPoints.length)];
int[] resultOffsets = new int[2 * (rulesSize + area.rulesSize + intersectPoints.length)]; int[] resultOffsets = new int[2 * (_rulesSize + area._rulesSize + intersectPoints.length)];
int resultCoordPos = 0; int resultCoordPos = 0;
int resultRulesPos = 0; int resultRulesPos = 0;
boolean isCurrentArea = true; boolean isCurrentArea = true;
@@ -770,13 +770,13 @@ public class Area implements IShape, Cloneable
int curIndex = point.endIndex(true); int curIndex = point.endIndex(true);
if ((curIndex < 0) || if ((curIndex < 0) ||
(area.isVertex(coords[2 * curIndex], coords[2 * curIndex + 1]) && (area.isVertex(_coords[2 * curIndex], _coords[2 * curIndex + 1]) &&
crossHelper.containsPoint(new float[] { coords[2 * curIndex], crossHelper.containsPoint(new float[] { _coords[2 * curIndex],
coords[2 * curIndex + 1] }) && _coords[2 * curIndex + 1] }) &&
(coords[2 * curIndex] != point.x() || (_coords[2 * curIndex] != point.x() ||
coords[2 * curIndex + 1] != point.y()))) { _coords[2 * curIndex + 1] != point.y()))) {
isCurrentArea = !isCurrentArea; isCurrentArea = !isCurrentArea;
} else if (area.containsExact(coords[2 * curIndex], coords[2 * curIndex + 1]) > 0) { } else if (area.containsExact(_coords[2 * curIndex], _coords[2 * curIndex + 1]) > 0) {
isCurrentArea = false; isCurrentArea = false;
} else { } else {
isCurrentArea = true; isCurrentArea = true;
@@ -795,7 +795,7 @@ public class Area implements IShape, Cloneable
IntersectPoint nextPoint = (isCurrentArea) ? IntersectPoint nextPoint = (isCurrentArea) ?
nextIntersectPoint(intersectPoints, point, isCurrentArea) : nextIntersectPoint(intersectPoints, point, isCurrentArea) :
prevIntersectPoint(intersectPoints, point, isCurrentArea); prevIntersectPoint(intersectPoints, point, isCurrentArea);
float[] coords = (isCurrentArea) ? this.coords : area.coords; float[] coords = (isCurrentArea) ? this._coords : area._coords;
int offset = (isCurrentArea) ? 2 * point.endIndex(isCurrentArea) : int offset = (isCurrentArea) ? 2 * point.endIndex(isCurrentArea) :
2 * nextPoint.endIndex(isCurrentArea); 2 * nextPoint.endIndex(isCurrentArea);
@@ -806,7 +806,7 @@ public class Area implements IShape, Cloneable
((!isCurrentArea) && ((!isCurrentArea) &&
(nextPoint.endIndex(isCurrentArea) < nextPoint.begIndex(isCurrentArea))))) { (nextPoint.endIndex(isCurrentArea) < nextPoint.begIndex(isCurrentArea))))) {
int coordSize = (isCurrentArea) ? this.coordsSize : area.coordsSize; int coordSize = (isCurrentArea) ? this._coordsSize : area._coordsSize;
int length = coordSize - offset; int length = coordSize - offset;
if (isCurrentArea) { if (isCurrentArea) {
@@ -854,11 +854,11 @@ public class Area implements IShape, Cloneable
resultRules[resultRulesPos - 1] = PathIterator.SEG_CLOSE; resultRules[resultRulesPos - 1] = PathIterator.SEG_CLOSE;
resultOffsets[resultRulesPos - 1] = resultCoordPos; resultOffsets[resultRulesPos - 1] = resultCoordPos;
coords = resultCoords; _coords = resultCoords;
rules = resultRules; _rules = resultRules;
offsets = resultOffsets; _offsets = resultOffsets;
coordsSize = resultCoordPos; _coordsSize = resultCoordPos;
rulesSize = resultRulesPos; _rulesSize = resultRulesPos;
} }
private IntersectPoint nextIntersectPoint (IntersectPoint[] iPoints, private IntersectPoint nextIntersectPoint (IntersectPoint[] iPoints,
@@ -1039,12 +1039,12 @@ public class Area implements IShape, Cloneable
} }
private void copy (Area src, Area dst) { private void copy (Area src, Area dst) {
dst.coordsSize = src.coordsSize; dst._coordsSize = src._coordsSize;
dst.coords = Platform.clone(src.coords); dst._coords = Platform.clone(src._coords);
dst.rulesSize = src.rulesSize; dst._rulesSize = src._rulesSize;
dst.rules = Platform.clone(src.rules); dst._rules = Platform.clone(src._rules);
dst.moveToCount = src.moveToCount; dst._moveToCount = src._moveToCount;
dst.offsets = Platform.clone(src.offsets); dst._offsets = Platform.clone(src._offsets);
} }
private int containsExact (float x, float y) { private int containsExact (float x, float y) {
@@ -1129,8 +1129,8 @@ public class Area implements IShape, Cloneable
} }
private boolean isVertex (float x, float y) { private boolean isVertex (float x, float y) {
for (int i = 0; i < coordsSize;) { for (int i = 0; i < _coordsSize;) {
if (x == coords[i++] && y == coords[i++]) { if (x == _coords[i++] && y == _coords[i++]) {
return true; return true;
} }
} }
@@ -1172,11 +1172,11 @@ public class Area implements IShape, Cloneable
} }
@Override public boolean isDone () { @Override public boolean isDone () {
return curRuleIndex >= rulesSize; return curRuleIndex >= _rulesSize;
} }
@Override public void next () { @Override public void next () {
switch (rules[curRuleIndex]) { switch (_rules[curRuleIndex]) {
case PathIterator.SEG_MOVETO: case PathIterator.SEG_MOVETO:
case PathIterator.SEG_LINETO: case PathIterator.SEG_LINETO:
curCoordIndex += 2; curCoordIndex += 2;
@@ -1199,19 +1199,19 @@ public class Area implements IShape, Cloneable
int count = 0; int count = 0;
// the fallthrough below is on purpose // the fallthrough below is on purpose
switch (rules[curRuleIndex]) { switch (_rules[curRuleIndex]) {
case PathIterator.SEG_CUBICTO: case PathIterator.SEG_CUBICTO:
c[4] = coords[curCoordIndex + 4]; c[4] = _coords[curCoordIndex + 4];
c[5] = coords[curCoordIndex + 5]; c[5] = _coords[curCoordIndex + 5];
count = 1; count = 1;
case PathIterator.SEG_QUADTO: case PathIterator.SEG_QUADTO:
c[2] = coords[curCoordIndex + 2]; c[2] = _coords[curCoordIndex + 2];
c[3] = coords[curCoordIndex + 3]; c[3] = _coords[curCoordIndex + 3];
count += 1; count += 1;
case PathIterator.SEG_MOVETO: case PathIterator.SEG_MOVETO:
case PathIterator.SEG_LINETO: case PathIterator.SEG_LINETO:
c[0] = coords[curCoordIndex]; c[0] = _coords[curCoordIndex];
c[1] = coords[curCoordIndex + 1]; c[1] = _coords[curCoordIndex + 1];
count += 1; count += 1;
} }
@@ -1219,28 +1219,28 @@ public class Area implements IShape, Cloneable
transform.transform(c, 0, c, 0, count); transform.transform(c, 0, c, 0, count);
} }
return rules[curRuleIndex]; return _rules[curRuleIndex];
} }
} }
/** The coordinates array of the shape vertices. */ /** The coordinates array of the shape vertices. */
private float[] coords = new float[20]; private float[] _coords = new float[20];
/** The coordinates quantity. */ /** The coordinates quantity. */
private int coordsSize = 0; private int _coordsSize = 0;
/** The rules array for the drawing of the shape edges. */ /** The _rules array for the drawing of the shape edges. */
private int[] rules = new int[10]; private int[] _rules = new int[10];
/** The rules quantity. */ /** The _rules quantity. */
private int rulesSize = 0; private int _rulesSize = 0;
/** offsets[i] - index in array of coords and i - index in array of rules. */ /** _offsets[i] - index in array of _coords and i - index in array of _rules. */
private int[] offsets = new int[10]; private int[] _offsets = new int[10];
/** The quantity of MOVETO rule occurrences. */ /** The quantity of MOVETO rule occurrences. */
private int moveToCount = 0; private int _moveToCount = 0;
/** True if the shape is polygonal. */ /** True if the shape is polygonal. */
private boolean isPolygonal = true; private boolean _isPolygonal = true;
} }