How to use the ngeo/misc/decorate.js.interactionDecoration function in ngeo

To help you get started, we’ve selected a few ngeo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github camptocamp / ngeo / contribs / gmf / src / mobile / measure / baseComponent.js View on Github external
if (!this.map) {
    throw new Error('Missing map');
  }
  if (!this.measure) {
    throw new Error('Missing measure');
  }

  this.measure.setActive(this.active);
  interactionDecoration(this.measure);

  const drawInteraction = this.measure.getDrawInteraction();
  if (!(drawInteraction instanceof MobileDraw)) {
    throw new Error('Wrong drawInteraction');
  }
  this.drawInteraction = drawInteraction;
  interactionDecoration(drawInteraction);

  Object.defineProperty(this, 'hasPoints', {
    get() {
      return this.drawInteraction.getFeature() !== null;
    }
  });

  listen(drawInteraction, 'change:dirty', (evt) => {
    this.dirty = drawInteraction.getDirty();

    // this is where the angular scope is forced to be applied. We
    // only need to do this when dirty, as going to "no being dirty"
    // is made by a click on a button where Angular is within scope
    if (this.dirty) {
      this.scope.$apply();
    }
github camptocamp / ngeo / contribs / gmf / src / profile / drawLineComponent.js View on Github external
stroke: new olStyleStroke({
      color: '#ffcc33',
      width: 2
    })
  });
  overlay.setStyle(style);

  /**
   * @type {import("ol/interaction/Draw.js").default}
   */
  this.interaction = new olInteractionDraw({
    type: 'LineString',
    features: this.features_
  });

  interactionDecoration(this.interaction);

  // Clear the line as soon as a new drawing is started.
  this.interaction.on('drawstart', (event) => {
    this.features_.clear();
  });

  // Update the profile with the new geometry.
  this.interaction.on('drawend', (event) => {
    this.line = event.feature.getGeometry();
    // using timeout to prevent double click to zoom the map
    $timeout(() => {
      this.interaction.setActive(false);
    }, 0);
  });

  // Line may be removed from an other component
github camptocamp / ngeo / contribs / gmf / src / editing / editFeatureComponent.js View on Github external
this.interactions_.forEach((interaction) => {
    interaction.setActive(false);
    ngeoMiscDecorateInteraction(interaction);
  });
};
github camptocamp / ngeo / src / draw / Controller.js View on Github external
registerInteraction(interaction) {
    if (!this.map) {
      throw new Error('Missing map');
    }
    this.interactions_.push(interaction);
    interaction.setActive(false);
    ngeoMiscDecorateInteraction(interaction);
    this.map.addInteraction(interaction);
  }
github camptocamp / ngeo / contribs / gmf / src / drawing / drawFeatureComponent.js View on Github external
this.interactions_.forEach((interaction) => {
    interaction.setActive(false);
    ngeoMiscDecorateInteraction(interaction);
  });
};
github camptocamp / ngeo / contribs / gmf / src / mobile / measure / baseComponent.js View on Github external
MeasueMobileBaseController.prototype.init = function() {
  if (!this.map) {
    throw new Error('Missing map');
  }
  if (!this.measure) {
    throw new Error('Missing measure');
  }

  this.measure.setActive(this.active);
  interactionDecoration(this.measure);

  const drawInteraction = this.measure.getDrawInteraction();
  if (!(drawInteraction instanceof MobileDraw)) {
    throw new Error('Wrong drawInteraction');
  }
  this.drawInteraction = drawInteraction;
  interactionDecoration(drawInteraction);

  Object.defineProperty(this, 'hasPoints', {
    get() {
      return this.drawInteraction.getFeature() !== null;
    }
  });

  listen(drawInteraction, 'change:dirty', (evt) => {
    this.dirty = drawInteraction.getDirty();