Add minimum/maximumY to FlatRegion and fix a typo in Polygonal2DRegion

Dieser Commit ist enthalten in:
aumgn 2012-04-16 07:41:14 +02:00
Ursprung 6915244ab9
Commit a7b49ff793
4 geänderte Dateien mit 30 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -87,6 +87,14 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
Math.max(pos1.getZ(), pos2.getZ()));
}
public int getMinimumY() {
return Math.min(pos1.getBlockX(), pos2.getBlockY());
}
public int getMaximumY() {
return Math.max(pos1.getBlockX(), pos2.getBlockY());
}
/**
* Get the number of blocks in the region.
*

Datei anzeigen

@ -23,5 +23,19 @@ import com.sk89q.worldedit.Vector2D;
public interface FlatRegion extends Region {
/**
* Gets the minimum Y value
*
* @return
*/
public int getMinimumY();
/**
* Gets the maximum Y value
*
* @return
*/
public int getMaximumY();
public Iterable<Vector2D> asFlatRegion();
}

Datei anzeigen

@ -167,6 +167,11 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion {
*
* @return min y
*/
public int getMinimumY() {
return minY;
}
@Deprecated
public int getMininumY() {
return minY;
}

Datei anzeigen

@ -124,14 +124,14 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion {
session.dispatchCUIEvent(player, new SelectionShapeEvent(getTypeID()));
session.dispatchCUIEvent(player, new SelectionPoint2DEvent(0, pos, getArea()));
session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.getMininumY(), region.getMaximumY()));
session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.getMinimumY(), region.getMaximumY()));
}
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) {
player.print("Added point #" + region.size() + " at " + pos + ".");
session.dispatchCUIEvent(player, new SelectionPoint2DEvent(region.size() - 1, pos, getArea()));
session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.getMininumY(), region.getMaximumY()));
session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.getMinimumY(), region.getMaximumY()));
}
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
@ -195,7 +195,7 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion {
session.dispatchCUIEvent(player, new SelectionPoint2DEvent(id, points.get(id), getArea()));
}
session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.getMininumY(), region.getMaximumY()));
session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.getMinimumY(), region.getMaximumY()));
}
public void describeLegacyCUI(LocalSession session, LocalPlayer player) {