Commit Graph

30 Commits

Author SHA1 Message Date
Andreas Hocevar
3f2d79b7fe Replace goog.events.Event/EventTarget system with our own
This also removes goog.events.listen, goog.events.unlisten,
goog.events.unlistenByKey and goog.events.BrowserEvent.
2016-02-03 11:19:38 +01:00
Frederic Junod
d2dd7584d8 Remove use of goog.object.getKeys 2015-09-29 14:24:34 +02:00
Tim Schaub
f0c0c28f04 Rename ol.feature.FeatureStyleFunction to ol.FeatureStyleFunction 2015-04-20 13:47:34 -06:00
Pierre GIRAUD
5843654650 Merge pull request #3509 from pgiraud/geometry_changed_null
Dispatch change event even when geometry is set to null
2015-04-07 12:39:48 +02:00
Pierre GIRAUD
d27d59f445 Use sinon.spy to ensure change event is dispatched 2015-04-07 12:21:01 +02:00
Pierre GIRAUD
5eb13660d3 Dispatch change event even when geometry is set to null 2015-04-07 12:12:07 +02:00
Éric Lemoine
d335318496 Make ol.Feature#setStyle accept null 2014-09-17 17:52:51 +02:00
Antoine Abt
60f1874766 Give precedence to feature style 2014-07-16 11:25:16 +02:00
Éric Lemoine
eafc2ac371 Change setValues to setProperties 2014-06-27 17:26:51 +02:00
Éric Lemoine
ec6a0548d1 Add ol.Feature#clone 2014-06-25 09:31:15 +02:00
Tim Schaub
34cabd1579 Dispatch change on feature id change 2014-05-23 16:35:06 -06:00
Tim Schaub
98193c0336 Merge pull request #2098 from tschaub/empty-feature
Do not set geometry by default.
2014-05-21 09:52:09 -06:00
Tim Schaub
a4d31147bc Do not set geometry by default
A feature can have a geometry whose value is an ol.geom.Geometry instance or null.  A feature can also have no geometry property.  By default, a feature has no geometry property.  To set a geometry, one can be passed to the constructor (including null) or passed to setGeometry().
2014-05-21 09:16:54 -06:00
Andreas Hocevar
e530758b36 Test that a custom geometry works 2014-05-21 15:08:11 +02:00
Tim Schaub
59cbe7c23a Safer feature constructor
Calling setValues now behaves like calling set (closes #1672)
2014-02-19 10:20:57 -07:00
Tim Schaub
f4585331f2 Add setStyle and getStyle to ol.Feature
As with vector layers and feature overlays, feature style can be set by calling
setStyle.  Calling getStyle returns what was passed to setStyle.  Internally, we call getStyleFunction.
2014-02-13 10:25:17 -07:00
Tim Schaub
a185fc963d Tests for get/setStyleFunction
It would be nice to also test the following:

    it('does not return user set property with the same name', function() {
      var feature = new ol.Feature({
        whatever: 'some value',
        styleFunction: 'another value'
      });
      expect(feature.getStyleFunction()).to.be(undefined);
    });

Unfortunately, in uncompiled code (or if we export `setStyleFunction`) this does not work.  Same goes for user set `id` properties (this will set our internal `id_` property).  See #1672.
2014-02-13 10:25:17 -07:00
Tim Schaub
c64c24d3dc Common code for creating a style function 2014-02-13 10:25:16 -07:00
Antoine Abt
add3cf2233 Remove useless "geometry" FeatureProperty 2013-12-18 14:20:11 +01:00
Antoine Abt
59df68fe68 Update property change listener 2013-12-18 14:20:08 +01:00
Antoine Abt
4fc6c36724 Add support for features with multiples geometries 2013-12-18 11:37:35 +01:00
Tom Payne
4e65fefc00 Move vector code out of the way 2013-11-20 11:39:21 +01:00
Bart van den Eijnden
8d03fa1197 add an optional argument to getAttributes so we can get a feature's attributes except for the geometry ones 2013-11-19 15:39:22 +01:00
Tim Schaub
adf99d592a Listen for geometry events and fire feature events 2013-10-03 15:50:23 -06:00
Frederic Junod
764aacb568 Rename {get|set}FeatureId to {get|set}Id 2013-09-17 12:50:56 +02:00
ahocevar
8c0f1f979a Store the feature's commonly used id
To not clobber the feature's attributes, this is a separate
member property.
2013-05-23 11:16:17 -05:00
Tobias Bieniek
d5d8afc858 Converted "vector" branch unit tests to mocha, expect.js and sinon 2013-03-13 04:48:08 +01:00
Tim Schaub
e23ca1655c Confirm that arbitrary attribute names can be used 2013-02-20 10:34:10 -07:00
Tim Schaub
7ce89f1fbe Proper getAttributes method
With a59aa9bb37 we can now provide an object with user set attributes.
2013-02-20 10:33:42 -07:00
Tim Schaub
735f490f56 Treating geometry as just another attribute
The first set geometry is considered the default.  As an added bonus, we're back to a single argument constructor.  Later, we could allow a schema to be set.  This would be done before setting values (calling constructor with no args).
2013-02-20 00:02:50 -07:00