|
|
@ -111,14 +111,14 @@ class RouteGuideImpl final : public RouteGuide::Service { |
|
|
|
return Status::OK; |
|
|
|
return Status::OK; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Status ListFeatures(ServerContext* context, const Rectangle* rectangle, |
|
|
|
Status ListFeatures(ServerContext* context, const examples::Rectangle* rectangle, |
|
|
|
ServerWriter<Feature>* writer) override { |
|
|
|
ServerWriter<Feature>* writer) override { |
|
|
|
auto lo = rectangle->lo(); |
|
|
|
auto lo = rectangle->lo(); |
|
|
|
auto hi = rectangle->hi(); |
|
|
|
auto hi = rectangle->hi(); |
|
|
|
long left = std::min(lo.longitude(), hi.longitude()); |
|
|
|
long left = (std::min)(lo.longitude(), hi.longitude()); |
|
|
|
long right = std::max(lo.longitude(), hi.longitude()); |
|
|
|
long right = (std::max)(lo.longitude(), hi.longitude()); |
|
|
|
long top = std::max(lo.latitude(), hi.latitude()); |
|
|
|
long top = (std::max)(lo.latitude(), hi.latitude()); |
|
|
|
long bottom = std::min(lo.latitude(), hi.latitude()); |
|
|
|
long bottom = (std::min)(lo.latitude(), hi.latitude()); |
|
|
|
for (const Feature& f : feature_list_) { |
|
|
|
for (const Feature& f : feature_list_) { |
|
|
|
if (f.location().longitude() >= left && |
|
|
|
if (f.location().longitude() >= left && |
|
|
|
f.location().longitude() <= right && |
|
|
|
f.location().longitude() <= right && |
|
|
|