Added grow() and a Log class.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2490 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: GeomUtil.java,v 1.3 2002/10/29 06:07:22 mdb Exp $
|
// $Id: GeomUtil.java,v 1.4 2003/04/28 20:27:52 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.geom;
|
package com.threerings.geom;
|
||||||
|
|
||||||
@@ -140,4 +140,25 @@ public class GeomUtil
|
|||||||
tainer.y = tained.y - (tainer.height - tained.height);
|
tainer.y = tained.y - (tainer.height - tained.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the target rectangle to the bounds of the source rectangle. If
|
||||||
|
* the source rectangle is null, a new rectangle is created that is the
|
||||||
|
* size of the target rectangle.
|
||||||
|
*
|
||||||
|
* @return the source rectangle.
|
||||||
|
*/
|
||||||
|
public static Rectangle grow (Rectangle source, Rectangle target)
|
||||||
|
{
|
||||||
|
if (target == null) {
|
||||||
|
Log.warning("Can't grow with null rectangle [src=" + source +
|
||||||
|
", tgt=" + target + "].");
|
||||||
|
Thread.dumpStack();
|
||||||
|
} else if (source == null) {
|
||||||
|
source = new Rectangle(target);
|
||||||
|
} else {
|
||||||
|
source.add(target);
|
||||||
|
}
|
||||||
|
return source;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
//
|
||||||
|
// $Id: Log.java,v 1.1 2003/04/28 20:27:52 mdb Exp $
|
||||||
|
|
||||||
|
package com.threerings.geom;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A placeholder class that contains a reference to the log object used by
|
||||||
|
* this package.
|
||||||
|
*/
|
||||||
|
public class Log
|
||||||
|
{
|
||||||
|
public static final String PACKAGE = "geom";
|
||||||
|
|
||||||
|
public static com.samskivert.util.Log log =
|
||||||
|
new com.samskivert.util.Log(PACKAGE);
|
||||||
|
|
||||||
|
/** Convenience function. */
|
||||||
|
public static void debug (String message)
|
||||||
|
{
|
||||||
|
log.debug(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Convenience function. */
|
||||||
|
public static void info (String message)
|
||||||
|
{
|
||||||
|
log.info(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Convenience function. */
|
||||||
|
public static void warning (String message)
|
||||||
|
{
|
||||||
|
log.warning(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Convenience function. */
|
||||||
|
public static void logStackTrace (Throwable t)
|
||||||
|
{
|
||||||
|
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getLevel ()
|
||||||
|
{
|
||||||
|
return log.getLevel(PACKAGE);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user