2362N/A * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 2362N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Map is used to represent a map element that is part of an HTML document. 0N/A * Once a Map has been created, and any number of areas have been added, 0N/A * you can test if a point falls inside the map via the contains method. 0N/A * @author Scott Violet 0N/A /** Name of the Map. */ 0N/A /** An array of AttributeSets. */ 0N/A /** An array of RegionContainments, will slowly grow to match the 0N/A * length of areaAttributes as needed. */ * Returns the name of the Map. * Defines a region of the Map, based on the passed in AttributeSet. * Removes the previously created area. * Returns the AttributeSets representing the differet areas of the Map. * Returns the AttributeSet that contains the passed in location, * <code>x</code>, <code>y</code>. <code>width</code>, <code>height</code> * gives the size of the region the map is defined over. If a matching * area is found, the AttribueSet for it is returned. * Creates and returns an instance of RegionContainment that can be * used to test if a particular point lies inside a region. // Something wrong with attributes. * Creates and returns an array of integers from the String * <code>stringCoords</code>. If one of the values represents a * % the returned value with be negative. If a parse error results * from trying to parse one of the numbers null is returned. * Defines the interface used for to check if a point is inside a * Returns true if the location <code>x</code>, <code>y</code> * falls inside the region defined in the receiver. * <code>width</code>, <code>height</code> is the size of * Used to test for containment in a rectangular region. /** Will be non-null if one of the values is a percent, and any value * that is non null indicates it is a percent * (order is x, y, width, height). */ /** Last value of width passed in. */ /** Last value of height passed in. */ if (
x0 <
0 ||
y0 <
0 ||
x1 <
0 ||
y1 <
0) {
return ((x >=
x0 && x <=
x1) &&
* Used to test for containment in a polygon region. /** If any value is a percent there will be an entry here for the * percent value. Use percentIndex to find out the index for it. */ /** Last value of width passed in. */ /** Last value of height passed in. */ // Force the bounding box to be recalced. * Used to test for containment in a circular region. /** X origin of the circle. */ /** Y origin of the circle. */ /** Radius of the circle. */ /** Non-null indicates one of the values represents a percent. */ /** Last value of width passed in. */ /** Last value of height passed in. */ return (((x -
this.x) * (x -
this.x) +
* An implementation that will return true if the x, y location is * inside a rectangle defined by origin 0, 0, and width equal to * width passed in, and height equal to height passed in. /** A global shared instance. */ return (x <=
width && x >=
0 && y >=
0 && y <=
width);