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 = 178mb

Do 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.

Closed due to the fact that it is necessary to reformulate the question so that it was possible to give an objectively correct answer by the participants of D-side , insolor , aleksandr barakin , user194374, dirkgntly 6 Aug '16 at 7:13 .

The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    You would write books)) Your question is too vague, the audience is not clear what you want to store in the data structure, what type, what approximate volumes, etc. Formulate the question more clearly. - Firepro pm
  • one
    High requirements are complex implementation. Look at databases for example. They usually have dataset itself and indexes on it in the form of mapa of various types: hashmaps, self-balancing trees. Data is duplicated on the links, the more indexes, the higher the cost of maintaining them on write operations. And the question is too vague and subject to closure. - D-side
  • one
    "will refer to the element under the cursor without searching all the elements in the array (sheet)" - it looks like a standard case of a banal search tree. "Tree map". Being balanced, it is an almost sorted array, where each read operation is a binary search. Do you even know at what level data structures? What is the most difficult you know? - D-side
  • 2
    Here in the core and need to save memory. And graphic applications should not save, otherwise you will have self-made bicycles without properties. // In fact, I think. You need 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
  • one
    @VladD yes, I can right now say that the organization of drawing a scheme is not even the tip of the iceberg, but so, frost after a thaw. I did something similar, but not on electrics, but on vacuum systems. The main problems will be in creating a model for calculations and the calculations themselves, and some other problems, if you wipe out 2k elements and more. And if without calculations - just the same Visio can draw schemes, even the library of elements is there. - rdorn

0