Skip to content
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

105 kaavakohteen luominen ilman templaattia, yleisiä muutoksia kaavakohteen luomiseen ja kaavakohdekirjastoihin #106

Merged
merged 7 commits into from
Jan 14, 2025

Conversation

nmaarnio
Copy link
Collaborator

No description provided.

Some refactoring was done for related functionalities
- deleted feature_template_library: some functions moved to PlanManager, some to NewFeatureDock
- deleted template_library_config: FeatureTemplateLibrary renamed and moved to models.py
- renamed template_dock -> new_feature_dock
- changed PlanFeatureForm to be initialized from a PlanFeature, following the logic of other form and widget initialization. similarly, FeatureTemplateLibrary now consists of PlanFeatures
- WIP: regulation group initialization from plan feature template config, continue designing the new dock
@nmaarnio nmaarnio added the enhancement New feature or request label Jan 10, 2025
@nmaarnio nmaarnio linked an issue Jan 10, 2025 that may be closed by this pull request
…efactoring

- fix PlanDigitizeMapTool to reinitialize itself after layer changes
- implement similar config file fetching for regulation group libraries as for feature templates
- reorganize library files in resources folder
- deactivate selections in NewFeatureDock when PlanFeatureDigitizeMapTool finishes/deactivates
@nmaarnio nmaarnio marked this pull request as ready for review January 13, 2025 10:49
@nmaarnio nmaarnio requested a review from LKajan January 13, 2025 10:49
self.initialize_feature_digitize_map_tool()

def initialize_feature_digitize_map_tool(self, layer: QgsVectorLayer | None = None):
# Get matcing capture mode for given layer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tarviiko näitä. Käsittääkseni QgsMapToolDigitizeFeature.setLayer() hoitaa tän automaattisesti.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taitaa tarvita, ainakin siltä vaikutti. Tätä voi kyllä testata vielä jossain kohtaa uudestaan

@@ -102,6 +184,24 @@ def _plan_geom_digitized(self, feature: QgsFeature):

iface.mapCanvas().setMapTool(self.previous_map_tool)

def _plan_feature_geom_digitized(self, feature: QgsFeature):
# NOTE: What if user has changed dock selections while digitizng?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hyvä huomio. Näistä kaikista vastaavista voisi tehdä issuen GitHubiin.

for index in range(self.template_list.count()):
item = self.template_list.item(index)
item_text = item.text().lower()
plan_feature: PlanFeature = item.data(Qt.UserRole)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hyvä tapa olisi luoda kutakin käyttötarkoitusta varten oma UserRole. Käytännössä Qt.UserRole (rolet ylseisestikin) on vaan integer, joka kertoo mistä alkaa käyttäjälle varatut integerarvot (maksimi on Qt.MaxUserRole).

from enum import IntEnum
class CustomDataRole(IntEnum):
    FeatureRole = Qt.UserRole
    SomeOtherRole = Qt.UserRole +1
...
feature = PlanFeature()
item.setData(CustomDataRole.FeatureRole, feature)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tehdään tästä asiasta yleinen issue

@nmaarnio nmaarnio merged commit c347e3c into main Jan 14, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kaavakohteen luominen ilman templaattia
2 participants