Unique ID and file merging?

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

Unique ID and file merging?

Postby HPW » March 15th, 2006, 3:22 pm

Kambiz,

A question to unique ID and file merging:

Will the new objects merged into a given Graph gets all new ID's then?
Or how does it work?
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby HPW » March 20th, 2006, 7:01 am

2.1/2.2 has given the answer.
:wink:
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby kokkoras » March 20th, 2006, 9:13 am

IMHO, they must keep their value, since they are IDs (GUIDs ?). What was the approach followed?
(sorry, no time at the moment to check the lib in depth)
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby HPW » March 20th, 2006, 10:43 am

No they can/do not keep their value, it would be impossible to have 2 equal ID in one Graph. So when you have 3 node with ID 1,2,3 and you reimport them with merge you end up with 4,5,6. They are DWORD's(4 Bytes=32BIT 0..4294967295)
On copy/merge each node-ID is incremented until it finds a free number.
So copy node 3 will become 4 but ony when free. When 4+5 is in use it becomes 6.

When you want GUID's then you could store them with the new customdata. But only when you want to have a copied node to have the same GUID as his original.
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby kokkoras » March 20th, 2006, 11:45 am

HPW wrote:No they can/do not keep their value, it would be impossible to have 2 equal ID in one Graph. So when you have 3 node with ID 1,2,3 and you reimport them with merge you end up with 4,5,6. They are DWORD's(4 Bytes=32BIT 0..4294967295)
On copy/merge each node-ID is incremented until it finds a free number.
So copy node 3 will become 4 but ony when free. When 4+5 is in use it becomes 6.

When you want GUID's then you could store them with the new customdata. But only when you want to have a copied node to have the same GUID as his original.


I see. I had the impression (fron some old posts) that these IDs were GUIDs. Anyway, it this case I think the approach used works for many cases and it's ok. It woulb be nice though to have this behaviour as default and have the ability to hook our ID generation function/procedure.

Are these IDs used internaly by the library? Or they are just there for end-user use?
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby HPW » March 20th, 2006, 12:47 pm

Are these IDs used internaly by the library? Or they are just there for end-user use?


Since they are new since 2.1, I think they are not used by the library. (Kambiz?)
But they are maintained by the library as a service, so they are readonly.
And there are new function like 'FindObjectByID' which are very usefull to access a special node.
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby kokkoras » March 20th, 2006, 12:53 pm

HPW wrote:And there are new function like 'FindObjectByID' which are very usefull to access a special node.


Eventualy, Kambiz included in the library a lot of the functionality that I had implemented in my app, in which I used TSimpleGraph for visualization only. We almost use the same function names :shock:
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby Kambiz » March 20th, 2006, 12:54 pm

ID property and FindObjectByID method are not new. They were since the initial release of the control, but they were in protected section.

ID is used to keep track of referenced objects by the other objects. For example, TGraphLink saves IDs of Source and Target objects in to a stream.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby kokkoras » March 20th, 2006, 1:02 pm

Kambiz wrote:ID is used to keep track of referenced objects by the other objects.


That makes their presence more that critical.
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece


Return to DELPHI AREA Products

Who is online

Users browsing this forum: No registered users and 2 guests

cron