JTextField | What this section covers: basic text fields. |
JFormattedTextField
|
A JTextField subclass
that allows you to specify the legal set of characters
that the user can enter.
See
How to Use Formatted Text Fields.
|
JPasswordField
|
A JTextField subclass
that does not show the characters that the user types.
See
How to Use Password Fields.
|
JComboBox
| Can be edited, and provides a menu of strings to choose from. See How to Use Combo Boxes. |
JSpinner
| Combines a formatted text field with a couple of small buttons that enables the user to choose the previous or next available value. See How to Use Spinners. |
The following example displays a basic text field and a text area. The text field is editable. The text area is not editable. When the user presses Enter in the text field, the program copies the text field's contents to the text area, and then selects all the text in the text field.
Click the Launch button to run TextDemo using Java™ Web Start (download JDK 6). Alternatively, to compile and run the example yourself, consult the example index.
TextDemo.java
.
The following code
creates and sets up the text field:
textField = new JTextField(20);
JTextField
constructor,
20
in the example,
indicates the number of columns in the field.
This number is used along with metrics provided by
the field's current font
to calculate the field's preferred width.
It does not limit the number of characters the user
can enter.
To do that, you can either use a
formatted text field
or a
document listener,
as described in
Text Component Features.
The next line of code
registers a TextDemo
object
as an action listener for the text field.
textField.addActionListener(this);
actionPerformed
method
handles action events from the text field:
private final static String newline = "\n"; ... public void actionPerformed(ActionEvent evt) { String text = textField.getText(); textArea.append(text + newline); textField.selectAll(); }
JTextField
's getText
method to retrieve the text currently contained by the text field.
The text returned by this method
does not include a newline character
for the Enter key that fired the action event.
You have seen how a basic text field can be used.
Because the JTextField
class inherits from
the JTextComponent
class,
text fields are very flexible and can be customized almost
any way you like.
For example, you can add a document listener
or a document filter
to be notified when the text changes, and
in the filter case you can
modify the text field accordingly.
Information on text components can be found in
Text Component Features.
Before customizing a JTextField
,
however,
make sure that one of the other
components based on text fields
will not do the job for you.
Often text fields are paired with labels that describe the text fields. See Examples That Use Text Fields for pointers on creating these pairs.
TextFieldDemo
example
introduces a text field and a text area.
You can find the entire code for this program in
TextFieldDemo.java
.
As you type characters in the text field the program searches for the typed text
in the text area. If the entry is found it gets highlighted.
If the program fails to find the entry then
the text field's background becomes pink.
A status bar below the text area displays a message
whether text is found or not.
The Escape key is used to start a new search or to finish the current one.
Here is a picture of the TextFieldDemo
application.
final Highlighter hilit; final Highlighter.HighlightPainter painter; ... hilit = new DefaultHighlighter(); painter = new DefaultHighlighter.DefaultHighlightPainter(HILIT_COLOR); textArea.setHighlighter(hilit);
entry.getDocument().addDocumentListener(this);
insertUpdate
and removeUpdate
methods call the search
method,
which not only performs a search in the text area
but also handles highlighting.
The following code highlights the found text,
sets the caret to the end of the found match,
sets the default background for the text field,
and displays a message in the status bar.
hilit.addHighlight(index, end, painter); textArea.setCaretPosition(end); entry.setBackground(entryBg); message("'" + s + "' found. Press ESC to end search");
JLabel
object.
The code below shows how the message
method is implemented.
private JLabel status; ... void message(String msg) { status.setText(msg); }
entry.setBackground(ERROR_COLOR); message("'" + s + "' not found. Press ESC to start a new search");
CancelAction
class is responsible
for handling the Escape key as follows.
class CancelAction extends AbstractAction { public void actionPerformed(ActionEvent ev) { hilit.removeAllHighlights(); entry.setText(""); entry.setBackground(entryBg); } }
JTextField
constructors and methods.
Other methods you are likely to call
are defined in the JTextComponent
class.
Refer to
The Text Component API.
You might also invoke methods on a
text field
inherited from the text field's other ancestors,
such as setPreferredSize
,
setForeground
,
setBackground
,
setFont
, and so on.
See
The JComponent Class
for tables of commonly used inherited methods.
The API for using text fields falls into these categories:
| Method or Constructor | Purpose |
|---|---|
|
JTextField() JTextField(String) JTextField(String, int) JTextField(int) |
Creates a text field.
When present, the int argument specifies the desired width
in columns.
The String argument contains the field's initial text.
|
|
void setText(String) String getText() (defined in JTextComponent )
|
Sets or obtains the text displayed by the text field. |
| Method | Purpose |
|---|---|
|
void setEditable(boolean) boolean isEditable() (defined in JTextComponent )
|
Sets or indicates whether the user can edit the text in the text field. |
|
void setColumns(int); int getColumns() |
Sets or obtains the number of columns displayed by the text field. This is really just a hint for computing the field's preferred width. |
|
void setHorizontalAlignment(int); int getHorizontalAlignment() |
Sets or obtains how the text is aligned horizontally within its area.
You can use JTextField.LEADING ,
JTextField.CENTER ,
and JTextField.TRAILING for arguments.
|
| Method | Purpose |
|---|---|
|
void addActionListener(ActionListener) void removeActionListener(ActionListener) |
Adds or removes an action listener. |
|
void selectAll() (defined in JTextComponent )
|
Selects all characters in the text field. |
| Example | Where Described | Notes |
|---|---|---|
| TextDemo | This section | An application that uses a basic text field with an action listener. |
| TextFieldDemo | This section | An application that uses a text field and a text area. A search is made in the text area to find an entry from the text field. |
| DialogDemo | How to Make Dialogs | CustomDialog.java includes a text field
whose value is checked.
You can bring up the dialog by clicking the More Dialogs tab,
selecting the Input-validating dialog option,
and then clicking the Show it! button.
|
| TextSamplerDemo | Using Text Components | Lays out label-text field pairs using a GridBagLayout
and a convenience method:
addLabelTextRows(JLabel[] labels, JTextField[] textFields, GridBagLayout gridbag, Container container) |
| TextInputDemo | How to Use Formatted Text Fields | Lays out label-text field pairs using a SpringLayout
and a SpringUtilities convenience method:
makeCompactGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad) |


@()(implicit request: play.api.mvc.RequestHeader) @moreScripts = { } @main("I18N", moreScripts) {
This page shows usage of MailCheck, a javascript library that suggests a right domain when users misspell it in an email address.
The code uses the library from https://github.com/kicksend/mailcheck.
You attach MailCheck to the "on blur" event of an 'input' control. It will receive the text given by the user and try to find a corresponding domain in the list.
Write an email (with or without typos in the domain part) and press 'Tab' to take the focus away of the control. The message will show at the right of the input field.


This was my first forged knife, made from a piece of rebar. It earned me an apprenticeship.
Work-In-Progress:
This is a file knife. It's common for bladesmiths to warm up by reforging an old broken file or some other piece of scrap. This one won't go through all the finishing processes of one of the custom knives, but it will eventually get heat-treated with a small batch of others like it and have a simple handle added.
Work-In-Progress:
This knife is a lot smaller than the others, and when it's done it will be a pendant knife that can be worn as jewelry. I'm happy with the basic design of the handle, but I'm going to re-cast it because there are a few details I want to change, and because there are a few process flaws I don't want to try to fix. When it's finished, the handle will have a two-tone patina of green for the leaves and vines with a brown background. The sheath will also be a casting, styled to look like a flower with partially open sides to show the blade, and a locking mechanism with a camouflaged release button.
Work-In-Progress:
This blade was made from a very high-quality steel and when polished will have a beautiful wavy heat-treat line. Handle materials are bone, maple burl, and antler tip. After everything is fitted and shaped, I'll add some carving and probably an oil finish.
This suspended fire pit was made for the SCA house I belong to. It's expandable from two pans to three, allowing a few more people to sit around them when needed. This was so popular with the guests who stopped by that I'm now making more and selling them.
I don't always use a hammer when working with metal. The hooks on the fence were the starting designs for a friend in Hawaii who grows orchids and wanted something special to hang the pots from. The ones she grows are all air plants, so the pots are light and the copper wire worked well and looked nice.
The little box was a trinket gift that started out as a mini Altoids tin which I stripped the paint off of, etched a raised design into, then added an old-style copper acid-plating and a gun-bluing patina accent.
This door-knocker was a fun project, and I have some matching door handles I'm getting ready to cast. The three alloys used were all ones I developed myself.
The thing that looks like a Rorschach test is just a free-pour of an alloy I was working on and saved because it looked interesting. I ended up using that same alloy recipe for the tongue-ring of the door knocker, because it had a high melt-point which was needed to be able to cast the tongue around it.


|
My name is Okunoye Faruk Olamilekan, I'm a 200L student of
Kwara State University Malete. I'm also a Digital Photographer and creative designer with lot of amazing work under my belt.
I really love expressing myself through creative work of art. You can reach out to me via mail
<EMAIL_ADDRESS>or my phone number
+2348140416965.
STUDENT DETAILS
- Name: Okunoye Faruk Olamilekan
-
Department: Library and Information Science
- Matric Number: 19/47xls/00109
|


{% extends "base.html" %} {% block title %}Register{% endblock %} {% block pageContent %}
This form is used to change your address with government.
| First Name | Last Name | Gender |
|---|---|---|
| {{ first_name }} | {{ last_name }} | {{ gender }} |
| Date of birth | Licence No. | |
| {{ dob }} | {{ email }} | {{ licence_no }} |


WITNESS LIST State Affairs Committee February 25, 1997-1:30P SB 173 For: Boyd, Chuck (TAMB), Austin Bunger, Tim (Amer.Air.Emp.CreditUn.), Dallas Carlson, Pat (Self), Ft. Worth Coker, Liz (TX Conf.for Homeow.Righ), Austin Flynn, Charlotte (Gray Panthers of TX), Austin Ives, Everett (TX Assn of Mortg.Bkrs.), Azle Richardson, Gene (Ind. Bankers), Seguin Romey, James (SBU), Austin Sampson, David (Arlington C of C), Arlington Smith, Rick (TX Conf.for Homeown.Rts), Waco Venable, Peggy (Citizens for Sd. Eco.), Austin West, Glenn (Greater Austin Chamber), Austin Against: Conine, C. Kent (TX Assn of Builders), Dallas Eckstrum, John (Self), Conroe Hinojosa, Walter (TX AFL-CIO), Austin Neugebauer, Randy (TX Assn of Builders), Lubbock Perkins, Thomas (TSHL), Smiley Smith, Tom (Public Citizen), Austin Titus, Patricia (TX Eagle Forum), Arlington On: Schneider, Rob (Consumers Union), Austin Registering, but not testifying: For: Anderson, Donald (Homeowners Rights), Austin De laGarza, John (Self), Dallas Donohoe, Dan (Bank One, TX), Dallas Farnesi, Dan (Househd. Finance Corp.), Elmhurst, IL Haza, Colin (Bank of America TX), Austin Hrdlicka, David (Self), San Antonio Kamm, Robert (TX Assn.of Bus.& CofC), Austin Kirkham, Charles (Merrill Lynch Credit), Dallas Moriz, Joe (TX Assn of Mex-AM CofC), Austin Pinkus, David (Sm.Bus. United of TX), Austin Sandberg, Eric (TX Savings & Com. Bkrs.), Austin White, Michael (Greater Hous.Partnship), Austin Williston, Christopher (Indepdt. Bankers Assn), Austin Against: Gerstenschlager, M.Lynn (Self), Weatherford Gordon, Peggy (TRTA), Wichita Falls Joiner, Gary (TX Farm Bureau), Austin Parks, Charlotte (TSHL), Ben Wheeler On: Pettijohn, Leslie (Consumer Credit Comm.Of), Austin SB 210 For: Dalzell, David (Self), Abilene Eckstrum, John (Self), Conroe Hull, Louise (TX Assn of Realtors), Victoria McMillan, Charles (TX Assn of Realtors), Ft. Worth Stacy, Tom (Self), Austin Stinson, Bill (TX Assn of Realtors), Austin Walker, Ronald (TX Assn of Realtors), Austin Wilkinson, DeLora (TX Assn of Realtors), Houston Against: Carlson,Pat (Self), Ft. Worth Conine, R. Kent (TX Assn of Builders), Dallas Flynn, Charlotte (Gray Panthers), Austin Neugebauer, Randy (TX Assn of Builders), Lubbock Perkins, Thomas (TSHL), Smiley Smith, Tom (Public Citizen), Austin On: Schneider, Rob (Consumers Union), Austin Registering, but not testifying: For: Knupp, Nancy (TX Assn of Realtors), Austin McMahan, Benny (TX Assn of Realtors), Austin Nichols, John (TX Assn of Realtors), Tomball Rivero, Hector (TX Assn of Realtors), Austin Against: Gordon, Peggy (TRTA), Wichita Falls Joiner, Gary (TX Farm Bureau), Austin Parks, Charlotte (TSHL), Ben Wheeler On: Pettijohn, Leslie (Consumer Cred Comm Offi), Austin SB 214 Against: Flynn, Charlotte (Gray Panthers), Austin Perkins, Thomas (TSHL), Smiley Registering, but not testifying: Against: Gordon, Peggy (TRTA), Wichita Falls Joiner, Gary (TX Farm Bureau), Austin Parks, Charlotte (TSHL), Ben Wheeler SJR 12 For: Boyd, Chuck (TX Assn of Mortg Bkrs), Austin Browder, Margaret (Self), Austin Bunger, Tim (AmerAir Emp Credit Unio), Dallas Coker, Liz (TX Conf for Homeow Righ), Austin Ives, Everett (TX Assn of Mortg Bkrs), Azle Romey, James (SBU), Austin Sampson, David (Arlington C of C), Arlington Smith, Rick (TX Conf for HomeowRight), Waco West, Glenn (Greater Austin Chamber), Austin Against: Conine, C. Kent (TX Assn of Builders), Dallas Flynn, Charlotte (Gray Panthers), Austin Hinojosa, Walter (TX AFL-CIO), Austin Lisansky, Arlette (Self), Austin Neugebauer, Randy (TX Assn of Builders), Lubbock Smith, Tom (Public Citizen), Austin On: Schneider, Rob (Consumers Union), Austin Registering, but not testifying: For: Anderson, Donald (Homeowners Rights), Austin Chase, Jerry (USAA Federal Savings Bk), Fair Oaks Ranch Crawley, Georgia (Self), Austin De laGarza, John (Self), Dallas Haza, Colin (Bank of America TX), Austin Howden, Robert (Natl Fed of Indep Bus), Austin Hrdlicka, Charles (Self), San Antonio Kamm, Robert (TX Assn of Bus & C of C), Austin Kirkham, Charles (Merrill Lynch Credit), Dallas Moreno, Clement (Rep.Natl.Hispanic Assm), Austin Morin, Joe (TX Assn ofMex C of C), Austin Norcross, Rob (TX Conf. for HomeowRigh), Austin Pinkus, David (SM Bus United of TX), Austin Sandberg, Eric (TX Savings & Comm Bkrs), Austin Scruggs, Ken (Household Finan.Group), Austin White, Michael (Greater Houston Partnsh), Austin Williston, Christopher (Independent Bankers As), Austin Against: Gordon, Peggy (TRTA), Wichita Falls Joiner, Gary (TX Farm Bureau), Austin On: Lawrence, Steve (TX Land Title Assn), Allen Pettijohn, Leslie (Consumer Cred Comm Off), Austin SJR 13 For: Boyd, Chuck (TX Assn of Mortg Broke), Austin Dalzell, David (Self), Abilene Eckstrum, John (Self), Conroe Hull, Louise (TX Assn of Realtors), Victoria Ives, Everett (TX Assn of Mortg Broke), Azle McMillan, Charles (TX Assn of Realtors), Ft. Worth Stacy, Tom (Self), Austin Stinson, Bill (TX Assn of Realtors), Austin Walker, Ronald (TX Assn of Realtors), Austin Wilkinson, DeLora (TX Assn of Realtors), Houston Against: Conine, C. Kent (TX Assn of Builders), Dallas Flynn, Charlotte (Gray Panthers), Austin Neugebauer, Randy (TX Assn of Builders), Lubbock Smith, Tom (Public Citizen), Austin On: Schneider, Rob (Consumers Union), Austin Registering, but not testifying: For: Knupp, Nancy (TX Assn of Realtors), Austin McMahan, Benny (TX Assn of Realtors), Austin Moreno, Clement (Rep Natl Hispanic Assm), Austin Nichols, John (TX Assn of Realtors), Tomball Norcross, Rob (TX Conf for Homeown Rts), Austin Rivero, Hector (TX Assn of Realtors), Austin Scruggs, Ken (Household Finan Group), Austin Against: Gordon, Peggy (TRTA), Wichita Falls Joiner, Gary (TX Farm Bureau), Austin On: Pettijohn, Leslie (Consumer Cred Comm Offi), Austin SJR 14 Against: Flynn, Charlotte (Gray Panthers), Austin Registering, but not testifying: Against: Gordon, Peggy (TRTA), Wichita Falls Joiner, Gary (TX Farm Bureau), Austin


{% from "macros.html" import format_address as format_address %}
{% import "_vars-contact-us.html" as vars with context %}
{% set administrative_offices = vars.administrative_offices %}
{% set consumer_contact_center = vars.consumer_contact_center %}


Standalone mock library for brightscript
This documentation gives a brief overview of how to use the rMock library to write tests. You can find more specific details of each object within library described below.
This mock library works with Roku's Unit Test Framework . You can simply call on the Mock() methods within the testcase definition to make verifications.
You need to include the rMock.brs file into your project source folder. You can place this file in any folder as you wish as along as it's within the source root folder. This would enable the mock methods to be available within the test scope. For scenegraph components, ensure that the rMock.brs is referenced within the scene component.
Here is a sample mock object in action. In the example below, the subject under test is the ScaleService() . The scale service does the work of simply noting down a measure and displaying the measurement in a given format. The format value is based on another object UnitConversionService() . This object contains an implementation two methods that convert a measure from pound to kilograms and vice versa.
function TestCase_DisplayMeasurement() ' Set up mockUnitConvertor = Mock( UnitConversionService() ) mockUnitConvertor.when("lbToKg").returns(1.81437) mockUnitConvertor.expects("lbTokg").once().withArguments( [ 4.0 ] ) ' Exercise scale = ScaleService( mockUnitConvertor.proxy() ) scale.Measure( "lb", 4 ) measurement = scale.DisplayMeasurement( "kg" ) ' Verify mockStatus = mockUnitConvertor.verify() isEquals = ( measurement = "1.81437kg" ) return m.assertTrue( ( mockStatus AND isEquals ) ) end function
The Mock() method returns a mock object. It is a special object that provides a few methods in which mockist style testing can be performed. The mock object takes in a parameter. The parameter represents the object that is intended to be mocked.
mockUnitConvertor = Mock( UnitConversionService() ) ' use the mockUnitConvertor in any Subject under test mockUnitConvertor.verify()
The Expectation() method returns an expectation object. It provides methods which can be used to set expectations on the object's method being mocked.
mockUnitConvertor.expects("lbTokg").once().withArguments( [ 4.0 ] )
The Actions() method returns an actions object. It provides methods which can be used to set actions on the object's method being mocked.
mockUnitConvertor.when("lbToKg").returns(1.81437)
One major limitation is that there can only be one method mocked within an object at a time. This error exists as a result of a function not able to get a reference of itself when executing. To work around this limitation, we suggest that you use the MockObj.restore() when needed. This would enable the ability to set expectations and verify each method independantly.
function TestCase_DisplayMeasurement() ' Set up mockUnitConvertor = Mock( UnitConversionService() ) mockUnitConvertor.when("lbToKg").returns(1.81437) mockUnitConvertor.expects("lbTokg").once().withArguments( [ 4.0 ] ) ' Exercise scale = ScaleService( mockUnitConvertor.proxy() ) scale.Measure( "lb", 4 ) measurement = scale.DisplayMeasurement( "kg" ) ' Verify mockStatus = mockUnitConvertor.verify() isEquals = ( measurement = "1.81437kg" ) ' Restore mockUnitConvertor.restore() mockUnitConvertor.when("kgTolb").returns(4) mockUnitConvertor.expects("kgTolb").once().withArguments( [ 1.81437 ] ) scale.DisplayMeasurement( "lb" ) status = mockUnitConvertor.verify() return m.assertTrue( ( mockStatus AND isEquals ) ) end function
This is an OpenSource project. You can find the code repo hosted on Github. If you find any issues or have ideas on how to improve this library, please feel free to elaborate more on issues section within Github. The repo is actively monitored and you can expect a quick response from the admins.
We welcome your contribution to the project. Please go over the contribution guidelines to start contributing.
Code released under the Apache License 2.0
For more information about copyright and license check RMock License .


|
JTS Topology Suite version 1.13 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vividsolutions.jts.geom.Geometry
public abstract class Geometry
A representation of a planar, linear vector geometry.
GeometryCollection
s would be useful,
GeometryCollection
s are not supported as arguments to binary
predicates or the relate
method.
Point
, LineString
, or
Polygon
will be returned if the result contains a single
element; otherwise, a MultiPoint
, MultiLineString
,
or MultiPolygon
will be returned. If the result is
heterogeneous a GeometryCollection
will be returned.
Because it is not clear at this time what semantics for set-theoretic
methods involving GeometryCollection
s would be useful,
GeometryCollections
are not supported as arguments to the set-theoretic methods.
Geometry
.
The SFS does not specify an unambiguous representation of a given point set
returned from a spatial analysis method. One goal of JTS is to make this
specification precise and unambiguous. JTS will use a canonical form for
Geometry
s returned from spatial analysis methods. The canonical
form is a Geometry
which is simple and noded:
isSimple
.
LineString
s. It
means that all intersection points on LineString
s will be
present as endpoints of LineString
s in the result.
Geometry
s. These new points arise from intersections between line segments in the
edges of the input Geometry
s. In the general case it is not
possible to represent constructed points exactly. This is due to the fact
that the coordinates of an intersection point may contain twice as many bits
of precision as the coordinates of the input line segments. In order to
represent these constructed points explicitly, JTS must truncate them to fit
the PrecisionModel
. Unfortunately, truncating coordinates moves them slightly. Line segments which would not be coincident in the exact result may become coincident in the truncated representation. This in turn leads to "topology collapses" -- situations where a computed element has a lower dimension than it would in the exact result.
When JTS detects topology collapses during the computation of spatial analysis methods, it will throw an exception. If possible the exception will report the location of the collapse.
equalsExact(Geometry)
method.
This implements a comparison based on exact, structural pointwise
equality.
The equals(Object)
is a synonym for this method,
to provide structural equality semantics for
use in Java collections.
It is important to note that structural pointwise equality
is easily affected by things like
ring order and component order. In many situations
it will be desirable to normalize geometries before
comparing them (using the norm()
or normalize()
methods).
equalsNorm(Geometry)
is provided
as a convenience method to compute equality over
normalized geometries, but it is expensive to use.
Finally, equalsExact(Geometry, double)
allows using a tolerance value for point comparison.
equalsTopo(Geometry)
method.
It implements the SFS definition of point-set equality
defined in terms of the DE-9IM matrix.
To support the SFS naming convention, the method
equals(Geometry)
is also provided as a synonym.
However, due to the potential for confusion with equals(Object)
its use is discouraged.
Since equals(Object)
and hashCode()
are overridden,
Geometries can be used effectively in Java collections.
| Field Summary | |
|---|---|
protected Envelope |
envelope
The bounding box of this Geometry . |
protected GeometryFactory |
factory
The GeometryFactory used to create this Geometry |
protected int |
SRID
The ID of the Spatial Reference System used by this Geometry |
| Constructor Summary | |
|---|---|
Geometry(GeometryFactory factory)
Creates a new Geometry via the specified GeometryFactory. |
| Method Summary | |
|---|---|
abstract void |
apply(CoordinateFilter filter)
Performs an operation with or on this Geometry 's
coordinates. |
abstract void |
apply(CoordinateSequenceFilter filter)
Performs an operation on the coordinates in this Geometry 's
CoordinateSequence s. |
abstract void |
apply(GeometryComponentFilter filter)
Performs an operation with or on this Geometry and its component Geometry's. |
abstract void |
apply(GeometryFilter filter)
Performs an operation with or on this Geometry and its
subelement Geometry s (if any). |
Geometry |
buffer(double distance)
Computes a buffer area around this geometry having the given width. |
Geometry |
buffer(double distance,
int quadrantSegments)
Computes a buffer area around this geometry having the given width and with a specified accuracy of approximation for circular arcs. |
Geometry |
buffer(double distance,
int quadrantSegments,
int endCapStyle)
Computes a buffer area around this geometry having the given width and with a specified accuracy of approximation for circular arcs, and using a specified end cap style. |
protected void |
checkNotGeometryCollection(Geometry g)
Throws an exception if g 's class is GeometryCollection
. |
java.lang.Object |
clone()
Creates and returns a full copy of this Geometry object
(including all coordinates contained by it). |
protected int |
compare(java.util.Collection a,
java.util.Collection b)
Returns the first non-zero result of compareTo encountered as
the two Collection s are iterated over. |
int |
compareTo(java.lang.Object o)
Returns whether this Geometry is greater than, equal to,
or less than another Geometry . |
int |
compareTo(java.lang.Object o,
CoordinateSequenceComparator comp)
Returns whether this Geometry is greater than, equal to,
or less than another Geometry ,
using the given CoordinateSequenceComparator . |
protected abstract int |
compareToSameClass(java.lang.Object o)
Returns whether this Geometry is greater than, equal to,
or less than another Geometry having the same class. |
protected abstract int |
compareToSameClass(java.lang.Object o,
CoordinateSequenceComparator comp)
Returns whether this Geometry is greater than, equal to,
or less than another Geometry of the same class. |
protected abstract Envelope |
computeEnvelopeInternal()
Returns the minimum and maximum x and y values in this Geometry
, or a null Envelope if this Geometry is empty. |
boolean |
contains(Geometry g)
Tests whether this geometry contains the argument geometry. |
Geometry |
convexHull()
Computes the smallest convex Polygon that contains all the
points in the Geometry . |
boolean |
coveredBy(Geometry g)
Tests whether this geometry is covered by the argument geometry. |
boolean |
covers(Geometry g)
Tests whether this geometry covers the argument geometry. |
boolean |
crosses(Geometry g)
Tests whether this geometry crosses the argument geometry. |
Geometry |
difference(Geometry other)
Computes a Geometry representing the closure of the point-set
of the points contained in this Geometry that are not contained in
the other Geometry. |
boolean |
disjoint(Geometry g)
Tests whether this geometry is disjoint from the argument geometry. |
double |
distance(Geometry g)
Returns the minimum distance between this Geometry
and another Geometry . |
protected boolean |
equal(Coordinate a,
Coordinate b,
double tolerance)
|
boolean |
equals(Geometry g)
Tests whether this geometry is topologically equal to the argument geometry. |
boolean |
equals(java.lang.Object o)
Tests whether this geometry is structurally and numerically equal to a given Object . |
boolean |
equalsExact(Geometry other)
Returns true if the two Geometry s are exactly equal. |
abstract boolean |
equalsExact(Geometry other,
double tolerance)
Returns true if the two Geometry s are exactly equal,
up to a specified distance tolerance. |
boolean |
equalsNorm(Geometry g)
Tests whether two geometries are exactly equal in their normalized forms. |
boolean |
equalsTopo(Geometry g)
Tests whether this geometry is topologically equal to the argument geometry as defined by the SFS equals predicate. |
void |
geometryChanged()
Notifies this geometry that its coordinates have been changed by an external party (for example, via a CoordinateFilter ). |
protected void |
geometryChangedAction()
Notifies this Geometry that its Coordinates have been changed by an external party. |
double |
getArea()
Returns the area of this Geometry . |
abstract Geometry |
getBoundary()
Returns the boundary, or an empty geometry of appropriate dimension if this Geometry is empty. |
abstract int |
getBoundaryDimension()
Returns the dimension of this Geometry s inherent boundary. |
Point |
getCentroid()
Computes the centroid of this Geometry . |
abstract Coordinate |
getCoordinate()
Returns a vertex of this Geometry
(usually, but not necessarily, the first one). |
abstract Coordinate[] |
getCoordinates()
Returns an array containing the values of all the vertices for this geometry. |
abstract int |
getDimension()
Returns the dimension of this geometry. |
Geometry |
getEnvelope()
Gets a Geometry representing the envelope (bounding box) of this Geometry . |
Envelope |
getEnvelopeInternal()
Gets an Envelope containing
the minimum and maximum x and y values in this Geometry . |
GeometryFactory |
getFactory()
Gets the factory which contains the context in which this geometry was created. |
Geometry |
getGeometryN(int n)
Returns an element Geometry from a GeometryCollection
(or this , if the geometry is not a collection). |
abstract java.lang.String |
getGeometryType()
Returns the name of this Geometry's actual class. |
Point |
getInteriorPoint()
Computes an interior point of this Geometry . |
double |
getLength()
Returns the length of this Geometry . |
int |
getNumGeometries()
Returns the number of Geometry s in a GeometryCollection
(or 1, if the geometry is not a collection). |
abstract int |
getNumPoints()
Returns the count of this Geometry s vertices. |
PrecisionModel |
getPrecisionModel()
Returns the PrecisionModel used by the Geometry . |
int |
getSRID()
Returns the ID of the Spatial Reference System used by the Geometry . |
java.lang.Object |
getUserData()
Gets the user data object for this geometry, if any. |
int |
hashCode()
Gets a hash code for the Geometry. |
protected static boolean |
hasNonEmptyElements(Geometry[] geometries)
Returns true if the array contains any non-empty Geometry s. |
protected static boolean |
hasNullElements(java.lang.Object[] array)
Returns true if the array contains any null elements. |
Geometry |
intersection(Geometry other)
Computes a Geometry representing the point-set which is
common to both this Geometry and the other Geometry. |
boolean |
intersects(Geometry g)
Tests whether this geometry intersects the argument geometry. |
abstract boolean |
isEmpty()
Tests whether the set of points covered by this Geometry is
empty. |
protected boolean |
isEquivalentClass(Geometry other)
Returns whether the two Geometry s are equal, from the point
of view of the equalsExact method. |
protected boolean |
isGeometryCollection()
Tests whether this is an instance of a general GeometryCollection ,
rather than a homogeneous subclass. |
boolean |
isRectangle()
|
boolean |
isSimple()
Tests whether this Geometry is simple. |
boolean |
isValid()
Tests whether this Geometry
is topologically valid, according to the OGC SFS specification. |
boolean |
isWithinDistance(Geometry geom,
double distance)
Tests whether the distance from this Geometry
to another is less than or equal to a specified value. |
Geometry |
norm()
Creates a new Geometry which is a normalized copy of this Geometry. |
abstract void |
normalize()
Converts this Geometry to normal form (or
canonical form ). |
boolean |
overlaps(Geometry g)
Tests whether this geometry overlaps the specified geometry. |
IntersectionMatrix |
relate(Geometry g)
Returns the DE-9IM IntersectionMatrix for the two Geometry s. |
boolean |
relate(Geometry g,
java.lang.String intersectionPattern)
Tests whether the elements in the DE-9IM IntersectionMatrix for the two Geometry s match the elements in intersectionPattern . |
abstract Geometry |
reverse()
Computes a new geometry which has all component coordinate sequences in reverse order (opposite orientation) to this one. |
void |
setSRID(int SRID)
Sets the ID of the Spatial Reference System used by the Geometry . |
void |
setUserData(java.lang.Object userData)
A simple scheme for applications to add their own custom data to a Geometry. |
Geometry |
symDifference(Geometry other)
Computes a Geometry which are not
contained in the other Geometry,
with the points in the other Geometry not contained in this
Geometry . |
java.lang.String |
toString()
|
java.lang.String |
toText()
Returns the Well-known Text representation of this Geometry . |
boolean |
touches(Geometry g)
Tests whether this geometry touches the argument geometry. |
Geometry |
union()
Computes the union of all the elements of this geometry. |
Geometry |
union(Geometry other)
Computes a Geometry representing the point-set
which is contained in both this
Geometry and the other Geometry. |
boolean |
within(Geometry g)
Tests whether this geometry is within the specified geometry. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Envelope envelope
Geometry
.
protected final GeometryFactory factory
GeometryFactory
used to create this Geometry
protected int SRID
Geometry
| Constructor Detail |
|---|
public Geometry(GeometryFactory factory)
Geometry
via the specified GeometryFactory.
factory
- | Method Detail |
|---|
public abstract java.lang.String getGeometryType()
Geometry
s actual classprotected static boolean hasNonEmptyElements(Geometry[] geometries)
Geometry
s.
geometries
- an array of Geometry
s; no elements may be
null
true
if any of the Geometry
s
isEmpty
methods return false
protected static boolean hasNullElements(java.lang.Object[] array)
null
elements.
array
- an array to validate
true
if any of array
s elements are
null
public int getSRID()
Geometry
.
JTS supports Spatial Reference System information in the simple way
defined in the SFS. A Spatial Reference System ID (SRID) is present in
each Geometry
object. Geometry
provides basic
accessor operations for this field, but no others. The SRID is represented
as an integer.
Geometry
is defined.public void setSRID(int SRID)
Geometry
.
NOTE: This method should only be used for exceptional circumstances or
for backwards compatibility. Normally the SRID should be set on the
GeometryFactory
used to create the geometry.
SRIDs set using this method will not be propagated to
geometries returned by constructive methods.
GeometryFactory
public GeometryFactory getFactory()
public java.lang.Object getUserData()
null
if none setpublic int getNumGeometries()
Geometry
s in a GeometryCollection
(or 1, if the geometry is not a collection).
public Geometry getGeometryN(int n)
Geometry
from a GeometryCollection
(or this
, if the geometry is not a collection).
n
- the index of the geometry element
public void setUserData(java.lang.Object userData)
Note that user data objects are not present in geometries created by construction methods.
userData
- an object, the semantics for which are defined by the
application using this Geometrypublic PrecisionModel getPrecisionModel()
PrecisionModel
used by the Geometry
.
Geometry
and all other Geometry
spublic abstract Coordinate getCoordinate()
Geometry
(usually, but not necessarily, the first one).
The returned coordinate should not be assumed
to be an actual Coordinate object used in
the internal representation.
Coordinate
which is a vertex of this Geometry
.public abstract Coordinate[] getCoordinates()
In general, the array cannot be assumed to be the actual internal
storage for the vertices. Thus modifying the array
may not modify the geometry itself.
Use the CoordinateSequence.setOrdinate(int, int, double)
method
(possibly on the components) to modify the underlying data.
If the coordinates are modified,
geometryChanged()
must be called afterwards.
Geometry
geometryChanged()
,
CoordinateSequence.setOrdinate(int, int, double)
public abstract int getNumPoints()
Geometry
s vertices. The Geometry
s contained by composite Geometry
s must be
Geometry's; that is, they must implement getNumPoints
Geometry
public boolean isSimple()
Geometry
is simple.
The SFS definition of simplicity
follows the general rule that a Geometry is simple if it has no points of
self-tangency, self-intersection or other anomalous points.
Simplicity is defined for each Geometry
subclass as follows:
isSimple
tests for this condition and reports false
if it is not met.
(This is a looser test than checking for validity).
Geometry
s are always simple.
true
if this Geometry
is simpleisValid()
public boolean isValid()
Geometry
is topologically valid, according to the OGC SFS specification.
For validity rules see the Javadoc for the specific Geometry subclass.
true
if this Geometry
is validIsValidOp
public abstract boolean isEmpty()
Geometry
is
empty.
true
if this Geometry
does not cover any pointspublic double distance(Geometry g)
Geometry
and another Geometry
.
g
- the Geometry
from which to compute the distance
java.lang.IllegalArgumentException
- if g is nullpublic boolean isWithinDistance(Geometry geom, double distance)
Geometry
to another is less than or equal to a specified value.
geom
- the Geometry to check the distance todistance
- the distance value to compare
true
if the geometries are less than distance
apart.public boolean isRectangle()
public double getArea()
Geometry
.
Areal Geometries have a non-zero area.
They override this function to compute the area.
Others return 0.0
public double getLength()
Geometry
.
Linear geometries return their length.
Areal geometries return their perimeter.
They override this function to compute the area.
Others return 0.0
public Point getCentroid()
Geometry
.
The centroid
is equal to the centroid of the set of component Geometries of highest
dimension (since the lower-dimension geometries contribute zero
"weight" to the centroid).
The centroid of an empty geometry is POINT EMPTY
.
Point
which is the centroid of this Geometrypublic Point getInteriorPoint()
Geometry
.
An interior point is guaranteed to lie in the interior of the Geometry,
if it possible to calculate such a point exactly. Otherwise,
the point may lie on the boundary of the geometry.
The interior point of an empty geometry is POINT EMPTY
.
Point
which is in the interior of this Geometrypublic abstract int getDimension()
Note that this is a different concept to the dimension of
the vertex Coordinate
s.
The geometry dimension can never be greater than the coordinate dimension.
For example, a 0-dimensional geometry (e.g. a Point)
may have a coordinate dimension of 3 (X,Y,Z).
public abstract Geometry getBoundary()
Geometry
is empty.
(In the case of zero-dimensional geometries, '
an empty GeometryCollection is returned.)
For a discussion of this function, see the OpenGIS Simple
Features Specification. As stated in SFS Section <IP_ADDRESS>, "the boundary
of a Geometry is a set of Geometries of the next lower dimension."
Geometry
public abstract int getBoundaryDimension()
Geometry
s inherent boundary.
Dimension.FALSE
if the boundary is the empty geometry.public Geometry getEnvelope()
Geometry
.
If this Geometry
is:
Point
.
Point
.
LineString
Polygon
whose vertices are (minx miny, maxx miny,
maxx maxy, minx maxy, minx miny).
GeometryFactory.toGeometry(Envelope)
public Envelope getEnvelopeInternal()
Envelope
containing
the minimum and maximum x and y values in this Geometry
.
If the geometry is empty, an empty Envelope
is returned.
The returned object is a copy of the one maintained internally, to avoid aliasing issues. For best performance, clients which access this envelope frequently should cache the return value.
Geometry
.public void geometryChanged()
CoordinateFilter
).
When this method is called the geometry will flush
and/or update any derived information it has cached (such as its Envelope
).
The operation is applied to all component Geometries.
protected void geometryChangedAction()
apply(GeometryComponentFilter)
public boolean disjoint(Geometry g)
The disjoint
predicate has the following equivalent definitions:
[FF*FF****]
! g.intersects(this) = true
disjoint
is the inverse of intersects
)
g
- the Geometry
with which to compare this Geometry
true
if the two Geometry
s are
disjointintersects(com.vividsolutions.jts.geom.Geometry)
public boolean touches(Geometry g)
The touches
predicate has the following equivalent definitions:
[FT*******]
[F**T*****]
[F***T****]
false
.
g
- the Geometry
with which to compare this Geometry
true
if the two Geometry
s touch;
Returns false
if both Geometry
s are pointspublic boolean intersects(Geometry g)
The intersects
predicate has the following equivalent definitions:
[T********]
[*T*******]
[***T*****]
[****T****]
! g.disjoint(this) = true
intersects
is the inverse of disjoint
)
g
- the Geometry
with which to compare this Geometry
true
if the two Geometry
s intersectdisjoint(com.vividsolutions.jts.geom.Geometry)
public boolean crosses(Geometry g)
The crosses
predicate has the following equivalent definitions:
[T*T******]
(for P/L, P/A, and L/A situations)
[T*****T**]
(for L/P, A/P, and A/L situations)
[0********]
(for L/L situations)
false
.
The SFS defined this predicate only for P/L, P/A, L/L, and L/A situations. In order to make the relation symmetric, JTS extends the definition to apply to L/P, A/P and A/L situations as well.
g
- the Geometry
with which to compare this Geometry
true
if the two Geometry
s cross.public boolean within(Geometry g)
The within
predicate has the following equivalent definitions:
[T*F**F***]
g.contains(this) = true
within
is the converse of contains(com.vividsolutions.jts.geom.Geometry)
)
A.within(B) = false
(As a concrete example, take A to be a LineString which lies in the boundary of a Polygon B.)
For a predicate with similar behaviour but avoiding
this subtle limitation, see coveredBy(com.vividsolutions.jts.geom.Geometry)
.
g
- the Geometry
with which to compare this Geometry
true
if this Geometry
is within
g
contains(com.vividsolutions.jts.geom.Geometry)
,
coveredBy(com.vividsolutions.jts.geom.Geometry)
public boolean contains(Geometry g)
The contains
predicate has the following equivalent definitions:
[T*****FF*]
g.within(this) = true
contains
is the converse of within(com.vividsolutions.jts.geom.Geometry)
)
B.contains(A) = false
.
(As a concrete example, take A to be a LineString which lies in the boundary of a Polygon B.)
For a predicate with similar behaviour but avoiding
this subtle limitation, see covers(com.vividsolutions.jts.geom.Geometry)
.
g
- the Geometry
with which to compare this Geometry
true
if this Geometry
contains g
within(com.vividsolutions.jts.geom.Geometry)
,
covers(com.vividsolutions.jts.geom.Geometry)
public boolean overlaps(Geometry g)
The overlaps
predicate has the following equivalent definitions:
[T*T***T**]
(for two points or two surfaces)
or [1*T***T**]
(for two curves)
false
.
g
- the Geometry
with which to compare this Geometry
true
if the two Geometry
s overlap.public boolean covers(Geometry g)
The covers
predicate has the following equivalent definitions:
[T*****FF*]
[*T****FF*]
[***T**FF*]
[****T*FF*]
g.coveredBy(this) = true
covers
is the converse of coveredBy(com.vividsolutions.jts.geom.Geometry)
)
false
.
This predicate is similar to contains(com.vividsolutions.jts.geom.Geometry)
,
but is more inclusive (i.e. returns true
for more cases).
In particular, unlike contains
it does not distinguish between
points in the boundary and in the interior of geometries.
For most situations, covers
should be used in preference to contains
.
As an added benefit, covers
is more amenable to optimization,
and hence should be more performant.
g
- the Geometry
with which to compare this Geometry
true
if this Geometry
covers g
contains(com.vividsolutions.jts.geom.Geometry)
,
coveredBy(com.vividsolutions.jts.geom.Geometry)
public boolean coveredBy(Geometry g)
The coveredBy
predicate has the following equivalent definitions:
[T*F**F***]
[*TF**F***]
[**FT*F***]
[**F*TF***]
g.covers(this) = true
coveredBy
is the converse of covers(com.vividsolutions.jts.geom.Geometry)
)
false
.
This predicate is similar to within(com.vividsolutions.jts.geom.Geometry)
,
but is more inclusive (i.e. returns true
for more cases).
g
- the Geometry
with which to compare this Geometry
true
if this Geometry
is covered by g
within(com.vividsolutions.jts.geom.Geometry)
,
covers(com.vividsolutions.jts.geom.Geometry)
public boolean relate(Geometry g, java.lang.String intersectionPattern)
IntersectionMatrix
for the two Geometry
s match the elements in intersectionPattern
.
The pattern is a 9-character string, with symbols drawn from the following set:
g
- the Geometry
with which to compare
this Geometry
intersectionPattern
- the pattern against which to check the
intersection matrix for the two Geometry
s
true
if the DE-9IM intersection
matrix for the two Geometry
s match intersectionPattern
IntersectionMatrix
public IntersectionMatrix relate(Geometry g)
IntersectionMatrix
for the two Geometry
s.
g
- the Geometry
with which to compare this Geometry
IntersectionMatrix
describing the intersections of the interiors,
boundaries and exteriors of the two Geometry
spublic boolean equals(Geometry g)
This method is included for backward compatibility reasons.
It has been superseded by the equalsTopo(Geometry)
method,
which has been named to clearly denote its functionality.
This method should NOT be confused with the method
equals(Object)
, which implements
an exact equality comparison.
g
- the Geometry
with which to compare this Geometry
Geometry
s are topologically equalequalsTopo(Geometry)
public boolean equalsTopo(Geometry g)
equals
predicate.
The SFS equals
predicate has the following equivalent definitions:
T*F**FFF*
T*F **F FF*
equalsExact(Geometry)
.
g
- the Geometry
with which to compare this Geometry
true
if the two Geometry
s are topologically equalequalsExact(Geometry)
public boolean equals(java.lang.Object o)
Object
.
If the argument Object
is not a Geometry
,
the result is false
.
Otherwise, the result is computed using
equalsExact(Geometry)
.
This method is provided to fulfill the Java contract
for value-based object equality.
In conjunction with hashCode()
it provides semantics which are most useful
for using
Geometry
s as keys and values in Java collections.
Note that to produce the expected result the input geometries should be in normal form. It is the caller's responsibility to perform this where required (using Geometry#norm() or {@link #normalize()} as appropriate).
equals
in class java.lang.Object
o
- the Object to compare
equalsExact(Geometry)
,
hashCode()
,
norm()
,
normalize()
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toText()
Geometry
.
For a definition of the Well-known Text format, see the OpenGIS Simple
Features Specification.
Geometry
public Geometry buffer(double distance)
abs(distance)
.
Mathematically-exact buffer area boundaries can contain circular arcs.
To represent these arcs using linear geometry they must be approximated with line segments.
The buffer geometry is constructed using 8 segments per quadrant to approximate
the circular arcs.
The end cap style is CAP_ROUND
.
The buffer operation always returns a polygonal result. The negative or
zero-distance buffer of lines and points is always an empty Polygon
.
This is also the result for the buffers of degenerate (zero-area) polygons.
distance
- the width of the buffer (may be positive, negative or 0)
TopologyException
- if a robustness error occursbuffer(double, int)
,
buffer(double, int, int)
public Geometry buffer(double distance, int quadrantSegments)
Mathematically-exact buffer area boundaries can contain circular arcs.
To represent these arcs
using linear geometry they must be approximated with line segments. The
quadrantSegments
argument allows controlling the accuracy of
the approximation by specifying the number of line segments used to
represent a quadrant of a circle
The buffer operation always returns a polygonal result. The negative or
zero-distance buffer of lines and points is always an empty Polygon
.
This is also the result for the buffers of degenerate (zero-area) polygons.
distance
- the width of the buffer (may be positive, negative or 0)quadrantSegments
- the number of line segments used to represent a quadrant of a
circle
TopologyException
- if a robustness error occursbuffer(double)
,
buffer(double, int, int)
public Geometry buffer(double distance, int quadrantSegments, int endCapStyle)
Mathematically-exact buffer area boundaries can contain circular arcs.
To represent these arcs using linear geometry they must be approximated with line segments.
The quadrantSegments
argument allows controlling the
accuracy of the approximation
by specifying the number of line segments used to represent a quadrant of a circle
The end cap style specifies the buffer geometry that will be created at the ends of linestrings. The styles provided are:
BufferOp.CAP_ROUND
- (default) a semi-circle
BufferOp.CAP_BUTT
- a straight line perpendicular to the end segment
BufferOp.CAP_SQUARE
- a half-square
The buffer operation always returns a polygonal result. The negative or
zero-distance buffer of lines and points is always an empty Polygon
.
This is also the result for the buffers of degenerate (zero-area) polygons.
distance
- the width of the buffer (may be positive, negative or 0)quadrantSegments
- the number of line segments used to represent a quadrant of a circleendCapStyle
- the end cap style to use
TopologyException
- if a robustness error occursbuffer(double)
,
buffer(double, int)
,
BufferOp
public Geometry convexHull()
Polygon
that contains all the
points in the Geometry
. This obviously applies only to Geometry
s which contain 3 or more points; the results for degenerate cases are
specified as follows:
Number of Point s in argument Geometry |
Geometry class of result |
|---|---|
| 0 | empty GeometryCollection |
| 1 | Point |
| 2 | LineString |
| 3 or more | Polygon |
Geometry
'
s pointspublic abstract Geometry reverse()
public Geometry intersection(Geometry other)
Geometry
representing the point-set which is
common to both this Geometry
and the other
Geometry.
The intersection of two geometries of different dimension produces a result
geometry of dimension less than or equal to the minimum dimension of the input
geometries.
The result geometry may be a heterogenous GeometryCollection
.
If the result is empty, it is an atomic geometry
with the dimension of the lowest input dimension.
Intersection of GeometryCollection
s is supported
only for homogeneous collection types.
Non-empty heterogeneous GeometryCollection
arguments are not supported.
other
- the Geometry
with which to compute the intersection
Geometry
s
TopologyException
- if a robustness error occurs
java.lang.IllegalArgumentException
- if the argument is a non-empty heterogeneous GeometryCollection
public Geometry union(Geometry other)
Geometry
representing the point-set
which is contained in both this
Geometry
and the other
Geometry.
The union of two geometries of different dimension produces a result
geometry of dimension equal to the maximum dimension of the input
geometries.
The result geometry may be a heterogenous
GeometryCollection
.
If the result is empty, it is an atomic geometry
with the dimension of the highest input dimension.
Unioning LineString
s has the effect of
noding and dissolving the input linework. In this context
"noding" means that there will be a node or endpoint in the result for
every endpoint or line segment crossing in the input. "Dissolving" means
that any duplicate (i.e. coincident) line segments or portions of line
segments will be reduced to a single line segment in the result.
If merged linework is required, the LineMerger
class can be used.
Non-empty GeometryCollection
arguments are not supported.
other
- the Geometry
with which to compute the union
Geometry
and the
points of other
TopologyException
- if a robustness error occurs
java.lang.IllegalArgumentException
- if either input is a non-empty GeometryCollectionLineMerger
public Geometry difference(Geometry other)
Geometry
representing the closure of the point-set
of the points contained in this Geometry
that are not contained in
the other
Geometry.
If the result is empty, it is an atomic geometry with the dimension of the left-hand input.
Non-empty GeometryCollection
arguments are not supported.
other
- the Geometry
with which to compute the
difference
Geometry
with
other
TopologyException
- if a robustness error occurs
java.lang.IllegalArgumentException
- if either input is a non-empty GeometryCollectionpublic Geometry symDifference(Geometry other)
Geometry
which are not
contained in the other
Geometry,
with the points in the other
Geometry not contained in this
Geometry
.
If the result is empty, it is an atomic geometry
with the dimension of the highest input dimension.
Non-empty GeometryCollection
arguments are not supported.
other
- the Geometry
with which to compute the symmetric
difference
Geometry
with other
TopologyException
- if a robustness error occurs
java.lang.IllegalArgumentException
- if either input is a non-empty GeometryCollectionpublic Geometry union()
union()
supports
GeometryCollection
s
(which the other overlay operations currently do not).
The result obeys the following contract:
LineString
s has the effect of fully noding
and dissolving the linework.
Polygon
s will always
return a Polygonal
geometry (unlike union(Geometry)
,
which may return geometrys of lower dimension if a topology collapse occurred.
TopologyException
- if a robustness error occursUnaryUnionOp
public abstract boolean equalsExact(Geometry other, double tolerance)
Geometry
s are exactly equal,
up to a specified distance tolerance.
Two Geometries are exactly equal within a distance tolerance
if and only if:
GeometryFactory
, the SRID
,
or the userData
fields.
To properly test equality between different geometries,
it is usually necessary to normalize()
them first.
other
- the Geometry
with which to compare this Geometry
tolerance
- distance at or below which two Coordinate
s
are considered equal
true
if this and the other Geometry
have identical structure and point values, up to the distance tolerance.equalsExact(Geometry)
,
normalize()
,
norm()
public boolean equalsExact(Geometry other)
Geometry
s are exactly equal.
Two Geometries are exactly equal iff:
equalsTopo(Geometry)
, which is more useful
in certain situations
(such as using geometries as keys in collections).
This method does not
test the values of the GeometryFactory
, the SRID
,
or the userData
fields.
To properly test equality between different geometries,
it is usually necessary to normalize()
them first.
other
- the Geometry
with which to compare this Geometry
true
if this and the other Geometry
have identical structure and point values.equalsExact(Geometry, double)
,
normalize()
,
norm()
public boolean equalsNorm(Geometry g)
equalsExact(Geometry)
.
This method is relatively expensive to compute. For maximum performance, the client should instead perform normalization on the individual geometries at an appropriate point during processing.
g
- a Geometry
public abstract void apply(CoordinateFilter filter)
Geometry
's
coordinates.
If this method modifies any coordinate values,
geometryChanged()
must be called to update the geometry state.
Note that you cannot use this method to
modify this Geometry if its underlying CoordinateSequence's #get method
returns a copy of the Coordinate, rather than the actual Coordinate stored
(if it even stores Coordinate objects at all).
filter
- the filter to apply to this Geometry
's
coordinatespublic abstract void apply(CoordinateSequenceFilter filter)
Geometry
's
CoordinateSequence
s.
If the filter reports that a coordinate value has been changed,
geometryChanged()
will be called automatically.
filter
- the filter to applypublic abstract void apply(GeometryFilter filter)
Geometry
and its
subelement Geometry
s (if any).
Only GeometryCollections and subclasses
have subelement Geometry's.
filter
- the filter to apply to this Geometry
(and
its children, if it is a GeometryCollection
).public abstract void apply(GeometryComponentFilter filter)
filter
- the filter to apply to this Geometry
.public java.lang.Object clone()
Geometry
object
(including all coordinates contained by it).
Subclasses are responsible for overriding this method and copying
their internal data. Overrides should call this method first.
clone
in class java.lang.Object
public abstract void normalize()
Geometry
to normal form (or
canonical form ). Normal form is a unique representation for Geometry
s. It can be used to test whether two Geometry
s are equal
in a way that is independent of the ordering of the coordinates within
them. Normal form equality is a stronger condition than topological
equality, but weaker than pointwise equality. The definitions for normal
form use the standard lexicographical ordering for coordinates. "Sorted in
order of coordinates" means the obvious extension of this ordering to
sequences of coordinates.
NOTE that this method mutates the value of this geometry in-place. If this is not safe and/or wanted, the geometry should be cloned prior to normalization.
public Geometry norm()
normalize()
public int compareTo(java.lang.Object o)
Geometry
is greater than, equal to,
or less than another Geometry
. If their classes are different, they are compared using the following ordering:
Geometry
s have the same class, their first
elements are compared. If those are the same, the second elements are
compared, etc.
compareTo
in interface java.lang.Comparable
o
- a Geometry
with which to compare this Geometry
o
, as
defined in "Normal Form For Geometry" in the JTS Technical
Specificationspublic int compareTo(java.lang.Object o, CoordinateSequenceComparator comp)
Geometry
is greater than, equal to,
or less than another Geometry
,
using the given CoordinateSequenceComparator
.
If their classes are different, they are compared using the following ordering:
Geometry
s have the same class, their first
elements are compared. If those are the same, the second elements are
compared, etc.
o
- a Geometry
with which to compare this Geometry
comp
- a CoordinateSequenceComparator
o
, as
defined in "Normal Form For Geometry" in the JTS Technical
Specificationsprotected boolean isEquivalentClass(Geometry other)
Geometry
s are equal, from the point
of view of the equalsExact
method. Called by equalsExact
. In general, two Geometry
classes are considered to be
"equivalent" only if they are the same class. An exception is LineString
, which is considered to be equivalent to its subclasses.
other
- the Geometry
with which to compare this Geometry
for equality
true
if the classes of the two Geometry
s are considered to be equal by the equalsExact
method.protected void checkNotGeometryCollection(Geometry g)
g
's class is GeometryCollection
. (Its subclasses do not trigger an exception).
g
- the Geometry
to check
java.lang.IllegalArgumentException
- if g
is a GeometryCollection
but not one of its subclassesprotected boolean isGeometryCollection()
GeometryCollection
,
rather than a homogeneous subclass.
protected abstract Envelope computeEnvelopeInternal()
Geometry
, or a null Envelope
if this Geometry
is empty.
Unlike getEnvelopeInternal
, this method calculates the Envelope
each time it is called; getEnvelopeInternal
caches the result
of this method.
Geometry
s bounding box; if the Geometry
is empty, Envelope#isNull
will return true
protected abstract int compareToSameClass(java.lang.Object o)
Geometry
is greater than, equal to,
or less than another Geometry
having the same class.
o
- a Geometry
having the same class as this Geometry
o
, as
defined in "Normal Form For Geometry" in the JTS Technical
Specificationsprotected abstract int compareToSameClass(java.lang.Object o, CoordinateSequenceComparator comp)
Geometry
is greater than, equal to,
or less than another Geometry
of the same class.
using the given CoordinateSequenceComparator
.
o
- a Geometry
having the same class as this Geometry
comp
- a CoordinateSequenceComparator
o
, as
defined in "Normal Form For Geometry" in the JTS Technical
Specificationsprotected int compare(java.util.Collection a, java.util.Collection b)
compareTo
encountered as
the two Collection
s are iterated over. If, by the time one of
the iterations is complete, no non-zero result has been encountered,
returns 0 if the other iteration is also complete. If b
completes before a
, a positive number is returned; if a
before b, a negative number.
a
- a Collection
of Comparable
sb
- a Collection
of Comparable
s
compareTo
result, if any;
otherwise, zeroprotected boolean equal(Coordinate a, Coordinate b, double tolerance)
|
JTS Topology Suite version 1.13 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


The Logging Tooltip extension copies image files to the Concordion output folder.
Given the system property concordion.extensions
is set to org.concordion.ext.LoggingTooltipExtension
.
The following files are copied to the output folder:
i16.png
)