Class: ImageReviewControl

ImageReviewControl()

new ImageReviewControl()

This ImageReviewEditViewControl class is responsible for handling the corresponding plugin js to interact with the native ImageCaptureControl class. To set and get the properties, and to access the instance methods, corresponding JS methods are written under this class which are used by the end user in application script.

Methods

addImageReviewEditView(successCallback, errorCallback, layoutObject)

This method is to create and show the "KfxKUIImageReviewEditControl" object on the web view. This would create a "KfxKUIImageReviewEditControl" object in the native and will add the object to the web view.
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
layoutObject Object a 'Layout' object mentioning the Frame values for the ImageCaptureControl object. Refer to 'Layout' object for containing values.
Properties
Name Type Attributes Description
x Number <optional>
x position of the image review control
y Number <optional>
y position of the image review control
width Number <optional>
width of the image review control
height Number <optional>
height of the image review control
visibility Boolean <optional>
image review control is visible or not
See:
  • Check the 'errorCallback' method for any failures in case of unexpected behaviour of the method. Generally the error call back would return a JSON object with ErrorMsg & ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back. errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception.
Example
var Layout = kfxCordova.getLayoutProperties();
Layout.x = 10;
Layout.y =10;
Layout.width= 300;
Layout.height = 400;
Layout.visibility = true; // By default visibility is 'true'
function successCallback(result){
   alert(JSON.stringify(result));
}
function errorCallback(error){
   alert(JSON.stringify(error));
}
var imgReviewControl =  kfxCordova.kfxUicontrols.createImageReviewControl();
imgReviewControl.addImageReviewEditView(successCallback,errorCallback, Layout);

clearHighlights(successCallback, errorCallback)

Clears all the areas highlighted by the method showHighlights. This method would clear all the rectangles previously highlighted by the method showHighlights
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
Example
function successCallback(result){
   alert(JSON.stringify(result));
}
function errorCallback(error){
   alert(JSON.stringify(error));
}
var imgReviewControl =  kfxCordova.kfxUicontrols.createImageReviewControl();
imgReviewControl.clearHighlights(successCallback,errorCallback);

clearImage(successCallback, errorCallback)

Method to Clear the image object out of review control
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
Example
function successCallback(result){
   alert(JSON.stringify(result));
}
function errorCallback(error){
   alert(JSON.stringify(error));
}
var imgReviewControl =  kfxCordova.kfxUicontrols.createImageReviewControl();
imgReviewControl.clearImage(successCallback,errorCallback);

getImage(successCallback, errorCallback)

This method would get the imageid of the KEDImage set for review. As the native SDK(for ios) do not provide any method to get the already set image, it is necessary to store the id of the image for reference. This method would return the store imageid.
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
function successCallback(result){
   alert(JSON.stringify(result));
}
function errorCallback(error){
   alert(JSON.stringify(error));
}
var imgReviewControl =  kfxCordova.kfxUicontrols.createImageReviewControl();
imgReviewControl.getImage(successCallback,errorCallback);

getImageReviewEditViewOptions()

Method returning the 'ImageReviewEditControl' class properties that can be set by the user. Use this object as an input parameter to set the properties of the ImageReviewEditControl class. The parameters are grouped, and has the below mentioned default values.
Example
var imgReviewControl =  kfxCordova.kfxUicontrols.createImageReviewControl();
var imageReviewOptions = imgReviewControl.getImageReviewEditViewOptions();
imageReviewOptions should be like below {
       Tetragon : {
           show : true,
           TopLeft :{
               x : 0,
               y : 0
           },
           TopRight :{
               x : 0,
               y : 0
           },
           BottomLeft : {
               x : 0,
               y : 0
           },
           BottomRight : {
               x : 0,
               y : 0
           }
       },
       Crop :{
           lineColor : "#AABBCCDD",
           cornerColor : "#AABBCCDD",
           lineStyle : "LINE_STYLE_SOLID",
       }
   };

getOptions(successCallback, errorCallback)

Method to get the properties of the native ImageReviewEditControl class.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
See:
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - JSONObject representing ImageReviewControl Options. JSONObject structure can also be known from getImageReviewEditViewOptions() method. errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,JSONException & Exception.
Example
function successCallback(result){
   alert(JSON.stringify(result));
}
function errorCallback(error){
   alert(JSON.stringify(error));
}
var imgReviewControl =  kfxCordova.kfxUicontrols.createImageReviewControl();
imgReviewControl.getOptions(successCallback,errorCallback);

removeView(successCallback, errorCallback)

Method to remove the ImageReviewEditControl view off the screen. This method is responsible for removing and making it nil.
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
See:
  • Check the 'errorCB' method for any failures in case of unexpected behaviour of the method. Generally the error call back would return a JSON object with ErrorMsg & ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
function successCallback(result){
   alert(JSON.stringify(result));
}
function errorCallback(error){
   alert(JSON.stringify(error));
}
var imgReviewControl =  kfxCordova.kfxUicontrols.createImageReviewControl();
imgReviewControl.removeView(successCallback,errorCallback);

setImage(successCallback, errorCallback, imageID)

This method call is used to load the image object to be reviewed. It also calculates a default crop rectangle (tetragon) based on the size and layout of the imageObjectToReview. If you want to override the default crop rectangle, change the cropTetragon property prior to calling showCropRectangle. This method will not succeed if a valid image processing license is not set.
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
imageID String an imageID(string) in the imagearray class, to be set for review
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are KMC_IP_LICENSE_INVALID: no license found, KMC_IP_NO_REPRESENTATION: not bitmap or file based, or buffered image, KmcRuntimeException,Exception.
Example
function successCallback(result){
   alert(JSON.stringify(result));
}
function errorCallback(error){
   alert(JSON.stringify(error));
}
var imageid = 'imageid of the kedImage image from ImageArray class';
var imgReviewControl =  kfxCordova.kfxUicontrols.createImageReviewControl();
imgReviewControl.setImage(successCallback,errorCallback,imageid);

setOptions(successCallback, errorCallback, imageReviewEditViewOptions)

Method to set the properties of the native ImageReviewEditControl class.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
imageReviewEditViewOptions Object It is containing the properties to be set to the ImageReviewEditControl
Properties
Name Type Description
Tetragon Object The crop tetragon specified during edit operations.Developer can set the tetragon coordinates to initialize the control before displaying bounding tetragon (crop rectangle), or allow the control to set it to a default. The library returns this crop tetragon while edit is in progress. After the user closes the view, this object contains the users final corner points after editing is complete.
Properties
Name Type Attributes Default Description
show Boolean <optional>
true Whether to show tetragon.A boolean that indicates whether the level indicator is enabled.
TopLeft Object Represents the coordinates of the top left corner.
Properties
Name Type Attributes Default Description
x Number <optional>
0 Top left x coordinate of the tetragon point in pixels.It is less than or greater than the bottom right x coordinate.To avoid fractions, The library converts to whole integers in use.
y Number <optional>
0 Top left y coordinate of the tetragon point in pixels.
TopRight Object Represents the coordinates of the top right corner.
Properties
Name Type Attributes Default Description
x Number <optional>
0 Top right x coordinate of the tetragon point in pixels.It is always be greater than top left x coordinate. To avoid fractions, The library converts to whole integers in use.
y Number <optional>
0 Top right y coordinate of the tetragon point in pixels.
BottomLeft Object Represents the coordinates of the bottom left corner.
Properties
Name Type Attributes Default Description
x Number <optional>
0 Bottom left x coordinate of the tetragon point in pixels.It is always be less than the bottom right x coordinate.To avoid fractions, The library converts to whole integers in use.
y Number <optional>
0 Bottom left y coordinate of the tetragon point in pixels.
BottomRight Object Represents the coordinates of the bottom right corner.
Properties
Name Type Attributes Default Description
x Number <optional>
0 Bottom right x coordinate of the tetragon point in pixels.It is always be greater than the bottom left x coordinate.To avoid fractions, The library converts to whole integers in use.
y Number <optional>
0 Bottom right y coordinate of the tetragon point in pixels.
Crop Object Represents the behavior of cropping tetragon
Properties
Name Type Attributes Default Description
lineColor String <optional>
"#AABBCCDD" Color of lines in cropping rectangle/tetragon.
cornerColor String <optional>
"#AABBCCDD" Color of corner handles (circles) in cropping rectangle/tetragon.
lineStyle String <optional>
"LINE_STYLE_SOLID" Crop rectangle lines should be solid or dashed. Acceptable parameters are "LINE_STYLE_SOLID" or "LINE_STYLE_DOTTED".
See:
  • Check the 'errorCallback' method for any failures in case of unexpected behaviour of the method. Generally the error call back would return a JSON object with ErrorMsg & ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception.
Example
var imgReviewControl =  kfxCordova.kfxUicontrols.createImageReviewControl();
var  imageReviewEditViewOptions =  imgReviewControl.getImageReviewEditViewOptions();
var point1 = kfxCordova.getPointProperties();
point1.x = 10; point1.y=10;
var point2 = kfxCordova.getPointProperties();
point2.x=20; point2.y=200;
var point3 = kfxCordova.getPointProperties();
point3.x=200; point3.y=20;
var point4 = kfxCordova.getPointProperties();
point4.x=250; point4.y=320;

imageReviewEditViewOptions.Tetragon.TopLeft=point1;
imageReviewEditViewOptions.Tetragon.TopRight=point2;
imageReviewEditViewOptions.Tetragon.BottomLeft=point3;
imageReviewEditViewOptions.Tetragon.BottomRight=point4;

imageReviewEditViewOptions.Crop.lineColor = 'hexvalueof a color';
imageReviewEditViewOptions.Crop.cornerColor= 'hex value of a color';
imageReviewEditViewOptions.Crop.lineStyle= kfxCordova.LineStyle.SOLID;

function successCallback(result){
   alert(JSON.stringify(result));
}
function errorCallback(error){
   alert(JSON.stringify(error));
}
imgReviewControl.setOptions(successCallback,errorCallback,imageReviewEditViewOptions)

showHighlights(successCallback, errorCallback, parameters)

Highlights all the rectangles in the array with the value set for highlightColor. setImage method needs to be called before calling this method. Input parameter is an array of bounding rectangle objects which needs to be highlighted
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
parameters Array Parameters contain array of BoundingRectangle objects which need to be highlighted.
See:
  • you can understand how to pass parameters by go through the below example
Example
Parameters consists of array of bounding rectangles which need to be highlighted.
var parameters=[{
                "left": 635,
                "top": 418,
                "height": 19,
                "width": 786
                },
                {
                "left": 304,
                "top": 418,
                "height": 19,
                "width": 786
                },
                {
                "left": 304,
                "top": 213,
                "height": 24,
                "width": 786
                }];
function successCallback(result){
   alert(JSON.stringify(result));
}
function errorCallback(error){
   alert(JSON.stringify(error));
}
var imgReviewControl =  kfxCordova.kfxUicontrols.createImageReviewControl();
imgReviewControl.showHighlights(successCallback,errorCallback,parameters);