void GLFWView::addRandomShapeAnnotations(int count) { for (int i = 0; i < count; ++i) { mbgl::Polygon<double> triangle; triangle.push_back({ makeRandomPoint(), makeRandomPoint(), makeRandomPoint() }); annotationIDs.push_back(map->addAnnotation(mbgl::FillAnnotation { triangle, 0.5f, { makeRandomColor() }, { makeRandomColor() } })); } }
void GLFWView::addRandomLineAnnotations(int count) { for (int i = 0; i < count; ++i) { mbgl::LineString<double> lineString; for (int j = 0; j < 3; ++j) { lineString.push_back(makeRandomPoint()); } annotationIDs.push_back(map->addAnnotation(mbgl::LineAnnotation { lineString, 1.0f, 2.0f, { makeRandomColor() } })); } }
void GLFWView::addRandomCustomPointAnnotations(int count) { for (int i = 0; i < count; i++) { static int spriteID = 1; const auto name = std::string{ "marker-" } + mbgl::util::toString(spriteID++); map->addAnnotationImage(makeImage(name, 22, 22, 1)); spriteIDs.push_back(name); annotationIDs.push_back(map->addAnnotation(mbgl::SymbolAnnotation { makeRandomPoint(), name })); } }
void GLFWView::addRandomPointAnnotations(int count) { std::vector<mbgl::PointAnnotation> points; for (int i = 0; i < count; i++) { points.emplace_back(makeRandomPoint(), "default_marker"); } auto newIDs = map->addPointAnnotations(points); annotationIDs.insert(annotationIDs.end(), newIDs.begin(), newIDs.end()); }
void GLFWView::addRandomShapeAnnotations(int count) { std::vector<mbgl::ShapeAnnotation> shapes; mbgl::FillAnnotationProperties properties; properties.opacity = .1; for (int i = 0; i < count; i++) { mbgl::AnnotationSegment triangle; triangle.push_back(makeRandomPoint()); triangle.push_back(makeRandomPoint()); triangle.push_back(makeRandomPoint()); mbgl::AnnotationSegments segments; segments.push_back(triangle); shapes.emplace_back(segments, properties); } auto newIDs = map->addShapeAnnotations(shapes); annotationIDs.insert(annotationIDs.end(), newIDs.begin(), newIDs.end()); }
auto makeRandomBoid(double length = 1, double velocity = 1, BoidPos O = {0.0,0.0}) { auto p = makeRandomPoint(length,O)(); auto v = makeRandomPoint(velocity)(); return mix( BoidPos{ p.x, p.y, }, BoidSpeed{ v.x, v.y, }, BoidAcceleration { 0.0, 0.0, }, BoidID{boidId++} ); }
void GLFWView::addRandomCustomPointAnnotations(int count) { std::vector<mbgl::PointAnnotation> points; for (int i = 0; i < count; i++) { static int spriteID = 1; const auto name = std::string{ "marker-" } + mbgl::util::toString(spriteID++); map->setSprite(name, makeSpriteImage(22, 22, 1)); spriteIDs.push_back(name); points.emplace_back(makeRandomPoint(), name); } auto newIDs = map->addPointAnnotations(points); annotationIDs.insert(annotationIDs.end(), newIDs.begin(), newIDs.end()); }
void GLFWView::addRandomPointAnnotations(int count) { for (int i = 0; i < count; ++i) { annotationIDs.push_back(map->addAnnotation(mbgl::SymbolAnnotation { makeRandomPoint(), "default_marker" })); } }