Example #1
0
void peano::applications::latticeboltzmann::blocklatticeboltzmann::forcerecords::BlockPosition::toString (std::ostream& out) const {
   out << "("; 
   out << "_blockPosition:[";
   for (int i = 0; i < DIMENSIONS-1; i++) {
      out << getBlockPosition(i) << ",";
   }
   out << getBlockPosition(DIMENSIONS-1) << "]";
   out <<  ")";
}
void QAndroidInputContext::updateCursorPosition()
{
    QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQueryThreadSafe();
    if (!query.isNull() && !m_blockUpdateSelection && !m_batchEditNestingLevel) {
        const int cursorPos = getAbsoluteCursorPosition(query);
        const int composeLength = m_composingText.length();

        //Q_ASSERT(m_composingText.isEmpty() == (m_composingTextStart == -1));
        if (m_composingText.isEmpty() != (m_composingTextStart == -1))
            qWarning() << "Input method out of sync" << m_composingText << m_composingTextStart;

        int realCursorPosition = cursorPos;
        int realAnchorPosition = cursorPos;

        int cpos = query->value(Qt::ImCursorPosition).toInt();
        int anchor = query->value(Qt::ImAnchorPosition).toInt();
        if (cpos != anchor) {
            if (!m_composingText.isEmpty()) {
                qWarning("Selecting text while preediting may give unpredictable results.");
                finishComposingText();
            }
            int blockPos = getBlockPosition(query);
            realCursorPosition = blockPos + cpos;
            realAnchorPosition = blockPos + anchor;
        }
        // Qt's idea of the cursor position is the start of the preedit area, so we maintain our own preedit cursor pos
        if (!m_composingText.isEmpty())
            realCursorPosition = realAnchorPosition = m_composingCursor;
        QtAndroidInput::updateSelection(realCursorPosition, realAnchorPosition,
                                        m_composingTextStart, m_composingTextStart + composeLength); // pre-edit text
    }
}
Example #3
0
ZIntCuboid ZBlockGrid::getBlockBox(const ZIntPoint &blockIndex) const
{
  ZIntCuboid cuboid;
  cuboid.setFirstCorner(getBlockPosition(blockIndex));
  cuboid.setSize(m_blockSize.getX(), m_blockSize.getY(), m_blockSize.getZ());

  return cuboid;
}
Example #4
0
vect3D getDragPosition(blockFace_struct* bf, vect3D o, vect3D v, vect3D los)
{
	if(!bf)return vect(0,0,0);
	vect3D n, ip;
	n=los;
	switch(bf->direction)
	{
		case 0: case 1: n.x=0; break;
		case 2: case 3: n.y=0; break;
		case 4: case 5: n.z=0; break;
	}
	n=normalize(n);
	if(!collideLinePlane(addVect(faceOrigin[bf->direction],getBlockPosition(bf->x,bf->y,bf->z)), n, o, v, &ip))return faceOrigin[bf->direction];
	return ip;
}
Example #5
0
peano::applications::latticeboltzmann::blocklatticeboltzmann::forcerecords::BlockPositionPacked peano::applications::latticeboltzmann::blocklatticeboltzmann::forcerecords::BlockPosition::convert() const{
   return BlockPositionPacked(
      getBlockPosition()
   );
}