Good day.
The goal is the similarity of the electrical circuit editor implemented in C # (namely, βsimilarityβ, since there is no complete analogy).
LabView is best for understanding the task. img
In order not to do copy-paste, as an example, consider the first available code .
In the code above, we are only interested in the way of storing graphical elements, namely List <Figure>.
The question is this.
What structure / algorithm / format is better to use in replacements List <Figure>, in order to improve the speed of manipulations over the large number of graphic elements?
Under conditions:
All content is dynamic in the process of adding / deleting / moving elements:
- elements change their sizes
- elements can "run over" each other and overlap each other (Z index)
- the working field changes in sizes
- the number of connection points in the elements changes
- communication lines change their route
In the previous formulation of the question, some disagreements arose, the areas bearing, to some extent, offensive and fuzzy, were cut out, the remaining moments are discussed below.
Last time I described a theoretical solution, since I see it, and not as a professional sees it.Π’Π°ΠΊΠΆΠ΅ ΡΠ°Π±ΠΎΡΠ΅Π΅ ΠΏΠΎΠ»Π΅ ΡΡΠ»ΠΎΠ²Π½ΠΎ ΡΠ°Π·Π΄Π΅Π»ΠΈΡΡ Π½Π° Π±Π»ΠΎΠΊΠΈ, ΠΈ ΡΠ°Π±ΠΎΡΠ°ΡΡ Π² ΠΎΠ΄ΠΈΠ½ ΠΌΠΎΠΌΠ΅Π½Ρ Π²ΡΠ΅ΠΌΠ΅Π½ΠΈ Ρ ΠΎΠ΄Π½ΠΈΠΌ Π±Π»ΠΎΠΊΠΎΠΌ. Π Π΅ΡΠ»ΠΈ Π² Π±Π»ΠΎΠΊΠ΅ ΠΏΠΎ ΠΏΡΠ΅ΠΆΠ½Π΅ΠΌΡ ΠΌΠ½ΠΎΠ³ΠΎ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ², ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΡ Π±ΠΈΠ½Π°ΡΠ½ΡΠΉ ΠΏΠΎΠΈΡΠΊ.
Beautiful WPF-shnye buns guzzle memory and were immediately discarded.
for example http://www.codeproject.com/Articles/23871/WPF-Diagram-Designer-Part issued - 1000 ale. = 140mb, 2000 = 178mbDo you feel sorry for the unfortunate 200M of memory? ...
In one project there may be several thousand elements.
The lines connecting the points of the elements are also separate graphic elements.
At least two points are involved in one element.
There are elements with involved 20-30-50 (and more) points.
Tens of thousands of very real numbers (or even hundreds)
If the search tree is a complex structure for you ...
Unfortunately, my profession has nothing to do with programming, just a hobby.
My knowledge in all directions is superficial.
I don't know much about trees, put it aside until I have more free time to study.
To a large extent, not a complex structure, but the complexity of its application in this formulation.
Further, my non-progersky logic says
And we did not take into account the magic combinations "Ctrl + A", "Ctrl + C" and "Ctrl + V", which will reduce all our advantages to "0".
When moving \ deleting \ adding a large number of elements, you will have to rebuild \ re-create the tree. This moment causes controversial sensations.
I am not knowledgeable enough in scientific terms, as they say, "Itβs better to see once than to hear a hundred times."
That's why I asked for a real example, I can easily figure it out by example if you understand the terms.
SortedSet. However, the number of elements on the order of hundreds and linear search in the array is fast enough. // You make a typical newbie mistake: premature optimization. First, implement your project, then find the bottleneck, and optimize it. From my experience, usually the bottleneck is not at the place where the programmer assumes. - VladD