-
Notifications
You must be signed in to change notification settings - Fork 30
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
Conversation
Do you have a screenshot for us? :D |
…te/codecharta into feature/street-map-layout
…te/codecharta into feature/street-map-layout
export enum LayoutAlgorithm { | ||
SquarifiedTreeMap = "Squarified TreeMap", | ||
StreetMap = "StreetMap", | ||
TMStreet = "TMStreet" |
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 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", () => { |
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.
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
const maxTreeMapFiles = this.storeService.getState().appSettings.maxTreeMapFiles | ||
this.onMaxTreeMapFilesChanged(maxTreeMapFiles) | ||
this._viewModel.maxTreeMapFiles = maxTreeMapFiles |
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.
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()
:)
"depth": 0, | ||
"edgeAttributes": undefined, | ||
"flat": false, | ||
"height": 100, | ||
"heightDelta": 33, | ||
"incomingEdgePoint": Vector3 { | ||
"x": 199, | ||
"y": 102, | ||
"y": 100, | ||
"z": 99, |
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.
Why are there some coordinates changing by 1 or 2? Same for the rest of the file
export interface LayoutNode { | ||
data: CodeMapNode | ||
value: number | ||
rect: Rectangle | ||
zOffset: number | ||
} |
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.
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 { |
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.
Can you shortly explain what this method does and why it is needed?
export interface StreetLayoutValuedCodeMapNode { | ||
data: CodeMapNode | ||
value: number | ||
rect: Rectangle | ||
zOffset: number | ||
} |
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.
Lets remove this interface and use the other LayoutNode
which is the same, since we refactored some 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.
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( |
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.
Can you refactor that method to be shorter and/or split into multiple more readable methods?
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 | ||
} |
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.
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.
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.
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 ;)
* 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>
Closing as it is superseded by another PR that was merged by now. @lurichte thank you very much for all the work! |
* 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>
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
CodeCharta 03/2020 with the following metrics:
Size: rloc, Height: mcc, Color: mcc
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.
master