Segmentation fault in RS_EntityContainer::optimizeContours()

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

Segmentation fault in RS_EntityContainer::optimizeContours()

Erik
Hello,

on loading my librecad-project (see 20120418_Dachstudio.dxf) I got a segmentation fault in method optimizeContours().


   :
SS-SL-LR
8
62
256
62
370
-1
370
6
ByLayer
6
100
AcDbEntity
100
100
AcDbHatch
100
10
0
10
20
0
20
30
0
30
210
0
210
220
0
220
230
1
230
2
SOLID
2
70
1
70
71
0
71
91
1
91
92
1
92
93
4
93
72
1
72
10
9972
10
20
861.5
20
11
9972
11
21
856.5
21
72
1
72
10
9972
10
20
856.5
20
11
9963
11
21
856.5
21
72
1
72
10
9963
10
20
856.5
20
11
9963
11
21
861.5
21
72
1
72
10
9963
10
20
861.5
20
11
9972
11
21
861.5
21
97
0
97
75
0
75
76
1
76
98
0
98
0
HATCH
0
HATCH
Speicherzugriffsfehler (segmenation fault)


I've the same problem with the git-hub-version form 18-04-2012 and the latest ubuntu 11.04 version (2.0.0~alpha2+yeslib20121041136.693+20120416+cc440c9-0ubuntu0~daily7~natty1, 2.0.0~alpha2+yeslib20121041136.693+20120417+cc440c9-0ubuntu0~daily7~natty1).

I find out, that there is no handling for the case next is an pointer to NULL. This NULL pointer comes from the instuction getNearestEndpoint(vpEnd,&dist,&next);.

May be there is a bug with saving a project in an earlier version, too.

For me a the moment I fixed it quick and dirty (see marked lines).
If next is NULL, I exit the count()-loop. Hopefully there is no Problem with other contexts, because of this soulution.

**
 * Rearranges the atomic entities in this container in a way that connected
 * entities are stored in the right order and direction.
 * Non-recoursive. Only affects atomic entities in this container.
 *
 * @retval true all contours were closed
 * @retval false at least one contour is not closed

 * to do: find closed contour by flood-fill
 */
bool RS_EntityContainer::optimizeContours() {
//    std::cout<<"RS_EntityContainer::optimizeContours: begin"<<std::endl;

    RS_DEBUG->print("RS_EntityContainer::optimizeContours");

    RS_EntityContainer tmp;
    tmp.setAutoUpdateBorders(false);
    bool closed=true;

    /** accept all full circles **/
    QList<RS_Entity*> enList;
    for (uint ci=0; ci<count(); ++ci) {
        RS_Entity* e1=entityAt(ci);
        if (!e1->isEdge() || e1->isContainer() ) {
            enList<<e1;
            continue;
        }
        if(e1->rtti()==RS2::EntityCircle) {
            //directly detect circles, bug#3443277
            tmp.addEntity(e1->clone());
            enList<<e1;
            continue;
        }
    }
    //    std::cout<<"RS_EntityContainer::optimizeContours: 1"<<std::endl;

    const auto itEnd=enList.end();
    for(auto it=enList.begin();it!=itEnd;it++){
        removeEntity(*it);
    }

    /** check and form a closed contour **/
//    std::cout<<"RS_EntityContainer::optimizeContours: 2"<<std::endl;
    /** the first entity **/
    RS_Entity* current(NULL);
    if(count()>0) {
        current=entityAt(0)->clone();
        tmp.addEntity(current);
        removeEntity(entityAt(0));
    }else return false;
//    std::cout<<"RS_EntityContainer::optimizeContours: 3"<<std::endl;
    RS_Vector vpStart;
    RS_Vector vpEnd;
    if(current!=NULL){
        vpStart=current->getStartpoint();
        vpEnd=current->getEndpoint();
    }
        RS_Entity* next(NULL);
//    std::cout<<"RS_EntityContainer::optimizeContours: 4"<<std::endl;
    /** connect entities **/
    while(count()>0){
        double dist(0.);
        getNearestEndpoint(vpEnd,&dist,&next);
        if(dist>1e-4) {
            if(vpEnd.squaredTo(vpStart)<1e-8){
                RS_Entity* e2=entityAt(0);
                tmp.addEntity(e2->clone());
                vpStart=e2->getStartpoint();
                vpEnd=e2->getEndpoint();
                removeEntity(e2);
                continue;
            }
            closed=false;
        }
if (next) { // my workaround
        if(vpEnd.squaredTo(next->getStartpoint())<1e-8){
            vpEnd=next->getEndpoint();
        }else{
            vpEnd=next->getStartpoint();
        }
        next->setProcessed(true);
        tmp.addEntity(next->clone());
         removeEntity(next);
}else{       // my workaround
  closed=false;  // my workaround
  break;           // my workaround
}                    // my workaround
    }
    if( vpEnd.squaredTo(vpStart)>1e-8) closed=false;
//    std::cout<<"RS_EntityContainer::optimizeContours: 5"<<std::endl;


    // add new sorted entities:
    for (RS_Entity* en=tmp.firstEntity(); en!=NULL; en=tmp.nextEntity()) {
        en->setProcessed(false);
        addEntity(en->clone());
    }
//    std::cout<<"RS_EntityContainer::optimizeContours: 6"<<std::endl;

    RS_DEBUG->print("RS_EntityContainer::optimizeContours: OK");
//    std::cout<<"RS_EntityContainer::optimizeContours: end: count()="<<count()<<std::endl;
//    std::cout<<"RS_EntityContainer::optimizeContours: closed="<<closed<<std::endl;
    return closed;
}

Maybe there is a problem with the count()-method, too.

Best Regards

Erik
(From Germany)

P.S.: First I want to open a bug-request, but it isn't allowed to do this as anonymous. How can I register for bug-reports ?)
Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault in RS_EntityContainer::optimizeContours()

dxli

hi Erik,

between 2.0.0alpha2 and alpha3, I rewrote the optimizeContours() function. it would be interesting to find out how it segfaults with alpha2.

your fix is very good to me. can you send a pull request to the official repository? I should merge it before investigating why getNearestEndpoint() returns small distance and NULL pointer. we should ensure this doesn't happen. my wild guess is about entities without any endpoint defined, say, circle, full ellipse.

we have to improve the hatch creation algorithms. to allow more contour types: ellipses, splines, bezier curves( not implemented yet), and to allow simpler contour selection, say, by flood filling. we should use boost geometry algorithms more.

I'm currently busy implementing hyperbola and parabola. you are very welcome to help librecad development.

thanks a lot!

Dongxu
On Apr 19, 2012 3:15 AM, "Erik [via LibreCAD]" <[hidden email]> wrote:
>
> Hello,
>
> on loading my librecad-project (see 20120418_Dachstudio.dxf) I got a segmentation fault in method optimizeContours().
>
>
>    :
> SS-SL-LR
> 8
> 62
> 256
> 62
> 370
> -1
> 370
> 6
> ByLayer
> 6
> 100
> AcDbEntity
> 100
> 100
> AcDbHatch
> 100
> 10
> 0
> 10
> 20
> 0
> 20
> 30
> 0
> 30
> 210
> 0
> 210
> 220
> 0
> 220
> 230
> 1
> 230
> 2
> SOLID
> 2
> 70
> 1
> 70
> 71
> 0
> 71
> 91
> 1
> 91
> 92
> 1
> 92
> 93
> 4
> 93
> 72
> 1
> 72
> 10
> 9972
> 10
> 20
> 861.5
> 20
> 11
> 9972
> 11
> 21
> 856.5
> 21
> 72
> 1
> 72
> 10
> 9972
> 10
> 20
> 856.5
> 20
> 11
> 9963
> 11
> 21
> 856.5
> 21
> 72
> 1
> 72
> 10
> 9963
> 10
> 20
> 856.5
> 20
> 11
> 9963
> 11
> 21
> 861.5
> 21
> 72
> 1
> 72
> 10
> 9963
> 10
> 20
> 861.5
> 20
> 11
> 9972
> 11
> 21
> 861.5
> 21
> 97
> 0
> 97
> 75
> 0
> 75
> 76
> 1
> 76
> 98
> 0
> 98
> 0
> HATCH
> 0
> HATCH
> Speicherzugriffsfehler (segmenation fault)
>
>
> I've the same problem with the git-hub-version form 18-04-2012 and the latest ubuntu 11.04 version (2.0.0~alpha2+yeslib20121041136.693+20120416+cc440c9-0ubuntu0~daily7~natty1, 2.0.0~alpha2+yeslib20121041136.693+20120417+cc440c9-0ubuntu0~daily7~natty1).
>
> I find out, that there is no handling for the case next is an pointer to NULL. This NULL pointer comes from the instuction getNearestEndpoint(vpEnd,&dist,&next);.
>
> May be there is a bug with saving a project in an earlier version, too.
>
> For me a the moment I fixed it quick and dirty (see marked lines).
> If next is NULL, I exit the count()-loop. Hopefully there is no Problem with other contexts, because of this soulution.
>
> **
>  * Rearranges the atomic entities in this container in a way that connected
>  * entities are stored in the right order and direction.
>  * Non-recoursive. Only affects atomic entities in this container.
>  *
>  * @retval true all contours were closed
>  * @retval false at least one contour is not closed
>
>  * to do: find closed contour by flood-fill
>  */
> bool RS_EntityContainer::optimizeContours() {
> //    std::cout<<"RS_EntityContainer::optimizeContours: begin"<<std::endl;
>
>     RS_DEBUG->print("RS_EntityContainer::optimizeContours");
>
>     RS_EntityContainer tmp;
>     tmp.setAutoUpdateBorders(false);
>     bool closed=true;
>
>     /** accept all full circles **/
>     QList<RS_Entity*> enList;
>     for (uint ci=0; ci<count(); ++ci) {
>         RS_Entity* e1=entityAt(ci);
>         if (!e1->isEdge() || e1->isContainer() ) {
>             enList<<e1;
>             continue;
>         }
>         if(e1->rtti()==RS2::EntityCircle) {
>             //directly detect circles, bug#3443277
>             tmp.addEntity(e1->clone());
>             enList<<e1;
>             continue;
>         }
>     }
>     //    std::cout<<"RS_EntityContainer::optimizeContours: 1"<<std::endl;
>
>     const auto itEnd=enList.end();
>     for(auto it=enList.begin();it!=itEnd;it++){
>         removeEntity(*it);
>     }
>
>     /** check and form a closed contour **/
> //    std::cout<<"RS_EntityContainer::optimizeContours: 2"<<std::endl;
>     /** the first entity **/
>     RS_Entity* current(NULL);
>     if(count()>0) {
>         current=entityAt(0)->clone();
>         tmp.addEntity(current);
>         removeEntity(entityAt(0));
>     }else return false;
> //    std::cout<<"RS_EntityContainer::optimizeContours: 3"<<std::endl;
>     RS_Vector vpStart;
>     RS_Vector vpEnd;
>     if(current!=NULL){
>         vpStart=current->getStartpoint();
>         vpEnd=current->getEndpoint();
>     }
>         RS_Entity* next(NULL);
> //    std::cout<<"RS_EntityContainer::optimizeContours: 4"<<std::endl;
>     /** connect entities **/
>     while(count()>0){
>         double dist(0.);
>         getNearestEndpoint(vpEnd,&dist,&next);
>         if(dist>1e-4) {
>             if(vpEnd.squaredTo(vpStart)<1e-8){
>                 RS_Entity* e2=entityAt(0);
>                 tmp.addEntity(e2->clone());
>                 vpStart=e2->getStartpoint();
>                 vpEnd=e2->getEndpoint();
>                 removeEntity(e2);
>                 continue;
>             }
>             closed=false;
>         }
> if (next) { // my workaround
>         if(vpEnd.squaredTo(next->getStartpoint())<1e-8){
>             vpEnd=next->getEndpoint();
>         }else{
>             vpEnd=next->getStartpoint();
>         }
>         next->setProcessed(true);
>         tmp.addEntity(next->clone());
>          removeEntity(next);
> }else{       // my workaround
>   closed=false;  // my workaround
>   break;           // my workaround
> }                    // my workaround
>     }
>     if( vpEnd.squaredTo(vpStart)>1e-8) closed=false;
> //    std::cout<<"RS_EntityContainer::optimizeContours: 5"<<std::endl;
>
>
>     // add new sorted entities:
>     for (RS_Entity* en=tmp.firstEntity(); en!=NULL; en=tmp.nextEntity()) {
>         en->setProcessed(false);
>         addEntity(en->clone());
>     }
> //    std::cout<<"RS_EntityContainer::optimizeContours: 6"<<std::endl;
>
>     RS_DEBUG->print("RS_EntityContainer::optimizeContours: OK");
> //    std::cout<<"RS_EntityContainer::optimizeContours: end: count()="<<count()<<std::endl;
> //    std::cout<<"RS_EntityContainer::optimizeContours: closed="<<closed<<std::endl;
>     return closed;
> }
>
> Maybe there is a problem with the count()-method, too.
>
> Best Regards
>
> Erik
> (From Germany)
>
> P.S.: First I want to open a bug-request, but it isn't allowed to do this as anonymous. How can I register for bug-reports ?)
>
> ________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://forum.librecad.org/Segmentation-fault-in-RS-EntityContainer-optimizeContours-tp5651061p5651061.html
> To start a new topic under LibreCAD-dev, email [hidden email]
> To unsubscribe from LibreCAD-dev, click here.
> NAML

Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault in RS_EntityContainer::optimizeContours()

Erik
Hello,

I send the pull request now.

Tanks a lot.

Erik
Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault in RS_EntityContainer::optimizeContours()

dxli
Hi Erik,

I digged a little bit more on the cause of NULL pointers. It seems to be requirement of visible entities when searching for the nearest endpoint. https://github.com/LibreCAD/LibreCAD/commit/a4006c521122d3e5524e2999c8024c949c683a83

We'd better cleanup the current algorithm. After that, we need to enable a smart contour detection (flood fill), enable hatch creation for ellipse border.

I do hope we can work together to make LibreCAD better.

Regards,

Dongxu

On Fri, Apr 20, 2012 at 12:12 PM, Erik [via LibreCAD] <[hidden email]> wrote:
Hello,

I send the pull request now.

Tanks a lot.

Erik


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/Segmentation-fault-in-RS-EntityContainer-optimizeContours-tp5651061p5654663.html
To start a new topic under LibreCAD-dev, email [hidden email]
To unsubscribe from LibreCAD-dev, click here.
NAML



--
Dongxu Li, Ph.D.
www.librecad.org

Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault in RS_EntityContainer::optimizeContours()

Erik
Hi Dongxu,

I'm sure we can work together. At the moment I've no experience with Qt and only very less experience with c++, but good experience with c.

Because of a strong accident round about 10 years ago I'm not able to work again as a development engineer with focus on embedded systems. But I think there are some things I can do to help the librecad team.

I don't find any possibility to build a debug version. I don't know if there is a direct possibility with qmake.

For me I changed the the common.pro

from

  QMAKE_CXXFLAGS += -std=c++0x

to

  QMAKE_CXXFLAGS += -std=c++0x -g

There must be a better way to build a debugger version.

Because of the algorithm, I hope I've a little bit time in the next few days, to understand and have a look on it.

Best Regards,

Erik
(from Germany)
Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault in RS_EntityContainer::optimizeContours()

R. van Twisk
Administrator
Eric,

the best we to work with LibreCAD if you are not familiar with Qt is to fire up Qt Creator.
It has options to generate debug and release code where you can step easily through 
the code from the IDE.

Simple set at the bottom left of the IDE the project to Debug and to a full build.
Then you can set your breakpoints and all that to stop at the right
line and inspect variables.


Ries



On Apr 23, 2012, at 8:07 AM, Erik [via LibreCAD] wrote:

Hi Dongxu,

I'm sure we can work together. At the moment I've no experience with Qt and only very less experience with c++, but good experience with c.

Because of a strong accident round about 10 years ago I'm not able to work again as a development engineer with focus on embedded systems. But I think there are some things I can do to help the librecad team.

I don't find any possibility to build a debug version. I don't know if there is a direct possibility with qmake.

For me I changed the the common.pro

from

  QMAKE_CXXFLAGS += -std=c++0x

to

  QMAKE_CXXFLAGS += -std=c++0x -g

There must be a better way to build a debugger version.

Because of the algorithm, I hope I've a little bit time in the next few days, to understand and have a look on it.

Best Regards,

Erik
(from Germany)


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/Segmentation-fault-in-RS-EntityContainer-optimizeContours-tp5651061p5659354.html
To start a new topic under LibreCAD, email [hidden email]
To unsubscribe from LibreCAD, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault in RS_EntityContainer::optimizeContours()

Rallaz
In reply to this post by Erik
Eric,
I agree with Ries but, if you want to use konsole (1)
the change are:
CONFIG += debug

highly recommended:

http://qt-project.org/doc/qt-4.8/qmake-project-files.html
http://qt-project.org/doc/qt-4.8/qmake-running.html

Qtcreator are very powerful:
debbuger, variable inspector, valgrind, Qt help, class viewer and more...

(1) I like KDE ;-)
Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault in RS_EntityContainer::optimizeContours()

dxli
Hi,

I mostly use my own building scripts in archlinux:

make sure I add CXXFLAGS="-g" and not stripe the binary after compiling. I run gdb manually to debug after that.

I may have to learn how to debug in qtcreator. I use qtcreator only as an editor (class viewer) with fakevim mode.

Dongxu

On Mon, Apr 23, 2012 at 11:07 AM, Rallaz [via LibreCAD] <[hidden email]> wrote:
Eric,
I agree with Ries but, if you want to use konsole (1)
the change are:
CONFIG += debug

highly recommended:

http://qt-project.org/doc/qt-4.8/qmake-project-files.html
http://qt-project.org/doc/qt-4.8/qmake-running.html

Qtcreator are very powerful:
debbuger, variable inspector, valgrind, Qt help, class viewer and more...

(1) I like KDE ;-)


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/Segmentation-fault-in-RS-EntityContainer-optimizeContours-tp5651061p5659632.html
To start a new topic under LibreCAD-dev, email [hidden email]
To unsubscribe from LibreCAD-dev, click here.
NAML



--
Dongxu Li, Ph.D.
www.librecad.org

Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault in RS_EntityContainer::optimizeContours()

Rallaz
dxli wrote
make sure I add CXXFLAGS="-g" and not stripe the binary after compiling. I
run gdb manually to debug after that.
CONFIG += debug
simply add -g -O0 -Wall
and CONFIG += release  -O2

I may have to learn how to debug in qtcreator. I use qtcreator only as an
editor (class viewer) with fakevim mode.

Dongxu
see the screenshot attached by Ries:
the first green arrow are run, the second (with a "bug") are debug and
the hammer are build.

Set config in debug for a "normal debug", in release are assembler debug :-D

Check menu "tools->git" for git integration options.

Rallaz
Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault in RS_EntityContainer::optimizeContours()

R. van Twisk
Administrator

On Apr 23, 2012, at 11:08 AM, Rallaz [via LibreCAD] wrote:

dxli wrote
make sure I add CXXFLAGS="-g" and not stripe the binary after compiling. I
run gdb manually to debug after that.
CONFIG += debug
simply add -g -O0 -Wall
and CONFIG += release  -O2

I wouldn't add -O2 because this depends a bit on the compiler and how good it can optimize.
so just leave that as CONFIG += release -O2 will properly be added for your environment.

Better yet, just do that one the command line like this: qmake librecad.pro -r CONFIG+=release

You can see what qmake is doing by checking you mkspec files within the Qt installation.

Qt Creator does a pretty nice job and as a IDE it might not be the best,
but it does have code completion, debugging and all that to get you started.

Ries

I may have to learn how to debug in qtcreator. I use qtcreator only as an
editor (class viewer) with fakevim mode.

Dongxu
see the screenshot attached by Ries:
the first green arrow are run, the second (with a "bug") are debug and
the hammer are build.

Set config in debug for a "normal debug", in release are assembler debug :-D

Check menu "tools->git" for git integration options.

Rallaz


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/Segmentation-fault-in-RS-EntityContainer-optimizeContours-tp5651061p5659783.html
To start a new topic under LibreCAD, email [hidden email]
To unsubscribe from LibreCAD, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault in RS_EntityContainer::optimizeContours()

Erik
Hello,

thanks to all.

What do you think about eclipse +cbt +egit +qt integration.

My first test are looking very well.

But I want to try Qt-Creator, too.

According to debugging, I used gdb in the past, too. Now I'm using mostly ddd the graphical frontend, because in my opion it's much more confortable.

Best Regards,

Erik
Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault in RS_EntityContainer::optimizeContours()

R. van Twisk
Administrator
Erik,

if you have the knowledge then you can use anything you like.

I use eclipse on a daily base myself (java + flex work) and it's not a bad IDE.
I am not sure how the GUI designers works in Ecli`se though, but you won't need that
very often. 
We only have to make sure that whatever we do, it needs to compile on Windows, OSX and Linux.
and that we use qmake to generate the makefiles.

Ries




On Apr 23, 2012, at 12:33 PM, Erik [via LibreCAD] wrote:

Hello,

thanks to all.

What do you think about eclipse +cbt +egit +qt integration.

My first test are looking very well.

But I want to try Qt-Creator, too.

According to debugging, I'm using gdb in the past, too. Now I'm using mostly ddd the graphical frontend, because in my opion it's muche more confortable.

Best Regards,

Erik


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/Segmentation-fault-in-RS-EntityContainer-optimizeContours-tp5651061p5660009.html
To start a new topic under LibreCAD, email [hidden email]
To unsubscribe from LibreCAD, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault in RS_EntityContainer::optimizeContours()

dxli
I feel we should try to generate UI more by C++ rather than by UI forms, because it's easier to maintain C++.

Quite often, a minor change in a UI form results in 90% change of the file, harder to track changes.

Dongxu

On Mon, Apr 23, 2012 at 1:59 PM, R. van Twisk [via LibreCAD] <[hidden email]> wrote:
Erik,

if you have the knowledge then you can use anything you like.

I use eclipse on a daily base myself (java + flex work) and it's not a bad IDE.
I am not sure how the GUI designers works in Ecli`se though, but you won't need that
very often. 
We only have to make sure that whatever we do, it needs to compile on Windows, OSX and Linux.
and that we use qmake to generate the makefiles.

Ries




On Apr 23, 2012, at 12:33 PM, Erik [via LibreCAD] wrote:

Hello,

thanks to all.

What do you think about eclipse +cbt +egit +qt integration.

My first test are looking very well.

But I want to try Qt-Creator, too.

According to debugging, I'm using gdb in the past, too. Now I'm using mostly ddd the graphical frontend, because in my opion it's muche more confortable.

Best Regards,

Erik


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/Segmentation-fault-in-RS-EntityContainer-optimizeContours-tp5651061p5660009.html
To start a new topic under LibreCAD, email [hidden email]
To unsubscribe from LibreCAD, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/Segmentation-fault-in-RS-EntityContainer-optimizeContours-tp5651061p5660069.html
To start a new topic under LibreCAD-dev, email [hidden email]
To unsubscribe from LibreCAD-dev, click here.
NAML



--
Dongxu Li, Ph.D.
www.librecad.org

Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault in RS_EntityContainer::optimizeContours()

R. van Twisk
Administrator

On Apr 23, 2012, at 1:31 PM, dxli [via LibreCAD] wrote:

I feel we should try to generate UI more by C++ rather than by UI forms, because it's easier to maintain C++.

Quite often, a minor change in a UI form results in 90% change of the file, harder to track changes.

I know we are getting OT here.

In my experience UI work is only a very small part of the total development time of a application.
However, when a UI was build programmatically you can get into a lot of re-compile and test stages because
you cannot always see the UI and of the underlaying framework responds to the changes you make.

Additionally, little changes in the UI, even build programmatically can also result in a larger set of changes,
eg, not only the XY/Y position of the button changes.

For example when you move a button from one area to a other area, you will see multiple lines being changed. 
You would need to move code around and put the button in a different area of your program.
Given ofcourse you build the UI with proer spacers and 'fluid' rater then fixed positions.

Within QT a UI is build within .ui file that get's compiled into a cpp+h file. However, any change in
the UI file doesn't get reflected into the program separating the concerns of UI (view) and program
even better. If a button is moved we really don't care about how this was reflected in the UI file. We only
care about the bugtrack entry showing the reasons. Our code would even stay exactly the same so
in my opinion, building the UI graphically, in our case with UI designer would be more of a benefit

Qt does have some very nice systems in place, see : http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
and even allows for auto-creating connections between the slots and the UI. This allows writing
even less code and plain simple this reduces maintenance.

Ries




Dongxu

On Mon, Apr 23, 2012 at 1:59 PM, R. van Twisk [via LibreCAD] <<a href="x-msg://297/user/SendEmail.jtp?type=node&amp;node=5660136&amp;i=0" target="_top" rel="nofollow" link="external">[hidden email]> wrote:
Erik,

if you have the knowledge then you can use anything you like.

I use eclipse on a daily base myself (java + flex work) and it's not a bad IDE.
I am not sure how the GUI designers works in Ecli`se though, but you won't need that
very often. 
We only have to make sure that whatever we do, it needs to compile on Windows, OSX and Linux.
and that we use qmake to generate the makefiles.

Ries




On Apr 23, 2012, at 12:33 PM, Erik [via LibreCAD] wrote:

Hello,

thanks to all.

What do you think about eclipse +cbt +egit +qt integration.

My first test are looking very well.

But I want to try Qt-Creator, too.

According to debugging, I'm using gdb in the past, too. Now I'm using mostly ddd the graphical frontend, because in my opion it's muche more confortable.

Best Regards,

Erik


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/Segmentation-fault-in-RS-EntityContainer-optimizeContours-tp5651061p5660009.html
To start a new topic under LibreCAD, email [hidden email]
To unsubscribe from LibreCAD, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/Segmentation-fault-in-RS-EntityContainer-optimizeContours-tp5651061p5660069.html
To start a new topic under LibreCAD-dev, email <a href="x-msg://297/user/SendEmail.jtp?type=node&amp;node=5660136&amp;i=1" target="_top" rel="nofollow" link="external">[hidden email]
To unsubscribe from LibreCAD-dev, <a href="x-msg://297/" target="_blank" rel="nofollow" link="external">click here.
NAML



--
Dongxu Li, Ph.D.
www.librecad.org




If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/Segmentation-fault-in-RS-EntityContainer-optimizeContours-tp5651061p5660136.html
To start a new topic under LibreCAD, email [hidden email]
To unsubscribe from LibreCAD, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault in RS_EntityContainer::optimizeContours()

Erik
First I want to say thank you very much for the good tips. I played with Qt-creator, and I must say it's a very comfortable IDE. On playing with it I implement a new feature to filter the layer list for a better overview and much more comfort. (see my pull-request) ;-)

According the ui - In my opinion all ui-designer are very good for making very fast gui-projects, and learn much about e.g. Qt. But for maintenance c++ code is much better, because of my experience if you've only small changes, its good, but with bigger changes its very tough to handle your own handling code.

Best Regards,

Erik  
Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault in RS_EntityContainer::optimizeContours()

dxli
Hi Erik,

I tested and merged the pull requests.

Related to the layer widget, there's a very interesting feature request: provide a way to reorder layers. https://sourceforge.net/tracker/?func=detail&aid=3492292&group_id=342582&atid=1433847

Ideally, user should be able to control the drawing order of all entities. A partial but neat solution is by user access of the drawing order of layers.

Best Regards,

Dongxu

On Sat, Apr 28, 2012 at 5:58 AM, Erik [via LibreCAD] <[hidden email]> wrote:
First I want to say thank you very much for the good tips. I played with Qt-creator, and I must say it's a very comfortable IDE. On playing with it I implement a new feature to filter the layer list for a better overview and much more comfort. (see my pull-request) ;-)

According the ui - In my opinion all ui-designer are very good for making very fast gui-projects, and learn much about e.g. Qt. But for maintenance c++ code is much better, because of my experience if you've only small changes, its good, but with bigger changes its very tough to handle your own handling code.

Best Regards,

Erik  


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/Segmentation-fault-in-RS-EntityContainer-optimizeContours-tp5651061p5672384.html
To start a new topic under LibreCAD-dev, email [hidden email]
To unsubscribe from LibreCAD-dev, click here.
NAML



--
Dongxu Li, Ph.D.
www.librecad.org