-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Configure basemap style language sample #1688
Conversation
...RuntimeSDKQt_CppSamples/Maps/ConfigureBasemapStyleLanguage/ConfigureBasemapStyleLanguage.cpp
Outdated
Show resolved
Hide resolved
...RuntimeSDKQt_CppSamples/Maps/ConfigureBasemapStyleLanguage/ConfigureBasemapStyleLanguage.cpp
Outdated
Show resolved
Hide resolved
...RuntimeSDKQt_CppSamples/Maps/ConfigureBasemapStyleLanguage/ConfigureBasemapStyleLanguage.cpp
Outdated
Show resolved
Hide resolved
...RuntimeSDKQt_CppSamples/Maps/ConfigureBasemapStyleLanguage/ConfigureBasemapStyleLanguage.cpp
Outdated
Show resolved
Hide resolved
...RuntimeSDKQt_CppSamples/Maps/ConfigureBasemapStyleLanguage/ConfigureBasemapStyleLanguage.cpp
Outdated
Show resolved
Hide resolved
function setNewBasemap() { | ||
model.setNewBasemap(globalButton.checked , comboBox.currentText); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably both should have a clearer name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The screenshot proportions don't look correct. It looks like it's been squished.
...RuntimeSDKQt_CppSamples/Maps/ConfigureBasemapStyleLanguage/ConfigureBasemapStyleLanguage.cpp
Outdated
Show resolved
Hide resolved
...RuntimeSDKQt_CppSamples/Maps/ConfigureBasemapStyleLanguage/ConfigureBasemapStyleLanguage.cpp
Outdated
Show resolved
Hide resolved
basemapStyleParameters->setLanguageStrategy(global? BasemapStyleLanguageStrategy::Global : BasemapStyleLanguageStrategy::Local); | ||
|
||
//A SpecificLanguage setting overrides the LanguageStrategy settings | ||
if (language == "none") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review bracket style.
} | ||
} | ||
|
||
function setNewBasemap() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems unnecessary to have the JS function wrapping the C++ function - why not just directly call the C++ function from the combobox itself?
…ge/ConfigureBasemapStyleLanguage.cpp Co-authored-by: James Ballard <[email protected]>
…ge/ConfigureBasemapStyleLanguage.cpp Co-authored-by: James Ballard <[email protected]>
…ge/ConfigureBasemapStyleLanguage.cpp Co-authored-by: James Ballard <[email protected]>
…ge/ConfigureBasemapStyleLanguage.cpp Co-authored-by: James Ballard <[email protected]>
…ge/ConfigureBasemapStyleLanguage.cpp Co-authored-by: James Ballard <[email protected]>
…ge/ConfigureBasemapStyleLanguage.h Co-authored-by: James Ballard <[email protected]>
…ge/ConfigureBasemapStyleLanguage.qml Co-authored-by: James Ballard <[email protected]>
…ge/ConfigureBasemapStyleLanguage.cpp Co-authored-by: James Ballard <[email protected]>
…ge/ConfigureBasemapStyleLanguage.cpp Co-authored-by: James Ballard <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, but I noticed a few other minor things.
...RuntimeSDKQt_CppSamples/Maps/ConfigureBasemapStyleLanguage/ConfigureBasemapStyleLanguage.cpp
Outdated
Show resolved
Hide resolved
{ | ||
if (!basemapStyleParameters) | ||
{ | ||
basemapStyleParameters = new BasemapStyleParameters(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this is always needed. If so, consider creating it in the constructor.
...RuntimeSDKQt_CppSamples/Maps/ConfigureBasemapStyleLanguage/ConfigureBasemapStyleLanguage.cpp
Outdated
Show resolved
Hide resolved
…ge/ConfigureBasemapStyleLanguage.cpp Co-authored-by: James Ballard <[email protected]>
…ge/ConfigureBasemapStyleLanguage.cpp Co-authored-by: James Ballard <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, I've got a couple more suggestions for cleanup
...ISRuntimeSDKQt_CppSamples/Maps/ConfigureBasemapStyleLanguage/ConfigureBasemapStyleLanguage.h
Outdated
Show resolved
Hide resolved
...RuntimeSDKQt_CppSamples/Maps/ConfigureBasemapStyleLanguage/ConfigureBasemapStyleLanguage.cpp
Outdated
Show resolved
Hide resolved
...RuntimeSDKQt_CppSamples/Maps/ConfigureBasemapStyleLanguage/ConfigureBasemapStyleLanguage.cpp
Outdated
Show resolved
Hide resolved
connect(m_map, &Map::doneLoading, this, [](const Error& e) | ||
{ | ||
if (!e.isEmpty()) | ||
{ | ||
qWarning() << e.message() << e.additionalMessage(); | ||
return; | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably unnecessary to include checking in this logging for the map load status. I suggest removing it
...RuntimeSDKQt_CppSamples/Maps/ConfigureBasemapStyleLanguage/ConfigureBasemapStyleLanguage.cpp
Outdated
Show resolved
Hide resolved
…ge/ConfigureBasemapStyleLanguage.h Co-authored-by: Lucas Danzinger <[email protected]>
…ge/ConfigureBasemapStyleLanguage.cpp Co-authored-by: Lucas Danzinger <[email protected]>
…ge/ConfigureBasemapStyleLanguage.cpp Co-authored-by: Lucas Danzinger <[email protected]>
…ge/ConfigureBasemapStyleLanguage.cpp Co-authored-by: Lucas Danzinger <[email protected]>
|
||
ConfigureBasemapStyleLanguage::ConfigureBasemapStyleLanguage(QObject* parent /* = nullptr */) : | ||
QObject(parent), | ||
m_map(new Map(SpatialReference::webMercator())), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
memory leak
m_map(new Map(SpatialReference::webMercator())), | |
m_map(new Map(SpatialReference::webMercator(), this)), |
Also, does the map initially launch empty until users press a button? That doesn't seem optimal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the map initially launches with local
language strategy
// Set the view (created in QML) | ||
void ConfigureBasemapStyleLanguage::setMapView(MapQuickView* mapView) | ||
{ | ||
m_map = new Map(SpatialReference::webMercator()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already done in the constructor.
if (m_basemap) | ||
delete m_basemap; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (m_basemap) | |
delete m_basemap; | |
if (m_basemap) | |
m_basemap->deleteLater(); |
I think your code works fine, but conceptually it feels wrong to delete the map's basemap while it's still displayed. We could write a bunch of extra code to change the order, but deleteLater does the same thing with less code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Looks like the design is approved and about to be merged. I think we might want to wait until it is officially merged before we merge this. You can watch the #native-samples-announcements channel for this
ComboBox { | ||
id: comboBox | ||
model: ["none" , "Bulgarian", "Greek", "Turkish"] | ||
onCurrentTextChanged: model.setNewBasemapLanguage(globalButton.checked, comboBox.currentText); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per our offline discussion, I think this should be more intentional. It seems this executes when the code first loads, but it's unclear from looking at the c++ code how any basemap was loaded. I think the code should be more intentional about how the initial basemap is being set.
When I reviewed the latest code, I assumed no basemap at all was set, because that's what is happening on the C++ side via the constructor.
Description
This PR is to add
Configure basemap style language
sampleType of change
Platforms tested on:
Checklist