Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. function PointSource (args){
  2. ol.source.Vector.call(this, args);
  3. this.typeOfGeometry = 'Point';
  4. this.on('addfeature', function(e){
  5. if(e.feature.getGeometry() instanceof ol.geom.Point)
  6. console.log('point');
  7. else {
  8. console.log('no point');
  9. this.removeFeature(e.feature);
  10. }
  11. });
  12. }
  13.  
  14. PointSource.prototype = Object.create(ol.source.Vector.prototype);
  15. PointSource.prototype.constructor = PointSource;
  16.  
  17. var myPointsLayer = new ol.layer.Vector({
  18. source : new PointSource({...})
  19. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement