Commit Graph

62 Commits

Author SHA1 Message Date
Tim Schaub
0f9e269057 Ignore extra dimensions and pad with NaN for missing dimensions 2013-08-18 09:57:26 -04:00
ahocevar
b2e25c8f6b Renaming method to getInteriorPoint
as suggested by @tschaub. Also giving credit to JTS.
2013-07-30 09:25:24 +02:00
ahocevar
11ef2cb7d1 Better label placement for polygons
Using the y-coordinate of the polygon's bounding box, this
simple algorithm intersects the polygon with the horizontal
center line of its bounding box. The x-coordinate of the label
point is the center of the longest segment of this intersection
that is inside the polygon.
2013-07-20 10:36:13 +02:00
Tim Schaub
d482b66af3 Doc typo 2013-07-05 11:48:45 -06:00
Tim Schaub
99ba5a0da8 Store rings so exerior is clockwise and interior is counter-clockwise
KML and WKT don't specify a winding order, so we write those out in CW/CCW order (for exterior/interior).  GML references ISO 19107 that specifies CCW/CW, so we serialize in that winding order.

Having hand generated all this GML data the first time around, I reserve the right to modify it for the tests.
2013-06-24 17:46:36 -06:00
Tim Schaub
e292d8fa12 Add method to determine winding order of linear rings 2013-06-24 17:43:22 -06:00
ahocevar
56ac30de91 Exposing ol.geom.GeometryType
This is necessary for using ol.filter.Geometry.
2013-05-31 15:04:55 -06:00
Tom Payne
11672db967 Use === and !== for comparisons with 0 2013-05-28 16:07:48 +02:00
Tom Payne
b021bfd70f Remove unused variables in geom 2013-05-28 16:01:33 +02:00
ahocevar
019fc86ac5 Entertaining linter and compiler 2013-05-07 14:20:09 +02:00
ahocevar
666a010e3b Point-in-polygon improvements
As suggested by @tschaub in #674, geom.pointInPoly is not needed
if we have geom.LinearRing#containsCoordinate. This pull request
also adds tests and documentation on the limitations of the
containsCoordinate method.

I think for now it is ok to keep geometry/topology functions as
simple as possible in ol3. If we decide to not rely on third
party libraries like jsts for topology operations, we can always
refine what we have and e.g. port topology operations over from
ol2.
2013-05-07 10:49:51 +02:00
ahocevar
58c8b07ab5 Get hit candidates from RTree, then refine result
Now we get exact hits also for lines and polygons.
2013-04-30 13:34:12 +02:00
Tom Payne
953f9c2e7a Port ol.geom to new extents 2013-04-19 10:03:36 +02:00
Tom Payne
f1cc5b87da Fix whitespace errors in JavaScript source 2013-04-08 13:25:01 +02:00
Tom Payne
4be8c991f7 Add missing Closure Library requires 2013-04-06 14:28:12 +02:00
Marc Jansen
6ca21b32a9 More renames as suggested by @elemoine. 2013-04-04 10:25:11 +02:00
Tom Payne
8b5367c947 Use Infinity instead of Number.POSITIVE_INFINITY 2013-03-22 11:34:44 +01:00
Éric Lemoine
0949cb29aa Move expression.exports to proper place 2013-03-17 23:12:43 +01:00
Tim Schaub
e1c3faa53e Vector related exports 2013-03-05 18:13:10 +01:00
Tim Schaub
a968a5ca66 The shared vertices structure now works with integer arrays only
Previously, a lookup object containing start indexes was also used.  This allowed us to remove arrays of vertices and properly update the start indexes for remaining coordinate values.  In order to provide callers with stable identifiers and to work with arrays of integers alone, we cannot support a remove method.  I think this is worth revisiting.  Even if the array length cannot be changed in WebGL, we don't need to also impose the restriction outside.  Instead, the WebGL renderer could be notified when array sizes change and update itself accordingly.  I think there is more value in providing geometries with stable identifiers.

This common structure is used to store vertices for all geometry types.  A slight optimization could be made by creating yet another structure to store point vertices - since these don't need to have a counts array (always 1).  Creating a new structure would mean saving memory at the expense of more lib code to transport.  The coordinate value lookups are not negatively impacted by using the same structure for points and higher order geometries.  Since the first change above goes against my instincts, I'm not making this second change (to add another structure for shared point vertices).
2013-03-05 11:47:42 +01:00
Tim Schaub
cae925ad1f Correct spelling (thanks @fredj) 2013-03-04 21:04:59 +01:00
Tim Schaub
9edf63fdb8 Proper bounds 2013-03-04 20:25:18 +01:00
Tim Schaub
fae79dbc0f Fewer function calls during bounds calculation 2013-03-04 18:55:20 +01:00
Tim Schaub
b52d283641 Allow geometries to use a shared vertex array
The ol.geom.SharedVertices structure represents a flattened array of vertex coordinates.  This is intended to support optimal WebGL rendering.
2013-03-02 18:39:24 +01:00
Tim Schaub
8f578b88b1 Removing the typed arrays
Its not clear that we will be able to leverage the Float64Array.  It may also be that the overhead of constructing these small arrays negates any benefit of faster access.  And for all coordinate arrays, we'll need arrays that grow/shrink.
2013-02-20 01:15:39 -07:00
Tim Schaub
0015e466dc Allow instanceof checks for geometries 2013-02-19 23:21:05 -07:00
ahocevar
619803cdeb More goog.requires fixes 2013-02-06 16:36:42 +01:00
ahocevar
61e4452c83 Adding missing and removing unused goog.requires 2013-02-06 16:26:24 +01:00
Tim Schaub
89bc69ccc1 Types for rings and mixed collections 2013-01-21 17:56:12 -07:00
Tim Schaub
6ef2184c83 Geometry type enumeration 2013-01-21 17:46:41 -07:00
Tim Schaub
0fad23970c Disallowing mixed geometry collections for now 2013-01-21 14:46:45 -07:00
Tim Schaub
b4d44f815f Add getBounds to geometry 2013-01-21 12:59:04 -07:00
Tim Schaub
216d30ddc1 Getting the nanometer precision we deserve with web mercator 2013-01-21 10:52:17 -07:00
Tim Schaub
fd0a5f3622 Point, linestring, and linearring coordinates as Float32Array 2013-01-18 15:57:48 -07:00
Tim Schaub
997c7145ab Bare bones geom package 2013-01-07 01:34:33 -05:00
Tom Payne
f3d9b3332c Move code to be merged into src/attic 2012-07-26 00:21:37 +02:00
Marc Jansen
f477fd8ced Allow multi* geometries in Collections/collections. 2012-06-25 23:19:25 +02:00
Marc Jansen
6d84d4d3a1 Add geom/MultiLineString classes and tests. 2012-06-25 21:36:17 +02:00
Marc Jansen
be9448457d Test & improve the getCentroid/centroid method of collections 2012-06-22 18:24:53 +02:00
Marc Jansen
396875c719 A centroid method for LineStrings 2012-06-22 16:26:19 +02:00
Marc Jansen
483c431e1b A centroid method vor Collections 2012-06-22 16:26:19 +02:00
Marc Jansen
e23b119059 Whitespace changes only. 2012-06-22 16:26:19 +02:00
Marc Jansen
09d7f15fb2 Give points a getCentroid/centroid method. 2012-06-22 16:26:19 +02:00
Marc Jansen
1456e234e2 Whitespace changes only. 2012-06-22 16:26:19 +02:00
Marc Jansen
5a3dad9326 Add a basic geometry interface 2012-06-22 16:26:19 +02:00
Mike Adair
368bb28671 initial version of popups 2012-06-22 08:13:34 -04:00
Éric Lemoine
e78b990f52 fix ol.geom.geometry api tests 2012-06-22 13:57:43 +02:00
Marc Jansen
f143f32a6f Use ol.error instead of throwing directly. 2012-06-22 12:37:10 +02:00
Marc Jansen
67ce7afe67 Export the Collection constructor. 2012-06-22 09:45:05 +02:00
Marc Jansen
bed71db109 Export the LineString constructor. 2012-06-22 09:44:21 +02:00