Resource Base
Table of contents

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_ID
  • DBR_LAYER_ID
  • DLR_LAYER_ID
  • USER_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 DrawingLayer will be visible
  • false: The DrawingLayer will be invisible.

Code Snippet

drawingLayer.setVisible(true);

 

isVisible

Get the visibility of the DrawingLayer.

public boolean isVisible();

Return Value

  • true: The DrawingLayer is visible.
  • false: The DrawingLayer is invisible.

Code Snippet

boolean visible = drawingLayer.isVisible();

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

version 3.0.3

  • Latest version
  • Version 4.x
    • Version 4.2.0
    • Version 4.0.2
    • Version 4.0.1
    • Version 4.0.0
  • Version 3.x
    • Version 3.0.3
    • Version 3.0.2
    • Version 3.0.1
    • Version 3.0.0
  • Version 2.x
    • Version 2.3.21
    • Version 2.3.20
    • Version 2.3.12
    • Version 2.3.11
    • Version 2.3.10
    • Version 2.3.5
    • Version 2.3.4
    • Version 2.3.3
    • Version 2.3.2
    • Version 2.3.1
    • Version 2.3.0
    • Version 2.1.4
    • Version 2.1.3
    • Version 2.1.1
    • Version 2.0.0
Change +