Skip to content

new DrawCoordinate command added#329

Merged
fgdrf merged 5 commits into
locationtech:masterfrom
nprigour:DrawCoordinateCommand
Aug 23, 2019
Merged

new DrawCoordinate command added#329
fgdrf merged 5 commits into
locationtech:masterfrom
nprigour:DrawCoordinateCommand

Conversation

@nprigour

Copy link
Copy Markdown
Contributor

a new DrawCoordinateCommand to UDIG's list of draw commands

@nprigour

nprigour commented Mar 7, 2019

Copy link
Copy Markdown
Contributor Author

Hi @fgdrf ,
What about this PR? This command may not be used in udig application at present but it might be useful for potential users of the udig SDK library (you can regard me as a such user 👍 )

this.useCircle = useCircle;
}

@Override

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm wondering if I haven't seen or even found a test case for this. Any chance to provide usefull tests?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes there is no test case as is the case with all DrawCommands. If you think it absolutely necessary, maybe I can provide a test in the form of a test menu item that draws a circle at a coordinate on a map. But it could be tested manually and not be automated. What do you think?

(int) Math.abs(points[2] - points[0]),
(int) Math.abs(points[3] - points[1]));
} catch (TransformException e) {
if (!errorReported) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

does it mean to ignore the first error and write any other to log after that (because errorReported is set to true)? Wondering about the semantic of the variable. I guess it would help me to understand if you could describe the flow?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Actually as mentioned and in a previous comment this draw command was based on the DrawFeatureCommand. So I retain the logic adopted there without checking it further.


public void setValid(boolean valid) {
super.setValid(valid);
if (!valid)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it necessary to overwride setValid() here? My read of ViewportPainter is that commands get disposed from within clearCommands. I guess you can remove method setValid from class because no additional behavior is required here to implement (for example removing listeners).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Indeed it is not. I will remove it in a following commit

/**
* @return Returns the paint.
*/
public Paint getPaint() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this the paintColor for the Coordinate? I guess because internally its a Color object it should return Color here as well. I generall I prefer members to name what it is for, ig. paintColor with named getters and setters (like you almost did for the lineStyle ;))

@nprigour nprigour Mar 7, 2019

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK I will fix it in the next commit.

* @param lineStyle the style of the line
* @param lineWidth the width of the line
*/
public void setStroke(int lineStyle, int lineWidth) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Confusion for me: Here you set two different properties at once. Why not having two different settes for lineStyle (Would an Enum help here btw?) and lineWidth?

Ohh, I guess lineStyle is one of ViewportGraphics.LINE_XXX stroke styles and your implementation is based on DrawShapeCommand or something familiar, don't you?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes indeed

Signed-off-by: Nikolaos Pringouris <nprigour@gmail.com>
Signed-off-by: Nikolaos Pringouris <nprigour@gmail.com>
Signed-off-by: Nikolaos Pringouris <nprigour@gmail.com>
Signed-off-by: Nikolaos Pringouris <nprigour@gmail.com>
@nprigour nprigour force-pushed the DrawCoordinateCommand branch from fb6bb51 to 3cf777b Compare March 10, 2019 15:17
Signed-off-by: Nikolaos Pringouris <nprigour@gmail.com>
@nprigour

Copy link
Copy Markdown
Contributor Author

Hi @fgdrf ,

I added a test handler which can be used for testing DrawCoordinateCommand via the UI. The handler centers viewport in the input coordinate and draws a flashing dot for a couple os seconds (see screenshot below)
εικόνα

@nprigour

Copy link
Copy Markdown
Contributor Author

Hi @fgdrf ,

what about this PR? It's been quite some time since the test handler was added. Shouldn't we merge and close it?

@fgdrf fgdrf added this to the 2.1.0 milestone Aug 23, 2019
@fgdrf fgdrf added the feature label Aug 23, 2019
@fgdrf fgdrf merged commit bb15896 into locationtech:master Aug 23, 2019
fgdrf pushed a commit to fgdrf/udig-platform that referenced this pull request Dec 23, 2019
* Adds a new DrawCoordinateCommand to UDIG's list of draw commands

Signed-off-by: Nikolaos Pringouris <nprigour@gmail.com>

* change default shape used for coordination display

Signed-off-by: Nikolaos Pringouris <nprigour@gmail.com>

* correct useCircle field getter/setter to be public

Signed-off-by: Nikolaos Pringouris <nprigour@gmail.com>

* remove setValid(...) from class and fix return type of getPaint

Signed-off-by: Nikolaos Pringouris <nprigour@gmail.com>

* added test handler for testing DrawCoordinate command

Signed-off-by: Nikolaos Pringouris <nprigour@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants