Point Editor

Point Drawing service for creating and editing Points.

Usage:

You must provide PointsEditorService yourself:

my-map.component.ts
my-map.component.html
my-map.component.ts
@Component({
selector: 'my-map',
templateUrl: './my-map.component.html',
providers: [PointsEditorService],
})
export class MyMapComponent {}
my-map.component.html
<ac-map id="my-map"></ac-map>

The service is a part of AngularCesiumWidgetsModule therefor you must import it.

PointsEditorService works together with <points-editor> component. Therefor you need to create <points-editor>for each PointsEditorService of course somewhere under <ac-map>

<ac-map id="my-map">
<points-editor></points-editor>
</ac-map>
‚Äč

Thats it! just Inject the service and use the create() and edit() methods:

@Component({...})
export class MyMapComponent {
editing$: PointEditorObservable;
constructor(private pointEditor: PointsEditorService) {}
startDraw() {
this.editing$ = this.pointEditor.create();
// Or Edit from existing points
const initialPos = Cesium.Cartesian3.fromDegrees(45, 40);
this.editing$ = this.pointEditor.edit(initialPos);
});
}
}

Api

  • create(options?: PointEditOptions, eventPriority?: number)

Start a creating a Hippodrome over the map, Returns: PointEditorObservable

// Start creating
const editing$ = this.pointEditor.create();
this.editing$.subscribe(editResult => {
console.log(editResult.positions);
});
  • edit(positions: Cartesian3[], options?: PointEditOptions, priority?: number)

Start editing a Hippodrome over the map from a given positions, Returns: PointEditorObservable

const editing$ = this.pointEditoritor.edit(initialPositions);
  • The editor is fully customisable with PointEditOptions :

    • addPointEvent - Set Cesium event for adding last point, default: LEFT_CLICK

    • addPointModifier - Set Cesium event modifier for adding point, default: none

    • dragPointModifier - Set Cesium event modifier for draging a point, default: LEFT_DRAG

      • In edit mode only

    • dragPointModifier - Set Cesium event modifier for removing a point, default: none

      • In edit mode only

    • removePointModifier - Set Cesium event modifier for removing a point, default: none

      • In edit mode only

    • pointProps - Point customisation properties

    • allowDrag - allow shape drag, default: false

      • In edit mode only

    • pickConfiguration - configure pick behaviour with: pick height and width and drill pick limit

    • setLabelsRenderFn - receives a callback that is called every time the shape is redrawn (except when the shape is being dragged). The callback is called with the last shape state and with an array of the current labels.

      • The callback should return LabelProps[]

Contents
Usage:
Api