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 hdPolyLineFigure::addPoint (int posIdx, int x, int y) { willChange(); points[posIdx]->addItem((hdObject *) new hdPoint(x, y) ); if( handles->count() < getMaximunIndex() ) { //Update handles handles->addItem(new hdPolyLineHandle(this, new hdPolyLineLocator(0), 0)); updateHandlesIndexes(); } changed(posIdx); }
void hdPolyLineFigure::insertPointAt (int posIdx, int index, int x, int y) { willChange(); points[posIdx]->insertAtIndex((hdObject *) new hdPoint(x, y), index); if( handles->count() < getMaximunIndex() ) { //Update handles handles->insertAtIndex(new hdPolyLineHandle(this, new hdPolyLineLocator(index), index), index); updateHandlesIndexes(); } changed(posIdx); }
void hdPolyLineFigure::removePointAt (int posIdx, int index) { willChange(); hdPoint *p = (hdPoint *) points[posIdx]->getItemAt(index); points[posIdx]->removeItemAt(index); delete p; //Update handles [If there are more handles than maximum points of a line in a view] if( handles->count() > getMaximunIndex() ) { handles->removeItemAt(index); 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(); }
void ddLineConnection::insertPointAt (int index, int x, int y) { willChange(); points->insertAtIndex((ddObject*) new ddPoint(x,y), index); //Update handles if(index==0) { //add a new handle "normal" for a point in next position 0,1 in 1... in 0 startHandle is not moved handles->insertAtIndex(new ddPolyLineHandle(this, new ddPolyLineLocator(index), index),1); } else if(index==(points->count()-1)) //last point { //add a new handle "normal" for a point in before last item position handles->insertAtIndex(new ddPolyLineHandle(this, new ddPolyLineLocator(index), index),(points->count()-1)); } else { //add handle at index handles->insertAtIndex(new ddPolyLineHandle(this, new ddPolyLineLocator(index), index),index); } updateHandlesIndexes(); changed(); }
void hdLineConnection::insertPointAt (int posIdx, int index, int x, int y) { willChange(); points[posIdx]->insertAtIndex((hdObject *) new hdPoint(x, y), index); //Update handles //Is there need of a new handle if is first point if(index == 0 && handles->count() == 0 ) { //add a new handle "normal" for a point in next position 0,1 in 1... in 0 startHandle is not moved handles->insertAtIndex(new hdPolyLineHandle(this, new hdPolyLineLocator(index), index), 1); } else if(index == (points[posIdx]->count() - 1) && handles->count() < getMaximunIndex() ) //last point { //add a new handle "normal" for a point in before last item position handles->insertAtIndex(new hdPolyLineHandle(this, new hdPolyLineLocator(index), index), (points[posIdx]->count() - 1)); } else if(handles->count() < getMaximunIndex()) { //add handle at index handles->insertAtIndex(new hdPolyLineHandle(this, new hdPolyLineLocator(index), index), index); } updateHandlesIndexes(); changed(posIdx); }