Re: ID Recalculation



At 04.12.2009 14:08, Luis Villa wrote:
Hello all,

First of all, I want to tell you I think your work is pretty good! :)

Thanks.

I'm using Dia to create diagrams I'll use as an input to a program. For
accomplishing this, I parse the resultant xml and mix it with an internal
structure. I use 'id' attribute in 'dia:object' tags to match the xml object
with the saved internal object.
The dia:object id is not maintained during Dia's runtime. It is just generated during save to restore connections on load. But after loading the diagram again all ids are intentionally forgotten.

The problem I found is that, when I delete a
object, it seems the id is recalculated, so all internal objects are now
invalid.Does it works that way?
>
As I said the object id is already lost before the deletion. And it will also change when you change the layer or the z-order of the objects.

Is it possible to change Dia not to do this  recalculation?

Not without an extra layer of complexity I'd like to avoid. The main issue would be to ensure the uniqueness of such an id during copy, maybe even across different diagrams. Also there arise questions when to change the object id (if stored in a different diagram, on change of all object properties or only if it's name would change, etc. pp.)

Without knowing your exact use case it might be possible for you to generate your own object id and store it as

      <dia:attribute name="meta">
        <dia:composite type="dict">
          <dia:attribute name="some-id">
            <dia:string>#123#</dia:string>
          </dia:attribute>
        </dia:composite>
      </dia:attribute>

Of course that would also not solve the issues I mentioned above regarding uniqueness. The content of the 'dict' is not changed by Dia, there even is no user interface to do so at the moment.

-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it.                -- Dilbert



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]