Text entities classes structure.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Text entities classes structure.

ClaudeQC


Hello Luca,


On 2012-04-14 05:42, Luca Bellettati wrote:

>
> Hi!
> I was working on librecas to add the support of single line text to the
> application. I thought of creating a new class called RS_TextEntity in
> engine package in order to put together the common things of mtext and
> text, since many times in the project the differences between the two
> are not taken into account, but only the fact an object is a text
> entity. Am I right? In the meantime I create it and then I send it to
> you and you give me feedback, if you agree with my idea, or just discar
> it if I can do in another way.
>


On 2012-04-14 05:50, Luca Bellettati wrote:

>
> In the previous email I forget something. The class I want to create
> will take the place of rs_textdata which now is duplicate, one for text
> and one for mtext. Mine will put together what is common in the two, and
> will add the specific features in the constructor of both rs_text and
> rs_mtext class.
>

- I think it would be better keep the "rs_textdata" class, and
  make it (if not already done) the class holding common elements
  that will be used by "rs_text" and "rs_mtext" classes.

  My point is that "RS_TextEntity" looks like too much as being the
  class for the single line text entity, and thus is not a good
  class name to use for the common class.

- So, if you agree with me, we will have the following classes
  structure:

     rs_textdata --\
                         |- rs_text
                         \- rs_mtext


Regards,

Claude


Reply | Threaded
Open this post in threaded view
|

Re: Text entities classes structure.

dxli
Hi Luca,

I agree that the current rs_textdata is good enough to hold data for both rs_text and rs_mtext.

so, you may move rs_textdata definition to a separate header and be included for both. rename the current rs_text to rs_mtext, or make rs_mtext a derived class from the current rs_text.

Also, need to make sure the rs_text and rs_mtext entities are saved/read properly by libdxfrw . LibreCAD saves all rs_text to AcDbMText in dxf currently.

Feel free to choose the best design model based on your own work.

Thanks,

dxli
Reply | Threaded
Open this post in threaded view
|

Re: Text entities classes structure.

Rallaz
I agree with Dongxu (dxli)

About saved/read by libdxfrw:

MTEXT are read and translated to current rs_text
TEXT are read and converted to current rs_text

current rs_text are write as MTEXT if version are AC1015 (v2000)
current rs_text are converted and write as TEXT if version are AC1009 (v12)

That is read/write for TEXT and MTEXT are supported only require complete the rs_filterdxfrw
Reply | Threaded
Open this post in threaded view
|

Re: Text entities classes structure.

gnagno91
In reply to this post by ClaudeQC
Hi!
I agree with you about the classes. Just two things:
-woudn't be better if we use rs_stext for the single line (the new one) and rs_mtext for the old one?
-in the structure you propose to me rs_mtext and rs_text are subclasses of rs_textdata? because I thought to create a rs_textdata.h file with the general rs_texdata class and then I created other classes in rs_text.h called rs_stextdata and in rs_mtext.h called rs_mtextdata. I upload the files just to be more clear.

BR

Luca
rs_mtext.h
rs_textdata.h
rs_text.h
Reply | Threaded
Open this post in threaded view
|

Re: Text entities classes structure.

ClaudeQC

On 2012-04-15 14:56, gnagno91 [via LibreCAD] wrote:

 >
 > I agree with you about the classes. Just two things:
 > -woudn't be better if we use rs_stext for the single line (the new one)
 > and rs_mtext for the old one?
 >

- I am not aware of the implementation details of text
   entities in LibreCAD; but I know 2 things for sure.
   That 2 things is that in AutoCAD there is primarily too
   types of text entities:
        1) Entities named "TEXT" (text formatted on a single line).
        2) Entities named "MTEXT" (text formatted on multi-line).

   So, from my point of view, I think its a good idea to make LibreCAD
   class structure follow that name convention.
   i.e.: "rs_text" for "TEXT" entities, and "rs_mtext" for "MTEXT"
   entities.


 >
 > -in the structure you propose to me rs_mtext and rs_text are subclasses
 > of rs_textdata? because I thought to create a rs_textdata.h file with
 > the general rs_texdata class and then I created other classes in
 > rs_text.h called rs_stextdata and in rs_mtext.h called rs_mtextdata. I
 > upload the files just to be more clear.
 >

- I think Rallaz, Dxli and Ries can help more than me in this area.


Claude


Reply | Threaded
Open this post in threaded view
|

Re: Text entities classes structure.

dxli
In reply to this post by gnagno91
Hi Luca,

please send in a pull request at github. I set up a branch for you to send requests:

https://github.com/dxli/LibreCAD/tree/luca

thanks,

dxli
Reply | Threaded
Open this post in threaded view
|

Re: Text entities classes structure.

gnagno91
Ok. I will send this afternoon since I have to modified something according to what Claude said to me!
Luca
Reply | Threaded
Open this post in threaded view
|

Re: Text entities classes structure.

gnagno91
I had to change something and I will send a pull request in the next days.

Luca