DCEDrawingLayer Class
A DCEDrawingLayer is the layer that contains and displays DrawingItems. Users can add configurations for the DrawingItems via DCEDrawingLayer
class com.dynamsoft.dce.DCEDrawingLayer
| Method Name | Description |
|---|---|
DCEDrawingLayer |
The constructor of the DCEDrawingLayer class. |
getId |
Get the DrawingLayer ID of the DrawingLayer. |
addDrawingItems |
Add a list of DrawingItems to the DrawingLayer. These DrawingItems will be appended to the drawing item list of the current DrawingLayer. |
setDrawingItems |
Set a list of DrawingItems to the DrawingLayer. These DrawingItems will replace the previous DrawingItems of the current DrawingLayer. |
getDrawingItems |
Get all available DrawingItems in the DrawingLayer. |
clearDrawingItems |
Clear all available DrawingItems in the DrawingLayer. |
setDrawingStyleId(styleId) |
Specify a style ID for all available DrawingItems. |
setDrawingStyleId(styleId,state) |
Specify a style ID for the targeting DrawingItems. |
setDrawingStyleId(styleId,state,mediaType) |
Specify a style ID for the targeting DrawingItems. |
setVisible |
Set the visibility of the DrawingLayer. |
isVisible |
Get the visibility of the DrawingLayer. |
DCEDrawingLayer
The constructor of the DCEDrawingLayer class.
public DCEDrawingLayer(int id);
Parameters
id: Indicate the ID of the DrawingLayer.
Remarks
Please initialize the DrawingLayers via the following methods:
getId
Get the ID of the DrawingLayer.
public int getId();
Return Value
The id of the DrawingLayer. It can be one of the following:
DDN_LAYER_IDDBR_LAYER_IDDLR_LAYER_IDUSER_DEFINED_LAYER_BASE_ID
Code Snippet
DCEDrawingLayer drawingLayer = dceImageEditorView.createDrawingLayer();
int id = drawingLayer.getId();
addDrawingItems
Add a list of DrawingItems to the DrawingLayer. These DrawingItems will be appended to the drawing item list of the current DrawingLayer.
public void addDrawingItems(Arraylist<DrawingItem> items);
Parameters
items: A list of DrawingItems.
Code Snippet
ArrayList<DrawingItem> drawingItems = new ArrayList<DrawingItem>();
drawingItems.add(drawingItem_1);
drawingItems.add(drawingItem_2);
drawingItems.add(drawingItem_3);
drawingLayer.addDrawingItems(drawingItems);
setDrawingItems
Set a list of DrawingItems to the DrawingLayer. These DrawingItems will replace the previous DrawingItems of the current DrawingLayer.
public void setDrawingItems(Arraylist<DrawingItem> items);
Parameters
items: A list of DrawingItems.
Code Snippet
ArrayList<DrawingItem> drawingItems = new ArrayList<DrawingItem>();
drawingItems.add(drawingItem_1);
drawingItems.add(drawingItem_2);
drawingItems.add(drawingItem_3);
drawingLayer.setDrawingItems(drawingItems);
getDrawingItems
Get all available DrawingItems in the DrawingLayer.
public Arraylist<DrawingItem> getDrawingItems();
Return Value
A list that includes all available DrawingItems.
Code Snippet
ArrayList<DrawingItem> drawingItems = dceDrawingLayer.getDrawingItems();
clearDrawingItems
Clear all available DrawingItems in the DrawingLayer.
public void clearDrawingItems();
Code Snippet
drawingLayer.clearDrawingItems();
setDrawingStyleId(styleId)
Specify a style ID for all available DrawingItems.
public void setDrawingStyleId(int styleId);
Parameters
id: The style ID.
Code Snippet
drawingLayer.setDrawingStyleId(0);
setDrawingStyleId(styleId,state)
Specify a style ID for the targeting DrawingItems. The stateis a filter of the DrawingItems. All the eligible DrawingItems will be changed to the input style.
public void setDrawingStyleId(int styleId, EnumDrawingItemState state);
Parameters
id: The style ID.
state: The state of the DrawingItem.
Code Snippet
drawingLayer.setDrawingStyleId(0, EnumDrawingItemState.DIS_SELECTED);
setDrawingStyleId(styleId,state,mediaType)
Specify a style ID for the targeting DrawingItems. The state and mediaType are filters of the DrawingItems. All the eligible DrawingItems will be changed to the input style.
public void setDrawingStyleId(int styleId, EnumDrawingItemState state, EnumDrawingItemMediaType mediaTypes);
Parameters
id: The style ID.
state: The state of the DrawingItem.
mediaType: The media type of the DrawingItem.
Code Snippet
drawingLayer.setDrawingStyleId(0, EnumDrawingItemState.DIS_SELECTED, EnumDrawingItemMediaType.DIMT_RECTANGLE);
setVisible
Set the visibility of the DrawingLayer.
public void setVisible(boolean visible);
Parameters
visible:
- true: The
DrawingLayerwill be visible - false: The
DrawingLayerwill be invisible.
Code Snippet
drawingLayer.setVisible(true);
isVisible
Get the visibility of the DrawingLayer.
public boolean isVisible();
Return Value
- true: The
DrawingLayeris visible. - false: The
DrawingLayeris invisible.
Code Snippet
boolean visible = drawingLayer.isVisible();