Package cz.vutbr.fit.layout.segm.op
Class FindLineOperator
- java.lang.Object
-
- cz.vutbr.fit.layout.impl.BaseService
-
- cz.vutbr.fit.layout.impl.BaseParametrizedOperation
-
- cz.vutbr.fit.layout.impl.BaseOperator
-
- cz.vutbr.fit.layout.segm.op.FindLineOperator
-
- All Implemented Interfaces:
AreaTreeOperator
,ParametrizedOperation
,Service
public class FindLineOperator extends BaseOperator
Detects the basic lines in the area tree and joins the appropriate areas so that a line is the smallest visual area.- Author:
- burgetr
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
flattenLines
Remove the sub-areas?static String
LINE_NEXT
Area attribute key for storing the next area on linestatic String
LINE_PREV
Area attribute key for storing the previous area on lineprotected float
maxLineEmSpace
The maximal distance of two areas allowed within a single line (in 'em' units)protected boolean
useConsistentStyle
Should the lines have a consistent visual style?
-
Constructor Summary
Constructors Constructor Description FindLineOperator()
FindLineOperator(boolean flattenLines, boolean useConsistentStyle, float maxLineEmSpace)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(AreaTree atree)
Applies the operation to the given tree.void
apply(AreaTree atree, Area root)
Applies the operation to the given subtree of the tree.List<Parameter>
defineParams()
Creates the parameter definition for this operation.String
getCategory()
A category that allows to group similar services.String
getDescription()
Obtains a longer description of the service.boolean
getFlattenLines()
String
getId()
Obtains a unique ID of the servicefloat
getMaxLineEmSpace()
String
getName()
Obtains a descriptive name of the service that may be presented to the user.boolean
getUseConsistentStyle()
protected boolean
joinAreas(Area a)
Goes through the grid of areas and joins the adjacent visual areas that are not separated by anything.protected boolean
recursiveJoinAreas(Area root)
Goes through all the areas in the tree and tries to join their sub-areas into single areas.void
setFlattenLines(boolean flattenLines)
void
setMaxLineEmSpace(float maxLineEmSpace)
void
setUseConsistentStyle(boolean useConsistentStyle)
-
Methods inherited from class cz.vutbr.fit.layout.impl.BaseOperator
toString
-
Methods inherited from class cz.vutbr.fit.layout.impl.BaseParametrizedOperation
getParam, getParams, getParamString, setParam
-
Methods inherited from class cz.vutbr.fit.layout.impl.BaseService
getServiceManager, setServiceManager
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface cz.vutbr.fit.layout.api.ParametrizedOperation
getParam, getParams, getParamString, setParam
-
Methods inherited from interface cz.vutbr.fit.layout.api.Service
setServiceManager
-
-
-
-
Field Detail
-
LINE_NEXT
public static final String LINE_NEXT
Area attribute key for storing the next area on line- See Also:
- Constant Field Values
-
LINE_PREV
public static final String LINE_PREV
Area attribute key for storing the previous area on line- See Also:
- Constant Field Values
-
flattenLines
protected boolean flattenLines
Remove the sub-areas?
-
useConsistentStyle
protected boolean useConsistentStyle
Should the lines have a consistent visual style?
-
maxLineEmSpace
protected float maxLineEmSpace
The maximal distance of two areas allowed within a single line (in 'em' units)
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:Service
Obtains a unique ID of the service
-
getName
public String getName()
Description copied from interface:Service
Obtains a descriptive name of the service that may be presented to the user.- Returns:
- the operator name
-
getDescription
public String getDescription()
Description copied from interface:Service
Obtains a longer description of the service.- Returns:
- the description
-
getCategory
public String getCategory()
Description copied from interface:Service
A category that allows to group similar services.- Returns:
- Category name or
null
when no category is assigned.
-
defineParams
public List<Parameter> defineParams()
Description copied from class:BaseParametrizedOperation
Creates the parameter definition for this operation.- Overrides:
defineParams
in classBaseParametrizedOperation
- Returns:
- The list of parameters.
-
getFlattenLines
public boolean getFlattenLines()
-
setFlattenLines
public void setFlattenLines(boolean flattenLines)
-
getUseConsistentStyle
public boolean getUseConsistentStyle()
-
setUseConsistentStyle
public void setUseConsistentStyle(boolean useConsistentStyle)
-
getMaxLineEmSpace
public float getMaxLineEmSpace()
-
setMaxLineEmSpace
public void setMaxLineEmSpace(float maxLineEmSpace)
-
apply
public void apply(AreaTree atree)
Description copied from interface:AreaTreeOperator
Applies the operation to the given tree.- Parameters:
atree
- the area tree to be modified.
-
apply
public void apply(AreaTree atree, Area root)
Description copied from interface:AreaTreeOperator
Applies the operation to the given subtree of the tree.- Parameters:
atree
- the area tree to be modified.root
- the root node of the affected subtree.
-
recursiveJoinAreas
protected boolean recursiveJoinAreas(Area root)
Goes through all the areas in the tree and tries to join their sub-areas into single areas.- Parameters:
root
- The root area to process recursively.- Returns:
true
when entirely succeeded for the subtree,false
when at least some areas could not be joined.
-
joinAreas
protected boolean joinAreas(Area a)
Goes through the grid of areas and joins the adjacent visual areas that are not separated by anything.- Parameters:
a
- The root area to process.- Returns:
true
when entirely succeeded,false
when at least some areas could not be joined.
-
-