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

Add ngeo draw feature directive #975

Merged
merged 1 commit into from Apr 11, 2016
Merged

Conversation

adube
Copy link
Contributor

@adube adube commented Apr 1, 2016

This PR introduces a ngeo-drawfeature directive and an example featuring it.

Todo

  • deal with i18n values
  • use contants for feature properties and geometry types once Add gmf feature style directive #955 is merged
  • set the default style of the features when drawn once Add gmf feature style directive #955 is merged
  • prevent the features and overlay that are added in the measure interactions to be shown, as those conflict with the actual drawn features.
  • code review
  • merge into one commit
  • travis build passes

Live example

@adube adube changed the title (WIP) Draw Feature Directive (WIP) gmf draw feature directive Apr 1, 2016
@adube
Copy link
Contributor Author

adube commented Apr 1, 2016

@fgravin The directive currently contains lots of copy/pasted code from many places: Luxembourg, ngeo examples, etc. The i18n text contained within the directive are a result of that. Would you please tell me what strategy I should use for the i18n ?

If you want to review what's in progress, go ahead. Keep in mind what's remaining to do (see in the description).

@fgravin
Copy link
Member

fgravin commented Apr 4, 2016

Looks good for what i've seen so far.

Would you please tell me what strategy I should use for the i18n ?

Ok i will think about it.

@fgravin
Copy link
Member

fgravin commented Apr 4, 2016

The i18n text contained within the directive are a result of that. Would you please tell me what strategy I should use for the i18n

See https://github.com/Geoportail-Luxembourg/geoportailv3/blob/30272dc5426b6c2d60d7a9aa8d5d38843ca93360/geoportailv3/static/js/measure/measuredirective.js#L138

You need to pass some html to the constructor options.
This html must be compiled ($compile) with the directive translate, this way the string will be replaced on the fly if the language change.

@adube
Copy link
Contributor Author

adube commented Apr 4, 2016

Understood. I'm on it.

@adube adube force-pushed the edit-feature-draw branch 3 times, most recently from be13c5e to 29f3abd Compare April 4, 2016 19:38
@adube adube changed the title (WIP) gmf draw feature directive Add gmf draw feature directive Apr 4, 2016
@adube
Copy link
Contributor Author

adube commented Apr 4, 2016

@fgravin This is now ready for review. The demo is up-to-date too.

controller: 'GmfDrawfeatureController',
scope: {
'active': '=gmfDrawfeatureActive',
'map': '=gmfDrawfeatureMap'
Copy link
Member

Choose a reason for hiding this comment

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

use > instead (one way binding)

@fgravin
Copy link
Member

fgravin commented Apr 5, 2016

Some minor comments, the overall looks good.
But i wonder if this shouldn't go into ngeo in a more customisable fashion.

@adube
Copy link
Contributor Author

adube commented Apr 5, 2016

Thanks for the review. I'll address the changes required.

Please, let me know if this should go into ngeo instead.

@fgravin
Copy link
Member

fgravin commented Apr 5, 2016

What i have thought of in the beginning was a directive draw like this, with the controller logic.
Then, one small directive per drawing type, requiring the draw directive, accessing its controller.

Each small directive register itself in the main controller, and adds its specific handlers.
Common handlers and whole logic would be in main draw directive, no template for this one.
It would go into ngeo.

What do you think ?

@adube
Copy link
Contributor Author

adube commented Apr 5, 2016

@fgravin and I discussed about this. It makes sense to move the draw directive in ngeo. I'm on it.

@adube adube changed the title Add gmf draw feature directive Add ngeo draw feature directive Apr 5, 2016
@adube
Copy link
Contributor Author

adube commented Apr 5, 2016

@fgravin Travis fails. I don't understand why.

@sbrunner
Copy link
Member

sbrunner commented Apr 6, 2016

You see that the error is in the animation example ... https://travis-ci.org/camptocamp/ngeo/jobs/120962154#L546, I also don't understand why it failed ...

@adube adube force-pushed the edit-feature-draw branch 3 times, most recently from 88d39bf to 07fec4f Compare April 6, 2016 17:50
@adube
Copy link
Contributor Author

adube commented Apr 6, 2016

@fgravin Now, each draw/measure directive have its own file.

I still have the build issue when making make check-examples (see Travis build error). I still don't know what's going on wrong. That prevents me from updating the live example. If you have a minute to check what's wrong I'd appreciate it.

@adube adube force-pushed the edit-feature-draw branch 2 times, most recently from 9f55ab4 to d1f0482 Compare April 7, 2016 11:37
@fgravin
Copy link
Member

fgravin commented Apr 7, 2016

Do a make hosted-exampleand test your example in compiled mode (localhost hosted-examples ..).
You'll see an error, with a link, open the link if not to long, it can give help.

Otherwise, try to remove your subdirective from the template, see if you still have the error. Try to debug step by step by removing some code to see what's going on.
You don't miss any @ngInject ?

@adube adube force-pushed the edit-feature-draw branch 2 times, most recently from bc53c2d to 451783c Compare April 7, 2016 14:43
@adube
Copy link
Contributor Author

adube commented Apr 7, 2016

@fgravin Thanks for the tip. All other examples but mine were throwing an error. That was because of the addition of gettext as dependency in ngeo. Now, all examples properly include the .js file needed.

With this, we're good to go.

@adube
Copy link
Contributor Author

adube commented Apr 7, 2016

Live example updated.

* @type {ol.interaction.Draw}
* @export
*/
this.drawPoint;
Copy link
Member

Choose a reason for hiding this comment

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

I think we should remove it from here.
Cause the main directive doesn't know what interaction it can have.
Do you agree ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mmm... I liked having those listed here. Those 6 draw/measure directives can only be used within this main drawFeature directive, and those properties identify them correctly. If one looks at this file only, one will understand the different interactions that can be bound from here.

I'm not against removing them. I just find it useful. Also, I haven't tested but this makes the properties correctly exported by closure, I think. Otherwise, we would probably need to do drawFeatureCtrl['drawPoint'] = drawPoint.

Bottom line: I'm in favour of keeping them. What do you think ?

@adube adube force-pushed the edit-feature-draw branch 3 times, most recently from 1e5d5e3 to 111dead Compare April 8, 2016 15:59
@fgravin
Copy link
Member

fgravin commented Apr 11, 2016

Can you rebase please ?

@adube
Copy link
Contributor Author

adube commented Apr 11, 2016

Done.

*/
link: function($scope, element, attrs, drawFeatureCtrl) {

var helpMsg = gettext('Click to start drawing azimut');
Copy link
Member

Choose a reason for hiding this comment

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

I don't really get it, i know it comes from Lux.
What is helpMsg value, the translation of the key ?

Does translate directive below is usefull ? I think something is redundant here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You tell me.

@fgravin fgravin merged commit 5496258 into camptocamp:master Apr 11, 2016
@@ -8,4 +8,5 @@
<span class="clear-button ng-hide"
ng-hide="!ctrl.clearButton || ctrl.input_value == ''"
ng-click="ctrl.onClearButton()"></span>
<input data-ng-model="color" data-ng-change="ctrl.setStyleColor(color)"></input>
Copy link
Member

Choose a reason for hiding this comment

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

@adube Can you please explain me what is that ? That creates a field below the search field that seems not used.
Is that an error ? What's the aim ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was part of a patch that @fgravin did for me. I hadn't noticed it, but it shouldn't have been added. You can remove this.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for these informations, I will remove that temporarily.

@adube adube deleted the edit-feature-draw branch October 17, 2016 12:55
@sbrunner sbrunner added this to the Older milestone Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants