Class GeoRelationalStore
- All Implemented Interfaces:
PopupActivationListener
,SpatialStore
,Serializable
,Comparable
,EventListener
,ListSelectionListener
,TableModelListener
,TableModel
- Direct Known Subclasses:
NetworkTable
,RouteTable
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from class ca.spatial.table.RelationalStore
DIRECT, INDIRECT
Fields inherited from class ca.spatial.table.AttributeStore
SELECT_ADD, SELECT_FROM, SELECT_NEW
Fields inherited from interface ca.spatial.table.SpatialStore
COLLECTION, CURVE, FLOAT_RASTER, INT_RASTER, MULTIPOINT, NULL, POINT, POLYGON, POLYLINE, SURFACE
-
Constructor Summary
ConstructorsConstructorDescriptionGeoRelationalStore(SpatialStore a1, AttributeStore a2, String columnName1, String columnName2)
GeoRelationalStore(SpatialStore a1, AttributeStore a2, String columnName1, String columnName2, int rowDelta)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addMenuItems(JPopupMenu jpm, AttributeStore l, int row, int period)
Add menu items to be displayed when a popup menu is activated on this table.addRelate(AttributeStore join, String column1, String column2)
Join a table to the current table, creating a new table having columns from both.addRelate(AttributeStore join, String column1, String column2, int rowDelta)
Join a table to the current table, creating a new table having columns from both.void
void
boolean
Query if this SpatialStore is capable of building a spatial indexvoid
copyTopology(GeoRelationalStore other)
findTopology(double distance)
findTopology(String filename, double distance, String label)
double[][]
getCoordinates(int id)
Get a list of raw coordinates for the points in this shape.Get the enclosing rectangle of all features in the tablegetExtent2D(int id)
Get the enclosing rectangle of a featuregetExtent2D(int id, int period)
Get the enclosing rectangle of a featureObtain projection information.getRecord(double x, double y, double fuzz)
Find a record by its x,y locationCompute the extent of the selected recordsgetSelection(Extent2D extent)
Get a set of records that fall within the selection rectangle.getShape(int row)
Get the shape object for a individual featuregetShape(int row, int period)
Get the shape object for a individual featuregetSnapshot(boolean useSelected, Observer progress)
Return a snapshot of the dataset at a given moment.int
getType()
Get the type of this table.boolean
Query if this SpatialStore has a spatial indexvoid
identifyRecords(Extent2D box)
loadTopology(String filename, double distance, String label)
Input a topology dataset for an arbitrary spatial dataset.loadTopology(String filename, double distance, String label, HashMap sizeLu)
void
Request that this SpatialStore create a spatial indexvoid
maybePopup(MouseEvent e, double x, double y, double fuzz, int period)
static GeoRelationalStore
Open up a store by name.static GeoRelationalStore
Open up a store by name.static GeoRelationalStore
openCoverage(String workspace, String coverage, boolean cache)
Open up a coverage and it's related INFO file by guessing the feature type.static GeoRelationalStore
openCoverage(String workspace, String coverage, int type, boolean cache)
Open up a coverage and it's related INFO file using an explicit feature type.static AttributeStore
openOrReuseGeo(String spec)
Open aGeoRelationalStore
data set.static GeoRelationalStore
openRamShapeFile(String filename)
Open up a shapefile and it's related DBF filestatic GeoRelationalStore
openShapeFile(String origFilename)
Deprecated.static GeoRelationalStore
openShapeFile(String origFilename, String encoding)
Deprecated.Use theopen(String,String)
method insteadvoid
processRecords(Extent2D box, RecordHandler handler)
records()
Return an Iterator for all the records in the tablerecords(double x, double y, double width, double height)
Return an Iterator for the records that fall within the selection rectangleReturn an Iterator for the records that fall within the selection rectanglereuseOrLoadTopology(String filename, double distance, String label)
Access a previously loaded topology file, or if not already loaded then input a topology dataset for an arbitrary spatial dataset.selectByLocation(String locSourceExpr, GeoRelationalStore locSource, SpatialOperator operator, double distance, int period)
The method will calculate the selection of records based on a proximity to selected features in a second data source.selectByLocation(String locSourceExpr, GeoRelationalStore locSource, String operator, double distance, int period)
The method will calculate the selection of records based on a proximity to selected features in a second data source.void
selectRecords(Extent2D box, boolean add)
Select records that overlap the box.void
selectRecords(org.locationtech.jts.geom.Geometry g, boolean add, boolean within)
Select records that intersect the Geometry.selectRecords(org.locationtech.jts.geom.Geometry poly, SpatialOperator operator)
selectRecords(org.locationtech.jts.geom.Geometry poly, String operator)
void
selectWithinConvexHull(String select, int period, boolean add, boolean within)
Select records that fall within the convex hull of the records specified by the expression.selectWithinConvexHull(String select, SpatialOperator operator, int period)
Select records that fall within the convex hull of the records specified by the expression.selectWithinConvexHull(String select, String operator, int period)
Select records that fall within the convex hull of the records specified by the expression.void
Methods inherited from class ca.spatial.table.RelationalStore
addCellEditors, allowsEditing, buildIndex, canIndex, close, closeAllRelates, findBaseTable, findColumn, getBaseRelation, getColumn1, getColumn2, getColumnName1, getColumnName2, getEditMode, getFullColumnName, getLeftRelate, getPeriodCount, getRightRelate, getRowCount, getRowDelta, getRowNodeRemap, getSynchronizer, getValueAt, getYearForPeriod, hasIndex, lookupRow, nativeLookupRow, removeRightRelates, setColumn1, setEditMode, setValueAt, tableChanged
Methods inherited from class ca.spatial.table.AttributeStore
absoluteFile, absoluteFile, absolutePath, absolutePath, addPopupActivationListener, addTableModelListener, addToGlobalStoreList, booleanValue, booleanValue, calculate, calculateField, calculateField, changeSelection, clearSelection, compareTo, decodeCharset, doubleValue, doubleValue, exportCSV, exportCSV, exportCSV, exportCSV, exportCSV, exportCSV, exportDBF, exportDBF, exportDBF, exportDBF, exportDBF, findColumn, findSimilarColumnNames, getAttributeFormat, getCacheParent, getCachingLayer, getCachingLayer, getCanonicalName, getColumnClass, getColumnCount, getColumnName, getColumnNames, getContextPeriods, getCwd, getListSelectionModel, getMinMax, getMinMax, getMinMax, getMinMax, getMinMax, getOpenStore, getOpenStore, getOpenStore, getOpenStores, getPeriod, getPeriodWidth, getSelectedRowCount, getSelection, getSelection, getSelection, getShortName, getSnapshot, getStoreByShortName, getStoreByTitle, getTableName, getTableSpec, getTitle, getValueAt, identifyRecords, integerValue, integerValue, isCellEditable, isSelectedIndex, isSelectionEmpty, listify, listValue, listValue, makeLu, maybePopup, notifyPopupActivationListeners, openOrReuse, openOrReuse, queryTable, queryTable, quoteIfRequired, relativePath, removeFromGlobalStoreList, removePopupActivationListener, removeTableModelListener, select, select, selectAdd, selectFrom, selectNew, setCwd, setCwd, setListSelectionModel, setPeriod, setRowNodeRemap, setShortName, setTableSpec, setTitle, setValueAt, showCube, showTable, toString, uniqueValues, uniqueValues, uniqueValues, uniqueValues, uniqueValues, uniqueValues, uniqueValues, uniqueValues, valueChanged
Methods inherited from class javax.swing.table.AbstractTableModel
fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ca.spatial.table.SpatialStore
getRowCount, getTitle
-
Constructor Details
-
GeoRelationalStore
public GeoRelationalStore(SpatialStore a1, AttributeStore a2, String columnName1, String columnName2) throws Exception- Throws:
Exception
-
GeoRelationalStore
public GeoRelationalStore(SpatialStore a1, AttributeStore a2, String columnName1, String columnName2, int rowDelta) throws Exception- Throws:
Exception
-
-
Method Details
-
openOrReuseGeo
Open aGeoRelationalStore
data set. If the data set is already open and exists in the cache, then return the cached version. Otherwise open a new copy and add it to the cache.- Parameters:
spec
- A string that specifies the data set to open (either a filename or tablespec string).- Returns:
- Returns the handle to the data set.
- Throws:
Exception
- An exception if the file cannot be opened or is not a GeoRelational data set.
-
open
Open up a store by name. THe cache is not checked.- Parameters:
spec
- A string that specifies the data set to open (either a filename or tablespec string).- Returns:
- Returns the handle to the data set.
- Throws:
Exception
- An exception if the file cannot be opened or is not a GeoRelational data set.
-
open
Open up a store by name. THe cache is not checked.- Parameters:
spec
- A string that specifies the data set to open (either a filename or tablespec string).- Returns:
- Returns the handle to the data set.
- Throws:
Exception
- An exception if the file cannot be opened or is not a GeoRelational data set.
-
openShapeFile
Deprecated.Use theopen(String)
method insteadOpen up a shapefile and it's related DBF file- Parameters:
origFilename
- The name of the file to open- Throws:
Exception
- An exception if the file cannot be opened or is not a GeoRelational data set.
-
openShapeFile
public static GeoRelationalStore openShapeFile(String origFilename, String encoding) throws ExceptionDeprecated.Use theopen(String,String)
method insteadOpen up a shapefile and it's related DBF file- Parameters:
origFilename
- The name of the file to openencoding
- The character set encoding to use for this data set.- Throws:
Exception
- An exception if the file cannot be opened or is not a GeoRelational data set.
-
openCoverage
public static GeoRelationalStore openCoverage(String workspace, String coverage, int type, boolean cache) throws ExceptionOpen up a coverage and it's related INFO file using an explicit feature type.- Throws:
Exception
- An exception if the file cannot be opened or is not a GeoRelational data set.
-
openCoverage
public static GeoRelationalStore openCoverage(String workspace, String coverage, boolean cache) throws ExceptionOpen up a coverage and it's related INFO file by guessing the feature type.- Throws:
Exception
- An exception if the file cannot be opened or is not a GeoRelational data set.
-
openRamShapeFile
Open up a shapefile and it's related DBF file- Throws:
Exception
- An exception if the file cannot be opened or is not a GeoRelational data set.
-
maybePopup
-
addMenuItems
Description copied from class:AttributeStore
Add menu items to be displayed when a popup menu is activated on this table. This method when a popup mouse click happens on a map layer, just before the popup menu appears. Each layer is given an opportunity to add menu items into the popup that are specific to the functionality that the layer provides. The menu items that are added must contain the functionality to perform the requested action.- Specified by:
addMenuItems
in interfacePopupActivationListener
- Overrides:
addMenuItems
in classAttributeStore
- Parameters:
jpm
- The menu that the items should be added intol
- The main AttributeStore that initiated this request. This may be different than the current AttributeStore if the main table is a RelationalStore composed of a number of parts.row
- The row in the table that this event applies toperiod
- The period that the request applies to.
-
getThemeList
-
addTheme
-
addTheme
-
addRelate
public GeoRelationalStore addRelate(AttributeStore join, String column1, String column2) throws ExceptionJoin a table to the current table, creating a new table having columns from both. The method returns a reference to the new table. You must use the table provided in the reference to see the join. The old table will not have changed at all.When you are finished using the new table then simply drop the reference to it, and it will be garbage collected.
- Overrides:
addRelate
in classAttributeStore
- Parameters:
join
- The table that should be joined to this tablecolumn1
- The foreign key in the original tablecolumn2
- The primary key in the table to be joined- Returns:
- The joined RelationalStore
- Throws:
Exception
- if errors occur while setting up the relate
-
addRelate
public GeoRelationalStore addRelate(AttributeStore join, String column1, String column2, int rowDelta) throws ExceptionDescription copied from class:AttributeStore
Join a table to the current table, creating a new table having columns from both. The method returns a reference to the new table. You must use the table provided in the reference to see the join. The old table will not have changed at all.When you are finished using the new table then simply drop the reference to it, and it will be garbage collected.
- Overrides:
addRelate
in classAttributeStore
- Parameters:
join
- The table that should be joined to this tablecolumn1
- The foreign key in the original tablecolumn2
- The primary key in the table to be joinedrowDelta
- A row offset between the two tables that is used when the tables are joined by row number.- Returns:
- The joined RelationalStore
- Throws:
Exception
- if errors occur while setting up the relate
-
getSnapshot
Description copied from class:AttributeStore
Return a snapshot of the dataset at a given moment. The general behaviour of this method is to simply return the same datastore. Some specialized datastores (such asCrosstabStore
), will compute an instance that can be used and then disposed.The default behaviour simply returns 'this'.
- Overrides:
getSnapshot
in classRelationalStore
- Parameters:
useSelected
- If true then only use the currently selected records in computing the snapshot.progress
- An optional progress bar. This parameter may be null.- Returns:
- An AttributeStore representing a materialization of the store.
-
getProjectionInfo
Description copied from interface:SpatialStore
Obtain projection information.- Specified by:
getProjectionInfo
in interfaceSpatialStore
-
records
Description copied from interface:SpatialStore
Return an Iterator for all the records in the table- Specified by:
records
in interfaceSpatialStore
-
records
Description copied from interface:SpatialStore
Return an Iterator for the records that fall within the selection rectangle- Specified by:
records
in interfaceSpatialStore
-
records
Description copied from interface:SpatialStore
Return an Iterator for the records that fall within the selection rectangle- Specified by:
records
in interfaceSpatialStore
-
getType
public int getType()Description copied from interface:SpatialStore
Get the type of this table. Types may be one ofSpatialStore.POINT
,SpatialStore.CURVE
,SpatialStore.POLYLINE
,SpatialStore.SURFACE
,SpatialStore.POLYGON
, orSpatialStore.MULTIPOINT
.- Specified by:
getType
in interfaceSpatialStore
-
getShape
Description copied from interface:SpatialStore
Get the shape object for a individual feature- Specified by:
getShape
in interfaceSpatialStore
- Parameters:
row
- The record of interest- Returns:
- A shape object
-
getShape
Description copied from interface:SpatialStore
Get the shape object for a individual feature- Specified by:
getShape
in interfaceSpatialStore
- Parameters:
row
- The record of interestperiod
- The period of interest- Returns:
- A shape object
-
getCoordinates
public double[][] getCoordinates(int id)Description copied from interface:SpatialStore
Get a list of raw coordinates for the points in this shape.- Specified by:
getCoordinates
in interfaceSpatialStore
- Parameters:
id
- The row of interest- Returns:
- An array of arrays of coordinate points. Each element in the outer array contains a 'part' of the underlying shape (for example, and island or a multi-part polygon). The inner array index holds the coordinate points of that part.
-
getExtent2D
Description copied from interface:SpatialStore
Get the enclosing rectangle of a feature- Specified by:
getExtent2D
in interfaceSpatialStore
- Parameters:
id
- The record of interest- Returns:
- A rectangle
-
getExtent2D
Description copied from interface:SpatialStore
Get the enclosing rectangle of a feature- Specified by:
getExtent2D
in interfaceSpatialStore
- Parameters:
id
- The record of interestperiod
- The period of interest- Returns:
- A rectangle
-
getExtent2D
Description copied from interface:SpatialStore
Get the enclosing rectangle of all features in the table- Specified by:
getExtent2D
in interfaceSpatialStore
- Returns:
- A rectangle
-
getSelection
Description copied from interface:SpatialStore
Get a set of records that fall within the selection rectangle.- Specified by:
getSelection
in interfaceSpatialStore
- Parameters:
extent
- The selection rectangle of interest- Returns:
- A set of selected records
-
hasSpatialIndex
public boolean hasSpatialIndex()Description copied from interface:SpatialStore
Query if this SpatialStore has a spatial index- Specified by:
hasSpatialIndex
in interfaceSpatialStore
-
canBuildSpatialIndex
public boolean canBuildSpatialIndex()Description copied from interface:SpatialStore
Query if this SpatialStore is capable of building a spatial index- Specified by:
canBuildSpatialIndex
in interfaceSpatialStore
-
makeSpatialIndex
Description copied from interface:SpatialStore
Request that this SpatialStore create a spatial index- Specified by:
makeSpatialIndex
in interfaceSpatialStore
- Throws:
Exception
-
reuseOrLoadTopology
Access a previously loaded topology file, or if not already loaded then input a topology dataset for an arbitrary spatial dataset.This routine will return a topology dataset. This routine will not change the default block topology. You may call this routine at any time.
- Parameters:
filename
- The file containing the topological relationships.distance
- A value that is used to filter records from the topology file. Only neighbours that are within the filter distance are loaded from the topology file.label
- The name of the field in the spatial dataset that uniquely identifies each row.
-
findTopology
-
findTopology
-
loadTopology
Input a topology dataset for an arbitrary spatial dataset.This routine will load a topology dataset. This routine will not change the default block topology. You may call this routine at any time.
- Parameters:
filename
- The file containing the topological relationships.distance
- A value that is used to filter records from the topology file. Only neighbours that are within the filter distance are loaded from the topology file.label
- The name of the field in the spatial dataset that uniquely identifies each row.
-
loadTopology
-
getTopologies
-
copyTopology
-
getAssociatedNetworkTable
-
setAssociatedNetworkTable
-
getIntersectedBlocks
-
getRecord
Find a record by its x,y location -
selectRecords
Select records that overlap the box.- Parameters:
box
- The extent to test for overlapsadd
- If true add records to the selection, if false then remove records from the selection.
-
identifyRecords
-
processRecords
-
getSelectedExtent
Compute the extent of the selected records -
selectRecords
public void selectRecords(org.locationtech.jts.geom.Geometry g, boolean add, boolean within)Select records that intersect the Geometry.- Parameters:
g
- the Geometry to testadd
- If true add records to the selection, if false then remove records from the selection.
-
selectRecords
-
selectRecords
-
selectByLocation
public BitSet selectByLocation(String locSourceExpr, GeoRelationalStore locSource, String operator, double distance, int period)The method will calculate the selection of records based on a proximity to selected features in a second data source. The selection is returned as aBitSet
, with each selected record represented as a selected bit.In the following example the operator will first select all features from the point dataset where "Type = 'HQ'" in period 0. These features will be buffered by 1000 units. The resulting polygon(s) will be used to test features from blocks dataset. All blocks features that are within the buffer will be included in the selected set.
blocks.selectByLocation("Type = 'HQ'", points, "WITHIN", 1000, 0);
- Parameters:
locSourceExpr
- an expression that will select the records to buffer from the second data sourcelocSource
- the second data sourceoperator
- The selection operator used when comparing features to the buffer (either "INTERSECTS" or "WITHIN")distance
- the buffering distance to be applied to each feature from the second data sourceperiod
- The planning period to use when applying the selection expression
-
selectByLocation
public BitSet selectByLocation(String locSourceExpr, GeoRelationalStore locSource, SpatialOperator operator, double distance, int period)The method will calculate the selection of records based on a proximity to selected features in a second data source. The selection is returned as aBitSet
, with each selected record represented as a selected bit.In the following example the operator will first select all features from the point dataset where "Type = 'HQ'" in period 0. These features will be buffered by 1000 units. The resulting polygon(s) will be used to test features from blocks dataset. All blocks features that are within the buffer will be included in the selected set.
blocks.selectByLocation("Type = 'HQ'", points, SpatialOperator.WITHIN, 1000, 0);
- Parameters:
locSourceExpr
- an expression that will select the records to buffer from the second data sourcelocSource
- the second data sourceoperator
- The selection operator used when comparing features to the buffer (either INTERSECTS or WITHIN)distance
- the buffering distance to be applied to each feature from the second data sourceperiod
- The planning period to use when applying the selection expression
-
selectWithinConvexHull
Select records that fall within the convex hull of the records specified by the expression.- Parameters:
select
- An expression that specifies what records to select.add
- If true add records to the selection, if false then remove records from the selection.
-
selectWithinConvexHull
Select records that fall within the convex hull of the records specified by the expression.- Parameters:
select
- An expression that specifies what records to select.
-
selectWithinConvexHull
Select records that fall within the convex hull of the records specified by the expression.- Parameters:
select
- An expression that specifies what records to select.
-
open(String)
method instead