|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
schmitzm.swing.JPanel
skrueger.geotools.XMapPane
schmitzm.geotools.gui.SelectableXMapPane
schmitzm.geotools.gui.JMapEditorPane
public class JMapEditorPane
The JMapEditorPane
extends the SelectableXMapPane
with functionalities
to create new vector layers by successively click points via mouse.
Nested Class Summary | |
---|---|
static class |
JMapEditorPane.EditorMode
Modes, the editor can be perform. |
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected SimpleFeatureType |
additionalAttr
Contains the additional attributes for new FeatureCollections. |
protected FeatureInputOption |
attrInputOption
Contains the InputOption to specify the additional
attribute values. |
static Style |
DEFAULT_LINE_STYLE
Default-Style for line layers (blue lines). |
static Style |
DEFAULT_POINT_STYLE
Default-Style for point layers (blue dots). |
static Style |
DEFAULT_POLYGON_STYLE
Default-Style for polygon layers (orange with black borders). |
protected XMapPaneTool |
EDITING_TOOL
|
protected |
editorFeatureCollection
Holds the FeatureCollection of the edited layer. |
protected SimpleFeatureType |
editorFeatureType
Holds the SimpleFeatureType of the edited layer. |
protected FeatureUtil.GeometryForm |
editorGeometryForm
Holds the kind of geometry of the edited layer. |
protected MapLayer |
editorLayer
Holds the edited layer. |
protected MapContext |
editorMapContext
The map context where the edited layers are displayed. |
protected JMapEditorPane.EditorMode |
editorMode
Holds the operation the editor currently performs. |
protected GTRenderer |
editorRenderer
The renderer the edited layers are rendered with. |
protected Map<FeatureUtil.GeometryForm,Style> |
editorStyles
Holds the styles to display edited layers. |
static String |
GEOMETRY_ATTR
Attribute name used for the geometry of new layers. |
protected Stack<SimpleFeature> |
globalRedoFeatures
Holds the undone segments (complete Features) which can be redone. |
protected Stack<Stack<Coordinate>> |
globalRedoPoints
Holds the undone points of former segments (complete Features) which can be redone. |
protected Stack<SimpleFeature> |
globalUndoFeatures
Holds the former segments (complete Features) which can be undone. |
protected Stack<Stack<Coordinate>> |
globalUndoPoints
Holds the points of former segments (complete Features) which can be undone. |
protected MapContext |
mapContext
The map context of the displayed layer. |
protected DefaultFeatureCollection |
segmLineFeatureCollection
Holds the FeatureCollection which holds the new segment
(incomplete SimpleFeature) displayed as line. |
protected SimpleFeatureType |
segmLineFeatureType
Holds the SimpleFeatureType of the new segment (incomplete SimpleFeature)
displayed as line. |
protected MapLayer |
segmLineLayer
Holds the layer, the new segment (incomplete SimpleFeature) is displayed in as line. |
protected DefaultFeatureCollection |
segmPointFeatureCollection
Holds the FeatureCollection which holds the new segment
(incomplete SimpleFeature) displayed as points. |
protected SimpleFeatureType |
segmPointFeatureType
Holds the SimpleFeatureType of the new segment (incomplete SimpleFeature)
displayed as points. |
protected MapLayer |
segmPointLayer
Holds the layer, the new segment (incomplete SimpleFeature) is displayed in as points. |
protected Stack<Coordinate> |
segmRedoPoints
Holds the undone points of the edited segment (incomplete SimpleFeature) which can be redone. |
protected Stack<Coordinate> |
segmUndoPoints
Holds the points of the edited segment (incomplete SimpleFeature) which can be undone. |
Fields inherited from class schmitzm.geotools.gui.SelectableXMapPane |
---|
LOGGER, NONE, SELECT_ALL, SELECT_ONE_FROM_TOP, SELECT_TOP |
Fields inherited from class skrueger.geotools.XMapPane |
---|
bgExecuter, bgMapLayerListener, DEFAULT_RESIZING_PAINT_DELAY, INITIAL_REPAINT_DELAY, labelCache, localMapLayerListener, mapArea, mapImageInvalid, mapLayerSelectable, mapPaneListeners, oldMapArea, oldScreenToWorld, paneResized, renderingErrors, REPEATING_REPAINT_DELAY, screenToWorld |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
JMapEditorPane()
Creates a new JMapEditorPane . |
|
JMapEditorPane(MapContext context)
Creates a new JMapEditorPane . |
Method Summary | |
---|---|
protected void |
addSegment(Coordinate coord)
Called when the mouse is clicked on map during creating a new layer. |
protected void |
addSegment(Coordinate coord,
boolean refresh,
boolean clearRedo)
Called when the mouse is clicked on map during creating a new layer. |
void |
cancelEditing()
Cancels the current edititing operation. |
protected SimpleFeature |
createSegmentLineFeature()
Creates a new Line-SimpleFeature from the currently selected
segment points. |
protected SimpleFeature |
createSegmentPointFeature()
Creates a new MultiPoint-SimpleFeature from the currently selected
segment points. |
void |
finishEditing()
Finishes the current editing operation. |
void |
finishFeature()
Finishes the editing of the current segment (SimpleFeature). |
protected void |
finishFeature(boolean refresh,
boolean clearRedo)
Finishes the editing of the current segment (SimpleFeature). |
protected void |
generateSegmentFeatureCollection()
Creates a new segment SimpleFeature from the currently selected points. |
SimpleFeatureType |
getAdditionalAttributes()
Returns the additional attributes for new FeatureCollections (besides the geometric attribute, which is added automatically). |
|
getEditorFeatureCollection()
Returns the FeatureCollection of the edited layer. |
MapLayer |
getEditorLayer()
Returns the edited layer. |
JMapEditorPane.EditorMode |
getEditorMode()
Returns the current editor mode. |
Style |
getEditorStyle()
Returns the style for the current edited layer. |
Style |
getEditorStyle(FeatureUtil.GeometryForm geomForm)
Returns the style for edited layers. |
protected void |
initEditorFeatureCollection(String title)
Sets editorFeatureCollection and editorLayer to completely
new instances. |
protected void |
initSegmentFeatureCollection()
Clears the FeatureCollection used to handle the current
edited segment. |
protected void |
initUndoRedo()
Sets editorFeatureCollection and editorLayer to completely
new instances. |
boolean |
isEditorEnabled()
Checks, whether a layer is edited. |
boolean |
isRedoPossible()
Checks wheater a redo operation can be performed. |
boolean |
isUndoPossible()
Checks wheater a undo operation can be performed. |
protected void |
paintComponent(Graphics g)
After the actions of the super method, this method paints the special editor layers in editorMapContext . |
void |
redoEditing()
Restores the last undone editing action. |
void |
redoEditing(int count)
Restores previous undone editing actions. |
void |
setAdditionalAttributes(SimpleFeatureType fType)
Sets the additional attributes for new FeatureCollections (besides the geometric attribute, which is added automatically). |
void |
setEditorStyle(FeatureUtil.GeometryForm geomForm,
Style style)
Sets the style for edited layers. |
void |
startEditing(JMapEditorPane.EditorMode mode,
String layerTitle)
Starts a new layer. |
void |
undoAll()
Makes all made editing action undone. |
void |
undoEditing()
Makes the last made editing action undone. |
void |
undoEditing(int count)
Makes previously made editing actions undone. |
Methods inherited from class schmitzm.swing.JPanel |
---|
print, setBackground, setEnabled |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String GEOMETRY_ATTR
public static final Style DEFAULT_POINT_STYLE
public static final Style DEFAULT_LINE_STYLE
public static final Style DEFAULT_POLYGON_STYLE
protected MapContext mapContext
protected SimpleFeatureType additionalAttr
protected FeatureInputOption attrInputOption
InputOption
to specify the additional
attribute values.
protected MapContext editorMapContext
protected GTRenderer editorRenderer
protected Map<FeatureUtil.GeometryForm,Style> editorStyles
styles
to display edited layers.
protected JMapEditorPane.EditorMode editorMode
protected SimpleFeatureType editorFeatureType
SimpleFeatureType
of the edited layer.
protected FeatureUtil.GeometryForm editorGeometryForm
protectededitorFeatureCollection
FeatureCollection
of the edited layer.
protected MapLayer editorLayer
protected SimpleFeatureType segmLineFeatureType
SimpleFeatureType
of the new segment (incomplete SimpleFeature)
displayed as line.
protected DefaultFeatureCollection segmLineFeatureCollection
FeatureCollection
which holds the new segment
(incomplete SimpleFeature) displayed as line.
protected MapLayer segmLineLayer
protected SimpleFeatureType segmPointFeatureType
SimpleFeatureType
of the new segment (incomplete SimpleFeature)
displayed as points.
protected DefaultFeatureCollection segmPointFeatureCollection
FeatureCollection
which holds the new segment
(incomplete SimpleFeature) displayed as points.
protected MapLayer segmPointLayer
protected Stack<Coordinate> segmUndoPoints
protected Stack<Coordinate> segmRedoPoints
protected Stack<Stack<Coordinate>> globalUndoPoints
protected Stack<Stack<Coordinate>> globalRedoPoints
protected Stack<SimpleFeature> globalUndoFeatures
protected Stack<SimpleFeature> globalRedoFeatures
protected XMapPaneTool EDITING_TOOL
Constructor Detail |
---|
public JMapEditorPane()
JMapEditorPane
.
public JMapEditorPane(MapContext context)
JMapEditorPane
. This constructor provides the possibility
to use alternative implementations of the internal components.
The specified parameter all can be null
! In this case
the respective default component is used.
Method Detail |
---|
protected void paintComponent(Graphics g)
editorMapContext
.
paintComponent
in class XMapPane
public boolean isEditorEnabled()
public void setEditorStyle(FeatureUtil.GeometryForm geomForm, Style style)
geomForm
- kind of layers the style is set forstyle
- a Style (if null
a default style is set, so
#getEditorStyle(GeometryForm)
never returns null)public Style getEditorStyle(FeatureUtil.GeometryForm geomForm)
geomForm
- type of layers the style is returned forpublic Style getEditorStyle()
public void setAdditionalAttributes(SimpleFeatureType fType)
fType
- defines the attributes (If null
, new FeatureCollections
only contain the geometric attribute)public SimpleFeatureType getAdditionalAttributes()
public JMapEditorPane.EditorMode getEditorMode()
public MapLayer getEditorLayer()
publicgetEditorFeatureCollection()
FeatureCollection
of the edited layer.
public void startEditing(JMapEditorPane.EditorMode mode, String layerTitle)
mode
- type of layerlayerTitle
- Title for the new layer
UnsupportedOperationException
- if no map area is defined yetprotected void addSegment(Coordinate coord, boolean refresh, boolean clearRedo)
coord
- World coordinates of click positionrefresh
- indicates whether the visualization will be refreshedaClearRedo
- indicates whether the REDO-Stack is cleared (normally true
,
but false
during REDO operation!)protected void addSegment(Coordinate coord)
coord
- World coordinates of click positionprotected void finishFeature(boolean refresh, boolean clearRedo)
refresh
- indicates whether the visualization will be refreshedaClearRedo
- indicates whether the REDO-Stack is cleared (normally true
,
but false
during REDO operation!)
UnsupportedOperationException
- if a line or polygon feature can not
be finished because of less specified pointspublic void finishFeature()
public void finishEditing()
getEditorLayer()
and getEditorFeatureCollection()
.
If no editing operation is currently in progress, this method does nothing.
public void cancelEditing()
public void undoEditing(int count)
count
- count of operations made undonepublic void undoEditing()
public void undoAll()
public boolean isUndoPossible()
public void redoEditing(int count)
count
- count of redo operationspublic void redoEditing()
public boolean isRedoPossible()
protected void initUndoRedo()
editorFeatureCollection
and editorLayer
to completely
new instances.
title
- title for the new layerprotected void initEditorFeatureCollection(String title)
editorFeatureCollection
and editorLayer
to completely
new instances.
title
- title for the new layerprotected void initSegmentFeatureCollection()
FeatureCollection
used to handle the current
edited segment.
protected void generateSegmentFeatureCollection()
protected SimpleFeature createSegmentLineFeature()
Line-SimpleFeature
from the currently selected
segment points.
protected SimpleFeature createSegmentPointFeature()
MultiPoint-SimpleFeature
from the currently selected
segment points.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |