Commit Graph

111 Commits

Author SHA1 Message Date
Konstantin Käfer
62ea1f2185 [core] remove trailing whitespace, add trailing newlines, add space after // 2017-01-27 11:44:16 +01:00
Bobby Sudekum
2988ca16c1 Add addImage, removeImage API (#7610) 2017-01-09 13:03:17 -08:00
John Firebaugh
e8a48a6d63 [node] Fix order of operations when setting zoom and center
Zoom must be set first, to avoid center potentially getting constrained.

Fixes #7351
2016-12-14 10:08:23 -08:00
Konstantin Käfer
117863f111 [build] move headless rendering files to platform/default 2016-11-22 20:58:51 +01:00
John Firebaugh
251035cd75 [node] Add setZoom and setPitch support 2016-11-17 13:48:00 -08:00
John Firebaugh
f1e10e31a5 [node] Revert semantics of Map#render 2016-11-17 13:48:00 -08:00
John Firebaugh
a5e712d28b [node] Don't needlessly reset map state 2016-11-09 17:54:45 -08:00
Konstantin Käfer
62b56b799a [core] change std::array<uint16_t, 2> to mbgl::Size 2016-10-27 18:30:58 -07:00
Konstantin Käfer
a4d259c33f [core] move gl::Context to Backend and refactor View 2016-10-25 13:52:36 -07:00
Konstantin Käfer
5cc390d694 [core] separate Backend from View for headless rendering 2016-10-25 13:52:36 -07:00
Mike Morris
817c26111a [core] [node] pass thread pool impl to Map constructor
Updates mbgl::Map constructor usage everywhere

Adds NodeThreadPool implementation using AsyncQueue to call
Nan::AsyncQueueWorker from main thread
2016-10-20 14:37:36 -04:00
Bruno de Oliveira Abinader
89f3270f72 [node] Added set{Bearing,Center} + updated -test-suite
This gives the ability to pan and/or rotate the map in a posterior step
after initial render for testing purposes.
2016-10-11 12:10:32 +03:00
Thiago Marcos P. Santos
edec56e6c5 [node] switch to NodeRequest member fn callback
For (hopefully) better performance than creating a new v8::Context to
wrap each callback while still avoiding leaking memory with v8::FunctionTemplate.

Adds a JavaScript shim in front of module.exports.Map to wrap the
req.respond API internally and preserve the public callback-passing
API, while still exporting the correct prototype.
2016-09-06 18:14:22 -04:00
John Firebaugh
b4864ca9d5 [core] Trigger Source::Impl::reload when a filter or layout property is modified 2016-09-06 14:29:22 -07:00
John Firebaugh
fe2a26225f [core, ios, android, qt] Observe style layer mutations rather than requiring SDKs to use Map::update
This paves the way for updates to filter and layout properties to trigger a source reload, without each SDK having to participate in the implementation.
2016-09-06 14:29:22 -07:00
Thiago Marcos P. Santos
a12fa9333b [node] Throw on invalid style JSON
Fixes #6143
2016-08-25 22:05:00 +03:00
Bruno de Oliveira Abinader
e1f11eed35 [core] Updated clang-tidy fixes 2016-08-05 11:42:22 +02:00
Mike Morris
7df0e459b6 [node] NodeRequest inherits from Nan::AsyncWorker
drop NodeRequest::Create, move MakeCallback to NodeRequest::Execute

rework Respond -> HandleCallback

modern NAN style updates
2016-07-14 13:47:02 -04:00
Mike Morris
ce8f053adb [node] enter new v8::Context to avoid leaking v8::FunctionTemplate in NodeMap::request 2016-07-14 13:47:02 -04:00
Bruno de Oliveira Abinader
1cb59e20c4 [node] Added 'removeLayer' binding 2016-07-13 16:19:28 +03:00
Thiago Marcos P. Santos
86cebd4cca [core] Report conversion errors using std::string
char* increases the risk of pointing to a invalid reference. Qt had
to use a static variable as retainer to workaround.
2016-07-12 16:04:20 +03:00
Thiago Marcos P. Santos
01f5b6e58d [node] Also Update::Classes when setting a paint property
Otherwise it has no effect. Tests might be working because a
Update::Classes is also scheduled when adding a new layer.
2016-07-08 16:27:16 +03:00
Minh Nguyễn
8947b0af27 [ios, macos, node] “Mapbox GL Style Specification” → “Mapbox Style Specification” (#5553) 2016-07-04 17:37:11 -07:00
John Firebaugh
021d4199cb [core, node] Implement bindings for addSource 2016-06-24 09:39:51 -07:00
John Firebaugh
16c435b151 [core, node] Implement bindings for addLayer 2016-06-24 09:39:51 -07:00
John Firebaugh
3459b83736 [core, node] Node bindings for setFilter 2016-06-21 18:24:49 -07:00
John Firebaugh
8a9ee26b0e [core] Use mbgl::style::conversion in node bindings 2016-06-21 16:04:22 -07:00
Bruno de Oliveira Abinader
6c9e00be3a [node] Read 'options.showOverdrawInspector' 2016-06-20 13:24:20 +03:00
John Firebaugh
3f5ea169f5 [node] Partial implementation of runtime styling API for node bindings 2016-06-13 17:22:05 -07:00
John Firebaugh
ee78b1b797 [core] Eliminate some redundant NodeMap members 2016-06-13 17:22:05 -07:00
John Firebaugh
e802aedb8c [core, node, android] Remove used "base" parameter from setStyleJSON 2016-06-02 16:33:56 -07:00
Konstantin Käfer
27f9a85fea [node] don't fire callback for canceled AsyncRequest 2016-05-26 20:17:36 +02:00
John Firebaugh
8ec0b70722 [core] Use mapbox::geometry::box in queryRenderedFeatures 2016-05-13 09:01:32 -07:00
John Firebaugh
c8391729c7 [core] Use geometry.hpp feature type 2016-05-03 17:25:49 -07:00
Ansis Brammanis
61d14089e0 [core] implement queryRenderedFeatures 2016-04-29 12:00:24 -07:00
John Firebaugh
204c7fee03 [core] Render from the main thread
Do not create a thread for the MapContext anymore.
2016-04-14 13:44:08 -07:00
John Firebaugh
169755e89a [core] Unify FileRequest and WorkRequest 2016-03-24 10:54:32 -07:00
Thiago Marcos P. Santos
63982e0010 Revert "[node] Destroy the RunLoop with the last Map object"
This reverts commit 3633fd7ebd.
2016-02-24 14:31:11 +02:00
Thiago Marcos P. Santos
3633fd7ebd [node] Destroy the RunLoop with the last Map object
The last map object to get destroyed will also destroy
the RunLoop (which will also destroy the AsyncTask).

This will clear any reference to the Node default main
loop and let it close.

Downside is that we need to make sure we are always calling
`map.release()`.
2016-02-20 13:33:13 +02:00
Ansis Brammanis
29d61c0fe7 [node] add debug options to node bindings
fix #3579
2016-02-08 14:22:53 -08:00
Mike Morris
86691a08de [node] patch memory leak in NodeMap::request
Creating a v8::Function with
Nan::GetFunction(Nan::New<v8::FunctionTemplate>) can leak, use
Nan::New<v8::Function> instead.

https://code.google.com/p/chromium/issues/detail?id=272579
2016-02-04 18:27:52 -05:00
Mike Morris
f4d394d935 [node] code review cleanup 2015-12-15 10:19:56 -08:00
John Firebaugh
896245e510 [test] Update test suite 2015-12-09 16:25:45 -08:00
Thiago Marcos P. Santos
873eabcf28 [node] Fix build on GCC 4.9.2 2015-11-26 19:40:36 +02:00
John Firebaugh
1d33790dc0 [core] Fix image type of Map::renderStill
It's a premultiplied image. This implies that we were misusing encodePNG
in most cases, as we were passing premultiplied pixels which were then
interpreted as unmultiplied. I changed encodePNG to accept premultipled
pixels, and unpremultiply in the implementations.
2015-11-25 15:57:37 -08:00
John Firebaugh
0c1e378bc9 [core] Rewrite image handling
* Consolidate Image and StillImage
* Typecheck unassociated vs premultiplied images
* Rewrite default platform image decoding implementation
2015-11-25 15:57:36 -08:00
John Firebaugh
36081f6486 [core] For binary image data use uint8_t, not char 2015-11-23 17:28:44 -08:00
John Firebaugh
c4c3a19d85 [node] Allow GC in spite of reference loops through the request method
The following produces a reference cycle:

var map = new mbgl.Map({
    request: function () { ... }
});

map has a reference to the request function, which has a reference to
its closure, which has a reference to map.

Storing a the map options in an internal field, rather than a Persistent,
allows V8 to collect the reference cycle when none of its members have
other references.
2015-11-20 16:33:46 -08:00
Mike Morris
5e58070dec [node] make ratio optional, default to 1.0 2015-11-04 18:18:08 -05:00
Mike Morris
3528002b58 [node] swap array order to [lng, lat] for render option center
For consistency with GeoJSON and mapbox-gl-js
2015-11-04 17:41:34 -05:00