|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectshady.common.Environment
public class Environment
An environment in which Shady can play.
An environment is a set of Segments.
Copyright (C) 2006 Marsette A. Vona, III
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
| Field Summary | |
|---|---|
protected boolean |
boundsDirty
Whether we need to recomputeBounds(). |
protected double |
centerX
The center x coord in this environment, 0.0 if isEmpty(). |
protected double |
centerY
The center y coord in this environment, 0.0 if isEmpty(). |
private static java.lang.String |
cvsid
CVS id. |
static double |
DEFAULT_BAR_WIDTH
The bar width, in meters, in Stata 34-376. |
static double |
DEFAULT_COLUMN_WIDTH
The pane column width, bar center to bar center, in meters, in Stata 34-376. |
static double |
DEFAULT_MAX_LOWER_ROW_HEIGHT
The max lower pane row height, midbar center to lower bar top, in meters, in Stata 34-376. |
static double |
DEFAULT_MIN_LOWER_ROW_HEIGHT
The min lower pane row height, midbar center to lower bar top, in meters, in Stata 34-376. |
static int |
DEFAULT_NUM_PANE_COLUMNS
The number of pane columns in Stata 34-376. |
static double |
DEFAULT_UPPER_ROW_HEIGHT
The upper pane row height, midbar center to ceiling, in meters, in Stata 34-376. |
protected double |
height
The height of this environment, 0.0 if isEmpty(). |
protected java.util.Vector |
listeners
The currently registered EnvironmentListeners. |
boolean |
lockBounds
Whether to lock the bounds variables at their current values. |
protected double |
maxX
The maximum x coordinate in this environment, 0.0 if isEmpty(). |
protected double |
maxY
The maximum y coordinate in this environment, 0.0 if isEmpty(). |
protected double |
minX
The minimum x coordinate in this environment, 0.0 if isEmpty(). |
protected double |
minY
The minimum y coordinate in this environment, 0.0 if isEmpty(). |
protected java.util.Vector |
segments
The Segments in this Environment. |
protected double |
width
The width of this environment, 0.0 if isEmpty(). |
| Constructor Summary | |
|---|---|
Environment()
Covers Environment(double), uses a default
exclude. |
|
Environment(double exclude)
Makes a default environment that models the window in Stata 34-376. |
|
Environment(Segment[] segment)
Make a new Environment. |
|
| Method Summary | |
|---|---|
void |
addListener(EnvironmentListener l)
Add an EnvironmentListener. |
int |
addSegment(double startX,
double startY,
double endX,
double endY)
Add a new segment at the end of the list. |
void |
clearSegments()
Remove all segments from this Environment. |
java.util.Enumeration |
enumerateSegments()
Get an Enumeration over the segments. |
protected void |
fireEnvironmentChanged()
Fire an EnvironmentListener.environmentChanged(shady.common.Environment) to all our
listeners. |
double |
getCenterX()
Get center x coord in this environment. |
double |
getCenterY()
Get center y coord in this environment. |
double |
getHeight()
Get the height of this environment. |
double |
getMaxX()
Get the maximum x coordinate in this environment. |
double |
getMaxY()
Get the maximum y coordinate in this environment. |
double |
getMinX()
Get the minimum x coordinate in this environment. |
double |
getMinY()
Get the minimum y coordinate in this environment. |
Segment |
getSegment(int index)
Get a Segment. |
double |
getWidth()
Get the width of this environment. |
boolean |
isEmpty()
Check if there are no Segments in this envrionment. |
protected void |
makeDefaultEnvironment(double exclude)
Makes a default environment to model the window in Stata 34-376. |
void |
moveSegment(int index,
double startX,
double startY,
double endX,
double endY)
Move the Segment at index. |
int |
numSegments()
Get the number of Segments in this Environment. |
int |
pick(Point p,
double threshold)
Covers pick(Point, double, Point.OnSegment), does not collect
nearest point. |
int |
pick(Point p,
double threshold,
Point.OnSegment nearest)
Covers pick(Point, double, Point.OnSegment, Vector), does not
collect all points within threshold. |
int |
pick(Point p,
double threshold,
Point.OnSegment nearest,
java.util.Vector all)
Find one or more Point.OnSegments in this Environment closer
than threshold to p. |
void |
recomputeBounds()
Recompute the bounds of this Environment iff not lockBounds. |
Segment |
removeLastSegment()
Remove the segment with the highest index. |
boolean |
removeListener(EnvironmentListener l)
Remove an EnvironmentListener. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.lang.String cvsid
CVS id.
public static final int DEFAULT_NUM_PANE_COLUMNS
The number of pane columns in Stata 34-376.
public static final double DEFAULT_BAR_WIDTH
The bar width, in meters, in Stata 34-376.
public static final double DEFAULT_COLUMN_WIDTH
The pane column width, bar center to bar center, in meters, in Stata 34-376.
public static final double DEFAULT_UPPER_ROW_HEIGHT
The upper pane row height, midbar center to ceiling, in meters, in Stata 34-376.
public static final double DEFAULT_MIN_LOWER_ROW_HEIGHT
The min lower pane row height, midbar center to lower bar top, in meters, in Stata 34-376.
public static final double DEFAULT_MAX_LOWER_ROW_HEIGHT
The max lower pane row height, midbar center to lower bar top, in meters, in Stata 34-376.
protected java.util.Vector segments
The Segments in this Environment.
protected java.util.Vector listeners
The currently registered EnvironmentListeners.
protected boolean boundsDirty
Whether we need to recomputeBounds().
protected double minX
The minimum x coordinate in this environment, 0.0 if isEmpty().
protected double minY
The minimum y coordinate in this environment, 0.0 if isEmpty().
protected double maxX
The maximum x coordinate in this environment, 0.0 if isEmpty().
protected double maxY
The maximum y coordinate in this environment, 0.0 if isEmpty().
protected double width
The width of this environment, 0.0 if isEmpty().
protected double height
The height of this environment, 0.0 if isEmpty().
protected double centerX
The center x coord in this environment, 0.0 if isEmpty().
protected double centerY
The center y coord in this environment, 0.0 if isEmpty().
public boolean lockBounds
Whether to lock the bounds variables at their current values.
| Constructor Detail |
|---|
public Environment()
Covers Environment(double), uses a default
exclude.
public Environment(double exclude)
Makes a default environment that models the window in Stata 34-376.
exclude - see makeDefaultEnvironment(double)public Environment(Segment[] segment)
Make a new Environment.
segment - the set of Segments, not null, a copy is made| Method Detail |
|---|
public void recomputeBounds()
Recompute the bounds of this Environment iff not lockBounds.
public boolean isEmpty()
Check if there are no Segments in this envrionment.
public int numSegments()
Get the number of Segments in this Environment.
public Segment getSegment(int index)
Get a Segment.
index - the 0-based index of the segment in the range [0, numSegments())
public java.util.Enumeration enumerateSegments()
Get an Enumeration over the segments.
public double getMinX()
Get the minimum x coordinate in this environment.
isEmpty()public double getMinY()
Get the minimum y coordinate in this environment.
isEmpty()public double getMaxX()
Get the maximum x coordinate in this environment.
isEmpty()public double getMaxY()
Get the maximum y coordinate in this environment.
isEmpty()public double getWidth()
Get the width of this environment.
isEmpty()public double getHeight()
Get the height of this environment.
isEmpty()public double getCenterX()
Get center x coord in this environment.
isEmpty()public double getCenterY()
Get center y coord in this environment.
isEmpty()
public int pick(Point p,
double threshold,
Point.OnSegment nearest,
java.util.Vector all)
Find one or more Point.OnSegments in this Environment closer
than threshold to p.
p - the pick pointthreshold - the distance threshold in meters, negative for no
thresholdnearest - if non-null the nearest point closer than
threshold will be written here on return. If non-null and no
points are within range, the segment of this Point.OnSegment will be null
on return.all - if non-null then all points closer than threshold
are collected here
threshold or negative if none
public int pick(Point p,
double threshold,
Point.OnSegment nearest)
Covers pick(Point, double, Point.OnSegment, Vector), does not
collect all points within threshold.
public int pick(Point p,
double threshold)
Covers pick(Point, double, Point.OnSegment), does not collect
nearest point.
public void clearSegments()
Remove all segments from this Environment.
A EnvironmentListener.environmentChanged(shady.common.Environment) event will be fired to
all registered listeners.
public Segment removeLastSegment()
Remove the segment with the highest index.
A EnvironmentListener.environmentChanged(shady.common.Environment) event will be fired to
all registered listeners.
public int addSegment(double startX,
double startY,
double endX,
double endY)
Add a new segment at the end of the list.
A EnvironmentListener.environmentChanged(shady.common.Environment) event will be fired to
all registered listeners.
startX - the start X coord of the segment in metersstartY - the start Y coord of the segment in metersendX - the end X coord of the segment in metersendY - the end Y coord of the segment in meters
public void moveSegment(int index,
double startX,
double startY,
double endX,
double endY)
Move the Segment at index.
A EnvironmentListener.environmentChanged(shady.common.Environment) event will be fired to
all registered listeners.
index - the zero-based index of the segment to movestartX - the new start X coord of the segment in metersstartY - the new start Y coord of the segment in metersendX - the new end X coord of the segment in metersendY - the new end Y coord of the segment in meterspublic void addListener(EnvironmentListener l)
Add an EnvironmentListener.
l - the listener to addpublic boolean removeListener(EnvironmentListener l)
Remove an EnvironmentListener.
l - the listener to remove
protected void fireEnvironmentChanged()
Fire an EnvironmentListener.environmentChanged(shady.common.Environment) to all our
listeners.
protected void makeDefaultEnvironment(double exclude)
Makes a default environment to model the window in Stata 34-376.
Metrics are taken from the various DEFAULT_ constants.
exclude - the amount to exclude, in meters, at the end of segments
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||