Skip to main content

Shape Drawing Events

ShapeDrawingStarted

Description

The ShapeDrawingStarted event is triggered when a user begins drawing a shape on a map using the Maptaskr Portal App. This event provides information about the shape being drawn, including its name, and starting latitude and longitude coordinates.

Usage

You can listen for the ShapeDrawingStarted event by using the on method of the window['maptaskrPCF'] object. Once you've registered an event listener, it will execute a call-back function whenever the event is triggered.

Example

window['maptaskrPCF'].on("ShapeDrawingStarted", function(shapeName, startLat, startLng) {

console.log("shapeName: " + shapeName);

console.log("startLat: " + startLat);

console.log("startLng: " + startLng);

});

In the example above, we have registered an event listener for the ShapeDrawingStarted event. When the event occurs, the provided call-back function is executed, logging the shape's name, starting latitude, and starting longitude to the console.

Parameters

  • shapeName (string): The name or identifier of the shape being drawn.
  • startLat (number): The latitude coordinate where the shape drawing started.
  • startLng (number): The longitude coordinate where the shape drawing started.

Removing Event Listeners

You can remove the event listener for the ShapeDrawingStarted event using the off method of the window['maptaskrPCF'] object. This is useful when you no longer want to listen for the event.

Example

window['maptaskrPCF'].off("ShapeDrawingStarted");

In the example above, the event listener for ShapeDrawingStarted is removed and will no longer execute the associated call-back function when the event occurs.

ShapeDrawingCompleted

Description

The ShapeDrawingCompleted event is triggered when a user finishes drawing a shape on a map using the Maptaskr for Power Pages App. This event provides information about the completed shape, including its name, finishing latitude, finishing longitude, and a polygon representation if applicable.

Usage

To listen for the ShapeDrawingCompleted event, you can use the on method of the window['maptaskrPCF'] object. This allows you to register an event listener that executes a call-back function when the event is triggered.

Example

window['maptaskrPCF'].on("ShapeDrawingCompleted", function(shapeName, finishLat, finishLong, polygon) {

console.log("shapeName: " + shapeName);

console.log("finishLat: " + finishLat);

console.log("finishLong: " + finishLong);

console.log("polygon: " + polygon);

});

In the example above, we've registered an event listener for the ShapeDrawingCompleted event. When the event occurs, the provided call-back function is executed, logging the shape's name, finishing latitude, finishing longitude, and the polygon representation (if available) to the console.

Parameters

  • shapeName (string): The name or identifier of the completed shape.
  • finishLat (number): The latitude coordinate where the shape drawing was completed.
  • finishLong (number): The longitude coordinate where the shape drawing was completed.
  • polygon (object): A polygon representation of the completed shape, if applicable.

Response Example

The polygon returned will be a JavaScript Object in the format provided below (with some properties excluded for brevity)

{

"extent": "13763753.343080917,-2640076.057267837,14225172.048240524,-1900449.0151737626",

"geometry": {

"geometry":
"13790895.619855013,-1920805.7227543334,13763753.343080917,-2640076.057267837,14225172.048240524,-2592577.0729131717,14191244.202272907,-1900449.0151737626,13790895.619855013,-1920805.7227543334",

"type": "Polygon"

},

"shapeSize": "Property Boundary Area: 268089470174.40 m²",

"attributes": {

"ShapeSize": "Property Boundary Area: 268089470174.40 m²"

}

}

Removing Event Listeners

To remove the event listener for the ShapeDrawingCompleted event, you can use the off method of the window['maptaskrPCF'] object. This is useful when you no longer want to listen to this specific event.

Example

window['maptaskrPCF'].off("ShapeDrawingCompleted");

In the example above, the event listener for ShapeDrawingCompleted is removed, ensuring that the associated call-back function no longer executes when the event is triggered.

ShapeDrawingCancelled

Description

The ShapeDrawingCancelled event is triggered when a user cancels the drawing of a shape on a map using the Maptaskr for Power Pages App. This event provides information about the cancelled shape, including its name.

Usage

To listen for the ShapeDrawingCancelled event, you can use the on method of the window['maptaskrPCF'] object. This allows you to register an event listener that executes a call-back function when the event is triggered.

Example

window['maptaskrPCF'].on("ShapeDrawingCancelled", function(shapeName) {

console.log("shapeName: " + shapeName);

});

In the example above, we've registered an event listener for the ShapeDrawingCancelled event. When the event occurs, the provided call-back function is executed, logging the name of the cancelled shape to the console.

Parameters

  • shapeName (string): The name or identifier of the cancelled shape.

Removing Event Listeners

To remove the event listener for the ShapeDrawingCancelled event, you can use the off method of the window['maptaskrPCF'] object. This is useful when you no longer want to listen for this specific event.

Example

window['maptaskrPCF'].off("ShapeDrawingCancelled");

In the example above, the event listener for ShapeDrawingCancelled is removed, ensuring that the associated call-back function no longer executes when the event is triggered.

ShapeDrawingModified

Description

The ShapeDrawingModified event is triggered when a previously drawn shape is modified within the map application using the Maptaskr for Power Pages App. This event provides information about the modified shape's name and its updated polygon geometry.

Usage

To listen for the ShapeDrawingModified event, you can use the on method of the window['maptaskrPCF'] object. This allows you to register an event listener that executes a call-back function when the event is triggered.

Example

window['maptaskrPCF'].on("ShapeDrawingModified", function(shapeName, polygon) {

console.log("shapeName: " + shapeName);

console.log("polygon: " + polygon);

});

In the example above, we've registered an event listener for the ShapeDrawingModified event. When the event occurs, the provided call-back function is executed, logging the name of the modified shape and its updated polygon geometry to the console.

Parameters

  • shapeName (string): The name of the modified shape.
  • polygon (string): The updated polygon geometry of the modified shape.

Response Example

The polygon returned will be a JavaScript Object in the format provided below (with some properties excluded for brevity)

{
"extent": "13763753.343080917,-2640076.057267837,14253251.517202944,-1920805.7227543334",
"geometry": {
"geometry": "13790895.619855013,-1920805.7227543334,13763753.343080917,-2640076.057267837,14225172.048240524,-2592577.0729131717,14253251.517202944,-2070504.77487333,13790895.619855013,-1920805.7227543334",
"type": "Polygon"
},
"shapeSize": "Property Boundary Area: 252970372397.52 m²",
"attributes": {
"ShapeSize": "Property Boundary Area: 252970372397.52 m²",
"UPLOAD_DOCUMENT_TYPE": "Property Boundary",
"DYNAMIC_STOKE_COLOR": {
"strokeColour": "#2ab01e12",
"fillColour": "#2ab01e80",
"solidFill": true,
"dashedStroke": false
},
"OldGeometry": [
[
[
13790895.619855013,
-1920805.7227543334
],
[
13763753.343080917,
-2640076.057267837
],
[
14225172.048240524,
-2592577.0729131717
],
[
14191244.202272907,
-1900449.0151737626
],
[
13790895.619855013,
-1920805.7227543334
]
]
]
}
}

Removing Event Listeners

To remove the event listener for the ShapeDrawingModified event, you can use the off method of the window['maptaskrPCF'] object. This is useful when you no longer want to listen to this specific event.

Example

window['maptaskrPCF'].off("ShapeDrawingModified");

In the example above, the event listener for ShapeDrawingModified is removed, ensuring that the associated call-back function no longer executes when the event is triggered.

ShapeDrawingDeleted

Description

The ShapeDrawingDeleted event is triggered when a user deletes a previously drawn shape on a map using the Maptaskr for Power Pages App. This event provides information about the deleted shape, including its name.

Usage

To listen for the ShapeDrawingDeleted event, you can use the on method of the window['maptaskrPCF'] object. This allows you to register an event listener that executes a call-back function when the event is triggered.

Example

window['maptaskrPCF'].on("ShapeDrawingDeleted", function(shapeName) {

console.log("shapeName: " + shapeName);

});

In the example above, we've registered an event listener for the ShapeDrawingDeleted event. When the event occurs, the provided call-back function is executed, logging the name of the deleted shape to the console.

Parameters

  • shapeName (string): The name or identifier of the deleted shape.

Removing Event Listeners

To remove the event listener for the ### ShapeDrawingDeleted event, you can use the off method of the window['maptaskrPCF'] object. This is useful when you no longer want to listen for this specific event.

Example

window['maptaskrPCF'].off("ShapeDrawingDeleted");

In the example above, the event listener for ShapeDrawingDeleted is removed, ensuring that the associated call-back function no longer executes when the event is triggered.

ShapeDrawingFileSelected

Description

The ShapeDrawingFileSelected event is triggered when a user selects a file for shape drawing on a map using the Maptaskr for Power Pages App. This event provides information about the selected shape's name and the name of the selected file.

Usage

To listen for the ShapeDrawingFileSelected event, you can use the on method of the window['maptaskrPCF'] object. This allows you to register an event listener that executes a call-back function when the event is triggered.

Example

window['maptaskrPCF'].on("ShapeDrawingFileSelected", function(shapeName, fileContent) {

console.log("shapeName: " + shapeName);

console.log("fileContent: " + fileContent);

});

In the example above, we've registered an event listener for the ShapeDrawingFileSelected event. When the event occurs, the provided call-back function is executed, logging the name of the selected shape and the name of the selected file to the console.

Parameters

  • shapeName (string): The name or identifier of the selected shape.
  • fileContent (string): The BASE64 representation of the uploaded file.

Response Example

The fileContent returned will be a JavaScript Object in the format provided below (with some properties excluded for brevity)

{

"filename": "Shape 1.zip",

"mimetype": "application/x-zip-compressed",

"content":
"UEsDBBQAAAAAAANhO1VQPMKBDgUAAAAFAAAADwAAAFByb2plY3RBcmVhLmNwZ1VURi04UEsDBBQAAAAIAANhO1VXJsO7IcOFAAAAwqQCAAAPAAAAUHJvamVjdEFyZWEuZGJmY8Kuw6LClGZkYGBQZGwCURjDgMOHPwTDhnQGEcKsaMOyAT7Cjn7DiMOyXGjDssKOw47DjsOxw47Dvi7CrjB5DTR5w7/DuGAPw4cAw5d..."

}

Removing Event Listeners

To remove the event listener for the ShapeDrawingFileSelected event, you can use the off method of the window['maptaskrPCF'] object. This is useful when you no longer want to listen for this specific event.

Example

window['maptaskrPCF'].off("ShapeDrawingFileSelected");

In the example above, the event listener for ShapeDrawingFileSelected is removed, ensuring that the associated call-back function no longer executes when the event is triggered.