public class EditTransaction
extends java.lang.Object
Also:
Modifier and Type | Class and Description |
---|---|
static interface |
EditTransaction.SelectionEditor |
static interface |
EditTransaction.SuccessAction |
Modifier and Type | Field and Description |
---|---|
static com.vividsolutions.jts.geom.Geometry |
EMPTY_GEOMETRY |
static java.lang.String |
ROLLING_BACK_INVALID_EDITS_KEY |
Constructor and Description |
---|
EditTransaction(java.util.Collection features,
java.lang.String name,
Layer layer,
boolean rollingBackInvalidEdits,
boolean allowAddingAndRemovingFeatures,
LayerViewPanel layerViewPanel)
Creates a new EditTransaction modifying features.
|
EditTransaction(java.util.Collection features,
java.lang.String name,
Layer layer,
boolean rollingBackInvalidEdits,
boolean allowAddingAndRemovingFeatures,
LayerViewPanelContext layerViewPanelContext)
If you want to delete a feature, you can either (1) include the feature in
the features parameter, set allowAddingAndRemovingFeatures to true,
then call #setGeometry(feature, empty geometry); or (2) not include the feature in
the features parameter, instead using #deleteFeature
|
Modifier and Type | Method and Description |
---|---|
void |
clearEnvelopeCaches() |
boolean |
commit() |
static boolean |
commit(java.util.Collection editTransactions) |
static boolean |
commit(java.util.Collection editTransactions,
EditTransaction.SuccessAction successAction)
Commits several EditTransactions if their proposed geometries are all valid.
|
boolean |
commit(EditTransaction.SuccessAction successAction) |
protected UndoableCommand |
createCommand() |
void |
createFeature(Feature feature) |
static EditTransaction |
createTransactionOnSelection(EditTransaction.SelectionEditor editor,
SelectionManagerProxy selectionManagerProxy,
LayerViewPanelContext layerViewPanelContext,
java.lang.String name,
Layer layer,
boolean rollingBackInvalidEdits,
boolean allowAddingAndRemovingFeatures)
A utility class creating a transaction able to rollback selected
features after they have been edited according to the SelectionEditor
definition.
|
void |
deleteFeature(Feature feature) |
static int |
emptyGeometryCount(java.util.Collection transactions) |
static java.util.Map |
featureToNewGeometryMap(EditTransaction.SelectionEditor editor,
SelectionManagerProxy selectionManagerProxy,
Layer layer)
Utility method to create a map between features and there modified
geometry.
|
Feature |
getFeature(int i)
Deprecated.
|
java.util.Collection<Feature> |
getFeatures()
Returns the features modified by this transaction [mmichaud 2011-09-17]
|
com.vividsolutions.jts.geom.Geometry |
getGeometry(Feature feature) |
com.vividsolutions.jts.geom.Geometry |
getGeometry(int i)
Deprecated.
|
Layer |
getLayer() |
void |
modifyFeatureGeometry(Feature feature,
com.vividsolutions.jts.geom.Geometry newGeometry) |
boolean |
proposedGeometriesValid() |
void |
setGeometries(java.util.Map featureToGeometryMap) |
void |
setGeometry(Feature feature,
com.vividsolutions.jts.geom.Geometry geometry) |
void |
setGeometry(int i,
com.vividsolutions.jts.geom.Geometry geometry)
Deprecated.
|
int |
size() |
public static final java.lang.String ROLLING_BACK_INVALID_EDITS_KEY
public static final com.vividsolutions.jts.geom.Geometry EMPTY_GEOMETRY
public EditTransaction(java.util.Collection features, java.lang.String name, Layer layer, boolean rollingBackInvalidEdits, boolean allowAddingAndRemovingFeatures, LayerViewPanel layerViewPanel)
features
- features to be modifiedname
- display name for undo. Use PlugIn#getName or CursorTool#getName.layer
- the layer to which the features belongrollingBackInvalidEdits
- is true if we want to roll back transaction
in case of invalid editsallowAddingAndRemovingFeatures
- whether to treat empty
geometries as indications to add/remove features or as in fact empty geometrieslayerViewPanel
- the view where editing operations take place.public EditTransaction(java.util.Collection features, java.lang.String name, Layer layer, boolean rollingBackInvalidEdits, boolean allowAddingAndRemovingFeatures, LayerViewPanelContext layerViewPanelContext)
features
- features to be modifiedname
- display name for undo. Use PlugIn#getName or CursorTool#getName.layer
- the layer to which the features belongrollingBackInvalidEdits
- is true if we want to roll back transaction
in case of invalid editsallowAddingAndRemovingFeatures
- whether to treat empty
geometries as indications to add/remove features or as in fact empty geometrieslayerViewPanelContext
- the view where editing operations take place.public static EditTransaction createTransactionOnSelection(EditTransaction.SelectionEditor editor, SelectionManagerProxy selectionManagerProxy, LayerViewPanelContext layerViewPanelContext, java.lang.String name, Layer layer, boolean rollingBackInvalidEdits, boolean allowAddingAndRemovingFeatures)
public static java.util.Map featureToNewGeometryMap(EditTransaction.SelectionEditor editor, SelectionManagerProxy selectionManagerProxy, Layer layer)
public com.vividsolutions.jts.geom.Geometry getGeometry(int i)
public com.vividsolutions.jts.geom.Geometry getGeometry(Feature feature)
public void setGeometry(Feature feature, com.vividsolutions.jts.geom.Geometry geometry)
public void setGeometries(java.util.Map featureToGeometryMap)
public void setGeometry(int i, com.vividsolutions.jts.geom.Geometry geometry)
public boolean commit()
public static boolean commit(java.util.Collection editTransactions)
public static boolean commit(java.util.Collection editTransactions, EditTransaction.SuccessAction successAction)
successAction
- run after the first execution (i.e. not after redos) if all
proposed geometries are valid (or rollingBackInvalidEdits is false)public boolean commit(EditTransaction.SuccessAction successAction)
successAction
- will be run if the geometries are valid (or
OptionsPlugIn#isRollingBackInvalidEdits returns false), before the layer-change
events are fired. Useful for animations and other visual indicators which would
be slowed down if the layer-change events were fired first.public void clearEnvelopeCaches()
public boolean proposedGeometriesValid()
protected UndoableCommand createCommand()
public int size()
public Feature getFeature(int i)
public java.util.Collection<Feature> getFeatures()
public void createFeature(Feature feature)
public void deleteFeature(Feature feature)
feature
- must not have been passed into the constructorpublic void modifyFeatureGeometry(Feature feature, com.vividsolutions.jts.geom.Geometry newGeometry)
public Layer getLayer()
public static int emptyGeometryCount(java.util.Collection transactions)