org.openstreetmap.josm.actions
Class PasteTagsAction.TagPaster

java.lang.Object
  extended by org.openstreetmap.josm.actions.PasteTagsAction.TagPaster
Enclosing class:
PasteTagsAction

public static class PasteTagsAction.TagPaster
extends java.lang.Object


Field Summary
private  java.util.List<Tag> commands
           
private  java.util.Collection<PrimitiveData> source
           
private  java.util.Collection<OsmPrimitive> target
           
 
Constructor Summary
PasteTagsAction.TagPaster(java.util.Collection<PrimitiveData> source, java.util.Collection<OsmPrimitive> target)
           
 
Method Summary
protected  void buildChangeCommand(java.util.Collection<? extends OsmPrimitive> selection, TagCollection tc)
           
protected  boolean canPasteFromHeterogeneousSourceWithoutConflict(java.util.Collection<OsmPrimitive> targets)
          Replies true if this a heterogeneous source can be pasted without conflict to targets
 java.util.List<Tag> execute()
           
protected
<T extends PrimitiveData>
java.util.Collection<? extends PrimitiveData>
getSourcePrimitivesByType(OsmPrimitiveType type)
          Replies all primitives of type type in the current selection.
protected  java.util.Map<OsmPrimitiveType,java.lang.Integer> getSourceStatistics()
           
protected
<T extends OsmPrimitive>
TagCollection
getSourceTagsByType(OsmPrimitiveType type)
          Replies the collection of tags for all primitives of type type in the current selection
protected  java.util.Map<OsmPrimitiveType,java.lang.Integer> getTargetStatistics()
           
protected
<T extends OsmPrimitive>
boolean
hasSourceTagsByType(OsmPrimitiveType type)
          Replies true if there is at least one tag in the current selection for primitives of type type
protected
<T extends OsmPrimitive>
boolean
hasTargetPrimitives(java.lang.Class<T> type)
          Replies true if there is at least one primitive of type type is in the target collection
protected  boolean isHeteogeneousSource()
          Replies true if the source for tag pasting is heterogeneous, i.e.
protected  void pasteFromHeterogeneousSource()
          Pastes the tags in the current selection of the paste buffer to a set of target primitives.
protected  void pasteFromHomogeneousSource()
          Pastes the tags from a homogeneous source (the Main.pasteBuffers selection consisting of one type of OsmPrimitives only).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

private final java.util.Collection<PrimitiveData> source

target

private final java.util.Collection<OsmPrimitive> target

commands

private final java.util.List<Tag> commands
Constructor Detail

PasteTagsAction.TagPaster

public PasteTagsAction.TagPaster(java.util.Collection<PrimitiveData> source,
                                 java.util.Collection<OsmPrimitive> target)
Method Detail

isHeteogeneousSource

protected boolean isHeteogeneousSource()
Replies true if the source for tag pasting is heterogeneous, i.e. if it doesn't consist of OsmPrimitives of exactly one type


getSourcePrimitivesByType

protected <T extends PrimitiveData> java.util.Collection<? extends PrimitiveData> getSourcePrimitivesByType(OsmPrimitiveType type)
Replies all primitives of type type in the current selection.

Type Parameters:
T -
Parameters:
type - the type
Returns:
all primitives of type type in the current selection.

getSourceTagsByType

protected <T extends OsmPrimitive> TagCollection getSourceTagsByType(OsmPrimitiveType type)
Replies the collection of tags for all primitives of type type in the current selection

Type Parameters:
T -
Parameters:
type - the type
Returns:
the collection of tags for all primitives of type type in the current selection

hasSourceTagsByType

protected <T extends OsmPrimitive> boolean hasSourceTagsByType(OsmPrimitiveType type)
Replies true if there is at least one tag in the current selection for primitives of type type

Type Parameters:
T -
Parameters:
type - the type
Returns:
true if there is at least one tag in the current selection for primitives of type type

buildChangeCommand

protected void buildChangeCommand(java.util.Collection<? extends OsmPrimitive> selection,
                                  TagCollection tc)

getSourceStatistics

protected java.util.Map<OsmPrimitiveType,java.lang.Integer> getSourceStatistics()

getTargetStatistics

protected java.util.Map<OsmPrimitiveType,java.lang.Integer> getTargetStatistics()

pasteFromHomogeneousSource

protected void pasteFromHomogeneousSource()
Pastes the tags from a homogeneous source (the Main.pasteBuffers selection consisting of one type of OsmPrimitives only). Tags from a homogeneous source can be pasted to a heterogeneous target. All target primitives, regardless of their type, receive the same tags.


hasTargetPrimitives

protected <T extends OsmPrimitive> boolean hasTargetPrimitives(java.lang.Class<T> type)
Replies true if there is at least one primitive of type type is in the target collection

Type Parameters:
T -
Parameters:
type - the type to look for
Returns:
true if there is at least one primitive of type type in the collection selection

canPasteFromHeterogeneousSourceWithoutConflict

protected boolean canPasteFromHeterogeneousSourceWithoutConflict(java.util.Collection<OsmPrimitive> targets)
Replies true if this a heterogeneous source can be pasted without conflict to targets

Parameters:
targets - the collection of target primitives
Returns:
true if this a heterogeneous source can be pasted without conflicts to targets

pasteFromHeterogeneousSource

protected void pasteFromHeterogeneousSource()
Pastes the tags in the current selection of the paste buffer to a set of target primitives.


execute

public java.util.List<Tag> execute()


JOSM