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

WIP: Feature/street map layout #905

Closed
wants to merge 56 commits into from

Conversation

lurichte
Copy link

@lurichte lurichte commented Apr 8, 2020

Integration of Street map layout

closes #904

Description

User is able to choose between 'Squarified Treemap' and 'Street Layout' in options which then redraws the map with the corresponding layout

cc_street_ccv
CodeCharta 03/2020 with the following metrics:
Size: rloc, Height: mcc, Color: mcc

cc_street_junit
JUnit5 10/2019 with the following metrics:
Size: rloc, Height: mcc, Color: mcc

Definition of Done

A task/pull request will not be considered to be complete until all these items can be checked off.

  • All requirements mentioned in the issue are implemented
  • Does match the Code of Conduct and the Contribution file
  • Task has its own GitHub issue (something it is solving)
    • Issue number is included in the commit messages for traceability
  • Update the README.md with any changes/additions made
  • Update the CHANGELOG.md with any changes/additions made
  • Enough test coverage to ensure that uncovered changes do not break functionality
  • All tests pass
  • Descriptive pull request text, answering:
    • What problem/issue are you fixing?
    • What does this PR implement and how?
  • Assign your PR to someone for a code review
    • This person will be contacted first if a bug is introduced into master
  • Manual testing did not fail

@Richargh
Copy link

Richargh commented Apr 8, 2020

Do you have a screenshot for us? :D

@alschmut alschmut added the pr-visualization Issues that touch the visualization pr(oject) which means web and desktop features. label Apr 10, 2020
export enum LayoutAlgorithm {
SquarifiedTreeMap = "Squarified TreeMap",
StreetMap = "StreetMap",
TMStreet = "TMStreet"
Copy link
Contributor

Choose a reason for hiding this comment

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

This was the TreeMap Street, which combines Squarified and the Street right? I would then rather use some more descriptive name. Either TreeMapStreet or maybe you have more ideas?

import { maxTreeMapFiles } from "../../state/store/appSettings/maxTreeMapFiles/maxTreeMapFiles.reducer"
import _ from "lodash"

describe("MaxTreeMapFilesController", () => {
Copy link
Contributor

@alschmut alschmut Apr 20, 2020

Choose a reason for hiding this comment

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

Add tests for the methods onMaxTreeMapFilesChanged() and onChangeMaxTreeMapFilesSlider() as well as the constructor setting the maxTreeMapFiles. You can have a look at the layoutSelection.component.spec.ts, which is quite similar

Comment on lines +16 to +18
const maxTreeMapFiles = this.storeService.getState().appSettings.maxTreeMapFiles
this.onMaxTreeMapFilesChanged(maxTreeMapFiles)
this._viewModel.maxTreeMapFiles = maxTreeMapFiles
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you extract that in a function called initOnOpenDialog() or similar? Otherwise somebody might remove the lines, as it looks like a duplicate for onMaxTreeMapFilesChanged(), but it is needed as a closed (non existing) dialog, does not receive events.

And remove line 18, as this one is a duplicate of the function call in onMaxTreeMapFilesChanged() :)

Comment on lines +12 to 20
"depth": 0,
"edgeAttributes": undefined,
"flat": false,
"height": 100,
"heightDelta": 33,
"incomingEdgePoint": Vector3 {
"x": 199,
"y": 102,
"y": 100,
"z": 99,
Copy link
Contributor

@alschmut alschmut Apr 20, 2020

Choose a reason for hiding this comment

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

Why are there some coordinates changing by 1 or 2? Same for the rest of the file

Comment on lines +7 to +12
export interface LayoutNode {
data: CodeMapNode
value: number
rect: Rectangle
zOffset: number
}
Copy link
Contributor

Choose a reason for hiding this comment

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

As this is our own generic interface, I would rename some of the properties to be more readable

export interface LayoutNode {
	node: CodeMapNode
	areaValue: number
	rectangle: Rectangle
	zOffset: number
}

return !node.children || node.children.length === 0
}

public static mergeDirectories(node: CodeMapNode, metricName: string): CodeMapNode {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you shortly explain what this method does and why it is needed?

Comment on lines +14 to +19
export interface StreetLayoutValuedCodeMapNode {
data: CodeMapNode
value: number
rect: Rectangle
zOffset: number
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets remove this interface and use the other LayoutNode which is the same, since we refactored some code

Copy link
Contributor

@alschmut alschmut Apr 20, 2020

Choose a reason for hiding this comment

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

After having a deeper look at the code I have a better idea. Let's:

  • keep the interface, but rename it to StreetLayoutNode (its still good enough isn't it?)
  • remove its properties and extend the LayoutNode (yes, those interface are then the same for now, but make future additions very easy to apply)

That means, we can have different interfaces for each individual layoutAlgorithm, but when building the Node[] inside the LayoutHelper, we always cast/map those to a LayoutNode

})
}

private static createBoxes(
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you refactor that method to be shorter and/or split into multiple more readable methods?

Comment on lines +164 to +173
public static calculateSize(node: CodeMapNode, metricName: string) {
let totalSize = node.attributes[metricName] || 0

if (totalSize === 0 && node.children && node.children.length > 0) {
for (const child of node.children) {
totalSize += LayoutHelper.calculateSize(child, metricName)
}
}
return totalSize
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you aware of that for folder nodes, the sum of its children is set inside the NodeDecorator.decorateParentNodesWithAggregatedAttributes())? The nodes contain that sum/median depending on the attributeType.

Copy link
Contributor

@alschmut alschmut left a comment

Choose a reason for hiding this comment

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

As already said, combining the StreetMapLayout with CodeCharta was probably already a wish since the TestVille project was forked many years ago. So we really appreciate your hard work on your self written algorithms 🚀🥳 Overall the code looks really good! Just got some questions and comments. No need to be worried ✌️

Important! I didn't have a close look into the actual algorithm, so maybe somebody else would like to do that?

Inside the algorithm classes there are quite a lot of comments. Some are almost duplicates of the function name, some give a bit more information. I personally prefer accurate method names than having a bunch of comments. Maybe you can remove some comments or replace those by a more specific method name. @NearW what do you think?

And finally, as the algorithm classes contain quite some logic, those should also be unit tested (with human sense) like for every other class in the project.

And like always, whenever you have questions, just ask ;)

@alschmut alschmut self-assigned this Apr 23, 2020
@CodeCharta CodeCharta changed the title Feature/street map layout WIP: Feature/street map layout Apr 24, 2020
@NearW NearW marked this pull request as draft July 28, 2020 00:35
@NearW NearW changed the base branch from master to main August 3, 2020 08:27
@Med-H Med-H self-assigned this Dec 10, 2020
@Med-H Med-H added this to In progress in CC via automation Dec 10, 2020
@Med-H Med-H mentioned this pull request Dec 14, 2020
8 tasks
ce-bo added a commit that referenced this pull request Dec 21, 2020
ce-bo added a commit that referenced this pull request Dec 21, 2020
ce-bo added a commit that referenced this pull request Dec 23, 2020
* initial street layout introduction

* may be a  fix for e2e filechooser test

* street layout flattening fix, filechooser e2e fix, global setting dialog layout improvement, code refactoring

* fixed TMStreet layout

* added max treemap files

* fixing linting, added remark about e2e falky test fix, added streetlayout todo

* edited changelog

* fixes after @BridgeAR review

* updated changelog

* Apply code formating #1543

* Update visualization/app/codeCharta/ui/maxTreeMapFiles/maxTreeMapFiles.component.ts

* Update visualization/app/codeCharta/util/algorithm/streetLayout/horizontalStreet.ts

* Update visualization/app/codeCharta/streetLayoutTodo.md

* Update visualization/app/codeCharta/util/algorithm/streetLayout/streetViewHelper.ts

* Update visualization/app/codeCharta/util/algorithm/streetLayout/verticalStreet.ts

* Update visualization/app/codeCharta/util/algorithm/treeMapLayout/treeMapHelper.ts

* Improve identation #905

* Merge main, Fix label position conflicts #905

* Fix scaling bug and improve performance

* Fix label positioning bug on mouse move, Apply minor refactorings.

* Add regression tests for label scaling/positioning bugs

* Fix temporary label bug: reset on map move/turn

Co-authored-by: Cedrik Bormann <cedrikbormann@gmail.com>
Co-authored-by: Cedrik Bormann <26900540+ce-bo@users.noreply.github.com>
@BridgeAR
Copy link
Member

Closing as it is superseded by another PR that was merged by now. @lurichte thank you very much for all the work!

@BridgeAR BridgeAR closed this Dec 24, 2020
CC automation moved this from In progress to Done Dec 24, 2020
shaman-apprentice pushed a commit that referenced this pull request Jan 11, 2021
* initial street layout introduction

* may be a  fix for e2e filechooser test

* street layout flattening fix, filechooser e2e fix, global setting dialog layout improvement, code refactoring

* fixed TMStreet layout

* added max treemap files

* fixing linting, added remark about e2e falky test fix, added streetlayout todo

* edited changelog

* fixes after @BridgeAR review

* updated changelog

* Apply code formating #1543

* Update visualization/app/codeCharta/ui/maxTreeMapFiles/maxTreeMapFiles.component.ts

* Update visualization/app/codeCharta/util/algorithm/streetLayout/horizontalStreet.ts

* Update visualization/app/codeCharta/streetLayoutTodo.md

* Update visualization/app/codeCharta/util/algorithm/streetLayout/streetViewHelper.ts

* Update visualization/app/codeCharta/util/algorithm/streetLayout/verticalStreet.ts

* Update visualization/app/codeCharta/util/algorithm/treeMapLayout/treeMapHelper.ts

* Improve identation #905

* Merge main, Fix label position conflicts #905

* Fix scaling bug and improve performance

* adding layout reset behavior

* Fix hard coded year in unit test

* fix #1624

* fix #1624

* fix test

* fix test

* fix test

* fix flaky test

* fix flaky test

* fix flaky Integration test

* added agenda regression tests for 53 week years

* Update CalendarWeekTest.kt

* Update CalendarWeekTest.kt

* Update CalendarWeekTest.kt

* possible fix for flaky test timeout

* added some comments & updated changelog

* remove trailing spaces

Co-authored-by: Cedrik Bormann <cedrikbormann@gmail.com>
Co-authored-by: Cedrik Bormann <26900540+ce-bo@users.noreply.github.com>
Co-authored-by: Torsten Knauf <Torsten.Knauf@maibornwolff.de>
Med-H pushed a commit that referenced this pull request Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-visualization Issues that touch the visualization pr(oject) which means web and desktop features.
Projects
No open projects
CC
  
Done
Development

Successfully merging this pull request may close these issues.

Integration of Streetlayout as an optional layout algorithm
5 participants