void Grid::insertPoint(size_t dim, unsigned int levels[], unsigned int indices[], bool isLeaf) { // create HashGridIndex object for the point GridIndex pointIndex(dim); for (unsigned int i = 0; i < dim - 1; i++) { pointIndex.push(i, levels[i], indices[i]); } // insert last level/index and hash pointIndex.set(dim - 1, levels[dim - 1], indices[dim - 1], isLeaf); // insert point to the GridStorage storage->insert(pointIndex); }
void FrameView::addShape( const QVector<QPoint>& Shape ) { for(qint16 pointIndex(0); pointIndex < Shape.size(); pointIndex++) { Qt::GlobalColor color(getPointColorByIndex(pointIndex+1)); QPen Pen(color); QList<QGraphicsItem*> pointGroupList; QGraphicsLineItem* line1(new QGraphicsLineItem(-POINT_SIZE, 0, POINT_SIZE, 0)); line1->setPen(Pen); pointGroupList.push_back(line1); QGraphicsLineItem* line2(new QGraphicsLineItem(0, -POINT_SIZE, 0, POINT_SIZE)); line2->setPen(Pen); pointGroupList.push_back(line2); QGraphicsTextItem* label(new QGraphicsTextItem(QString::number(pointIndex))); label->setDefaultTextColor(color); label->setFont(POINT_TEXT_FONT); label->setPos(-2*POINT_SIZE, -2.5f*POINT_SIZE); pointGroupList.push_back(label); QGraphicsItemGroup* pointGroup = Scene->createItemGroup(pointGroupList); pointGroup->setPos(QPointF(Shape[pointIndex]) * Scale); } }