void hdLineConnection::addPoint (int posIdx, int x, int y) { willChange(); points[posIdx]->addItem((hdObject *) new hdPoint(x, y) ); //Update handles if(points[posIdx]->count() == 1) { //first point add start handle if(handles->count() == 0) handles->addItem(getStartHandle()); } else if(points[posIdx]->count() == 2) { //second point add end handle if(handles->count() == 1) handles->addItem(getEndHandle()); } else if(points[posIdx]->count() > 2) { //Locate maximum index if there is need for one new handle then added it if( getMaximunIndex() > handles->count() ) { //third and above point, add a polylinehandle before end handle handles->insertAtIndex(new hdPolyLineHandle(this, new hdPolyLineLocator(0), 0), handles->count() - 1); } } updateHandlesIndexes(); changed(posIdx); }
void ddLineConnection::addPoint (int x, int y){ willChange(); points->addItem((ddObject *) new ddPoint(x,y) ); //Update handles if(points->count()==1) { //first point add start handle handles->addItem(getStartHandle()); } else if(points->count()==2) { //second point add end handle handles->addItem(getEndHandle()); } else if(points->count()>2) { //third and above point, add a polylinehandle before end handle handles->insertAtIndex(new ddPolyLineHandle(this, new ddPolyLineLocator(0), 0),handles->count()-1); } updateHandlesIndexes(); changed(); }