(protected) new LoadMarkupLayersRequest(layerRecordIds, viewerControl)
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.
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#loadMarkupLayers 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.");
});
Parameters:
Name | Type | Description |
---|---|---|
layerRecordIds |
Array.<string> |
An array of layer record IDs. |
viewerControl |
string |
The PCCViewer.ViewerControl for the loaded document. |
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 | Description |
---|---|
LoadMarkupLayersFailed : string |
|
LoadMarkupLayersCompleted : string |
|
LoadMarkupLayersCancelled : string |
|
LoadMarkupLayersProgress : string |
(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.
Example
var errorCode = LoadMarkupLayersRequest.errorCode;
Type:
- number
(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.
Example
var percentProgress = LoadMarkupLayersRequest.progress;
Type:
- number
(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.
Example
var viewerControl = LoadMarkupLayersRequest.viewerControl;
Type:
- Object
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.
Example
var loadMarkupLayersRequest = viewerControl.loadMarkupLayers(['abc123']);
loadMarkupLayersRequest.cancel();
Returns:
The cancelled request.
getErrorCode() → {string}
Gets the error code for the load request, in cases where the request has failed.
Example
var loadMarkupLayersRequest = viewerControl.loadMarkupLayers(['abc123']);
var errorCode = loadMarkupLayersRequest.getErrorCode();
Returns:
A value for programmatic identification of an error condition, or null if an error has not occurred.
- Type
- string
getProgress() → {number}
Gets the currently known loading progress value.
Example
var loadMarkupLayersRequest = viewerControl.loadMarkupLayers(['abc123']);
var percent = loadMarkupLayersRequest.getProgress();
Returns:
A number between 0 and 100 (inclusive). A value of 100 means the loading process completed.
- Type
- number
getViewerControl() → {PCCViewer.ViewerControl}
Gets the viewer control associated with this request.
Example
var loadMarkupLayersRequest = viewerControl.loadMarkupLayers(['abc123']);
var viewerControl = loadMarkupLayersRequest.getViewerControl();
Returns:
A viewer control object.
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 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:
-
- PCCViewer.LoadMarkupLayersRequest#on
- PCCViewer.ViewerControl#off for more details on unsubscribing event handlers.
Returns:
The LoadMarkupLayersRequest
object on which this method was called.
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:
-
- PCCViewer.LoadMarkupLayersRequest#off
- PCCViewer.ViewerControl#on for more details on event subscription.
Returns:
The LoadMarkupLayersRequest
object on which this method was called.