/*! * \brief TextAnnotation::duplicate * Creates a duplicate of this object. */ void TextAnnotation::duplicate() { TextAnnotation *pTextAnnotation = new TextAnnotation("", false, mpGraphicsView); QPointF gridStep(mpGraphicsView->getCoOrdinateSystem()->getHorizontalGridStep(), mpGraphicsView->getCoOrdinateSystem()->getVerticalGridStep()); pTextAnnotation->setOrigin(mOrigin + gridStep); pTextAnnotation->setRotationAngle(mRotation); pTextAnnotation->initializeTransformation(); pTextAnnotation->setLineColor(getLineColor()); pTextAnnotation->setFillColor(getFillColor()); pTextAnnotation->setLinePattern(getLinePattern()); pTextAnnotation->setFillPattern(getFillPattern()); pTextAnnotation->setLineThickness(getLineThickness()); pTextAnnotation->setExtents(getExtents()); pTextAnnotation->setTextString(getTextString()); pTextAnnotation->setFontSize(getFontSize()); pTextAnnotation->setFontName(getFontName()); pTextAnnotation->setTextStyles(getTextStyles()); pTextAnnotation->setTextHorizontalAlignment(getTextHorizontalAlignment()); pTextAnnotation->drawCornerItems(); pTextAnnotation->setCornerItemsPassive(); pTextAnnotation->update(); mpGraphicsView->addClassAnnotation(); mpGraphicsView->setCanAddClassAnnotation(true); }
//virtual __BRTStreamType getStreamType ()const=0; virtual unsigned int getTotalSize() const { unsigned int ret=1; unsigned int dim=getDimension(); const unsigned int * extents = getExtents(); for (unsigned int i=0;i<dim;++i) { ret*=extents[i]; } return ret; }
AABB TexToolItem::getSelectedExtents() { AABB returnValue; // Add <self> to the resulting AABB if <self> is selected if (_selected) { returnValue.includeAABB(getExtents()); } // Cycle through all the children and include their AABB for (std::size_t i = 0; i < _children.size(); i++) { if (_children[i]->isSelected()) { returnValue.includeAABB(_children[i]->getExtents()); } } return returnValue; }
void BitmapAnnotation::duplicate() { BitmapAnnotation *pBitmapAnnotation = new BitmapAnnotation(mClassFileName, "", false, mpGraphicsView); QPointF gridStep(mpGraphicsView->getCoOrdinateSystem()->getHorizontalGridStep(), mpGraphicsView->getCoOrdinateSystem()->getVerticalGridStep()); pBitmapAnnotation->setOrigin(mOrigin + gridStep); pBitmapAnnotation->setRotationAngle(mRotation); pBitmapAnnotation->initializeTransformation(); pBitmapAnnotation->setExtents(getExtents()); pBitmapAnnotation->setFileName(getFileName()); pBitmapAnnotation->setImageSource(getImageSource()); pBitmapAnnotation->setImage(getImage()); pBitmapAnnotation->drawCornerItems(); pBitmapAnnotation->setCornerItemsPassive(); pBitmapAnnotation->update(); mpGraphicsView->addClassAnnotation(); mpGraphicsView->setCanAddClassAnnotation(true); }
std::pair<bool, Vector3> TerrainInfo::rayIntersects(const Ray& ray) const { AxisAlignedBox box = getExtents(); Vector3 point = ray.getOrigin(); Vector3 dir = ray.getDirection(); // first, does the ray start from inside the terrain extents? if (!box.contains(point)) { // not inside the box, so let's see if we are actually // colliding with it pair<bool, Real> res = ray.intersects(box); if (!res.first) return make_pair(false, Vector3::ZERO); // update point to the collision position point = ray.getPoint(res.second); } // now move along the ray until we intersect or leave the bounding box while (true) { // have we arived at or under the terrain height? // note that this approach means that ray queries from below won't work // correctly, but then again, that shouldn't be a usual case... float height = getHeightAt(point.x, point.z); if (point.y <= height) { point.y = height; return make_pair(true, point); } // move further... point += dir; // check if we are still inside the boundaries if (point.x < box.getMinimum().x || point.z < box.getMinimum().z || point.x > box.getMaximum().x || point.z > box.getMaximum().z) return make_pair(false, Vector3::ZERO); } }
void RectangleAnnotation::duplicate() { RectangleAnnotation *pRectangleAnnotation = new RectangleAnnotation("", false, mpGraphicsView); QPointF gridStep(mpGraphicsView->getCoOrdinateSystem()->getHorizontalGridStep(), mpGraphicsView->getCoOrdinateSystem()->getVerticalGridStep()); pRectangleAnnotation->setOrigin(mOrigin + gridStep); pRectangleAnnotation->setRotationAngle(mRotation); pRectangleAnnotation->initializeTransformation(); pRectangleAnnotation->setLineColor(getLineColor()); pRectangleAnnotation->setFillColor(getFillColor()); pRectangleAnnotation->setLinePattern(getLinePattern()); pRectangleAnnotation->setFillPattern(getFillPattern()); pRectangleAnnotation->setLineThickness(getLineThickness()); pRectangleAnnotation->setBorderPattern(getBorderPattern()); pRectangleAnnotation->setExtents(getExtents()); pRectangleAnnotation->setRadius(getRadius()); pRectangleAnnotation->drawCornerItems(); pRectangleAnnotation->setCornerItemsPassive(); pRectangleAnnotation->update(); mpGraphicsView->addClassAnnotation(); mpGraphicsView->setCanAddClassAnnotation(true); }
//******************************************************************** void PVFSProjector::project(BaseProgress * progress = NULL) throw(ProjectorException) { int mytid(0); //my pvm id int errorcode(0); //pvm error code PmeshLib::ProjectionMesh * pmesh(0); //projection mesh int counter(0); int scounter(0); try { if (!mcounters.size()) //must have a partition num { Projector::project(progress); return; } if (static_cast<unsigned int>(numofslaves) < mcounters.size()) { Projector::project(progress); return; } if (!fromprojection || !toprojection) //check for projection { throw ProjectorException(PROJECTOR_ERROR_UNKOWN); } pmesh = setupForwardPmesh(); //try setup the forward //pmesh getExtents(pmesh); //get the extents if(cache) //delete the cache { delete cache; cache = NULL; } setupOutput(outfile); //create the output file if (pmesh) //delete uneeded mesh { delete pmesh; pmesh = NULL; } //check the rank in MPI MPI_Comm_rank(MPI_COMM_WORLD, &mytid); if (mytid != 0) { //master must be rank zero throw ProjectorException(PROJECTOR_ERROR_UNKOWN); } if (errorcode == 0) { throw ProjectorException(PROJECTOR_ERROR_UNKOWN); } //figure out the mapping scounter = -1; for(counter = 1; counter <= numofslaves; ++counter) { if (counter % numofslaves/mcounters.size() == 0) ++scounter; membership[counter] = scounter; } //figure out the start stop stuff for(counter = 0; static_cast<unsigned int>(counter) < mcounters.size(); ++counter) { mcounters[counter] = counter*(newheight/mcounters.size()); mstop[counter] = (counter+1)*(newheight/mcounters.size()); } //set the last partition to the right size mstop[mcounters.size()-1] = newheight; projectPVFS(progress); } catch(...) { if (pmesh) delete pmesh; throw ProjectorException(PROJECTOR_ERROR_UNKOWN); } }