Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit 9722c92

Browse files
committed
sample point & shape annotation adds at startup
1 parent 1ae97a4 commit 9722c92

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

macosx/main.mm

+21
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,27 @@ int main() {
150150
map.setStyleURL(newStyle.first);
151151
view.setWindowTitle(newStyle.second);
152152

153+
map.addPointAnnotation(mbgl::LatLng(45, -120), "default_marker");
154+
155+
__block mbgl::Map& map_ = map;
156+
157+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
158+
mbgl::FillProperties fillProperties;
159+
fillProperties.fill_color = mbgl::Color({{ 1, 0, 0, 1 }});
160+
fillProperties.stroke_color = mbgl::Color({{ 0, 0, 0, 1 }});
161+
fillProperties.opacity = 0.25;
162+
163+
mbgl::StyleProperties shapeProperties;
164+
shapeProperties.set<mbgl::FillProperties>(fillProperties);
165+
166+
map_.addShapeAnnotation({
167+
mbgl::LatLng(44, -122),
168+
mbgl::LatLng(46, -122),
169+
mbgl::LatLng(46, -121),
170+
mbgl::LatLng(44, -122)
171+
}, shapeProperties);
172+
});
173+
153174
view.run();
154175

155176
[reachability stopNotifier];

0 commit comments

Comments
 (0)