Prizm Content Connect
Class: LoadMarkupLayersRequest

Class: LoadMarkupLayersRequest

PCCViewer. LoadMarkupLayersRequest

(protected) new LoadMarkupLayersRequest(viewerControl, layerRecordIds)

The LoadMarkupLayersRequest object is created when loading markup layers using PCCViewer.ViewerControl#loadMarkupLayers.

The LoadMarkupLayersRequest is a thenable object, which allows Promise-like interactions. Calling the PCCViewer.LoadMarkupLayersRequest#then method will return a PCCViewer.Promise object. On successful layer loading, the Promise success method, if added, is called with the PCCViewer.LoadMarkupLayer objects created by the loaded layer records. On a load failure, the Promise is rejected.

The LoadMarkupLayersRequest object also provides an event subscription method, to get notified of other types of information. See PCCViewer.LoadMarkupLayersRequest.EventType.

Note: This constructor should not be used directly. Instead, a LoadMarkupLayersRequest is created by a call to PCCViewer.ViewerControl#loadMarkupLayers.

Parameters:
Name Type Description
viewerControl string

The PCCViewer.ViewerControl for the loaded document.

layerRecordIds Array.<string>

An array of layer record IDs.

Example
function onSuccessfulLoad(annotationLayers) {
   console.log(annotationLayers);
}

function onFailedConvert(error) {
  alert("Markup layer record loading failed, reason:" + (error.message ? error.message : error));
}

// A LoadMarkupLayersRequest object is created by and returned from the call to the ViewerControl#convertDocument method
var LoadMarkupLayersRequest = viewerControl.loadMarkupLayers(['abc123']);
LoadMarkupLayersRequest.then(onSuccessfulConvert, onFailedConvert);

//register some events
LoadMarkupLayersRequest
  .on(PCCViewer.LoadMarkupLayersRequest.EventType.LoadMarkupLayersCompleted,
      function(ev) {
          alert("Markup layer loading completed.");
      })
  .on(PCCViewer.LoadMarkupLayersRequest.EventType.LoadMarkupLayersProgress,
      function(event) {
          alert("Conversion progress: " + event.percent + "%");
      })
  .on(PCCViewer.LoadMarkupLayersRequest.EventType.LoadMarkupLayersFailed,
      function(event) {
          alert("Markup layer loading failed.");
      })
  .on(PCCViewer.LoadMarkupLayersRequest.EventType.LoadMarkupLayersCancelled,
      function(event) {
          alert("Markup layer loading was cancelled.");
      });

Members

(static, readonly) EventType :string

A list of events that can be triggered by the PCCViewer.LoadMarkupLayersRequest object.

Note: This enumeration is for convenience for API developers. Instead of using this enumeration, you can pass string values of the eventType (enumeration values)

Type:
  • string
Properties:
Name Type Description
LoadMarkupLayersFailed string
LoadMarkupLayersCompleted string
LoadMarkupLayersCancelled string
LoadMarkupLayersProgress string
See:

(readonly) errorCode :number

Gets the errorCode if there is a failure during load process.

This property is defined on all LoadMarkupLayersRequest objects.

This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods.

Type:
  • number
See:
Example
var errorCode = LoadMarkupLayersRequest.errorCode;

(readonly) progress :number

Gets the current estimate of the loading process progress.

This property is defined on all LoadMarkupLayersRequest objects.

This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods.

Type:
  • number
See:
Example
var percentProgress = LoadMarkupLayersRequest.progress;

(readonly) viewerControl :Object

Gets the viewer control associated with this request.

This property is defined on all LoadMarkupLayersRequest objects.

This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods.

Type:
  • Object
See:
Example
var viewerControl = LoadMarkupLayersRequest.viewerControl;

Methods

cancel() → {PCCViewer.LoadMarkupLayersRequest}

Cancels the load request. The PCCViewer.Promise object that is returned will be rejected. If the user cancels the operation, then a PCCViewer.Error object will be returned as the rejection reason and its code property will be set to UserCancelled.

Returns:

The cancelled request.

Type
PCCViewer.LoadMarkupLayersRequest
Example
var loadMarkupLayersRequest = viewerControl.loadMarkupLayers(['abc123']);
loadMarkupLayersRequest.cancel();

getErrorCode() → {string}

Gets the error code for the load request, in cases where the request has failed.

Returns:

A value for programmatic identification of an error condition, or null if an error has not occurred.

Type
string
Example
var loadMarkupLayersRequest = viewerControl.loadMarkupLayers(['abc123']);
var errorCode = loadMarkupLayersRequest.getErrorCode();

getProgress() → {number}

Gets the currently known loading progress value.

Returns:

A number between 0 and 100 (inclusive). A value of 100 means the loading process completed.

Type
number
Example
var loadMarkupLayersRequest = viewerControl.loadMarkupLayers(['abc123']);
var percent = loadMarkupLayersRequest.getProgress();

getViewerControl() → {PCCViewer.ViewerControl}

Gets the viewer control associated with this request.

Returns:

A viewer control object.

Type
PCCViewer.ViewerControl
Example
var loadMarkupLayersRequest = viewerControl.loadMarkupLayers(['abc123']);
var viewerControl = loadMarkupLayersRequest.getViewerControl();

off(eventType, handler) → {PCCViewer.LoadMarkupLayersRequest}

Unsubscribe an event handler from a specified event type.

Typically, an event is unsubscribed when you no longer want further notification of the event.

Parameters:
Name Type Description
eventType string

A string specifying the event type. See PCCViewer.LoadMarkupLayersRequest.EventType for a list and description of all supported events.

handler PCCViewer.Event~eventHandler

A function that was attached previously to the ViewerControl.

Note: This must be the same function object previously passed to PCCViewer.LoadMarkupLayersRequest#on. It cannot be a different object that is functionally equivalent.

See:
Returns:

The LoadMarkupLayersRequest object on which this method was called.

Type
PCCViewer.LoadMarkupLayersRequest

on(eventType, handler) → {PCCViewer.LoadMarkupLayersRequest}

Subscribe an event handler to an event of a specified type.

Parameters:
Name Type Description
eventType string

A string that specifies the event type. This value is case-insensitive. See PCCViewer.LoadMarkupLayersRequest.EventType for a list and description of all supported events.

handler PCCViewer.Event~eventHandler

A function that will be called whenever the event is triggered.

See:
Returns:

The LoadMarkupLayersRequest object on which this method was called.

Type
PCCViewer.LoadMarkupLayersRequest

 

 


©2015. Accusoft Corporation. All Rights Reserved.

Send Feedback