本文整理汇总了C++中GraphicObject类的典型用法代码示例。如果您正苦于以下问题:C++ GraphicObject类的具体用法?C++ GraphicObject怎么用?C++ GraphicObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GraphicObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prototype
void RoutePlanner::activateDebugDraw(bool activate) {
if (activate) {
debugGraphicObject = GraphicEngine::getInstance()->createObject(getId());
std::list<RouteNode*> nodes = map.getItems();
for (std::list<RouteNode*>::iterator i = nodes.begin(); i != nodes.end(); i++) {
//Draw node
RouteNode* node = *i;
GraphicObject* object = debugGraphicObject->createChild(WasVec3d(node->position.x, 0, -node->position.y));
object->scale(WasVec3d(0.5, 0.5, 0.5));
Entity* entity = object->createEntity(PT_CUBE);
entity->setColor(ColourValue::BLUE);
//Draw paths
Vertex v1 = {node->position.x, 0, -node->position.y};
for (std::map<int, int>::iterator j = node->routeMap.begin(); j != node->routeMap.end(); j++) {
if (j->first == j->second) {
MeshPrototype prototype(WASABI_LINES);
Face face;
Vertex v2 = {getNode(j->first)->position.x, 0, - getNode(j->first)->position.y};
face.addVertex(v1);
face.addVertex(v2);
prototype.addFace(face);
Entity* entity = debugGraphicObject->createEntity(prototype);
entity->setColor(ColourValue::BLUE);
}
}
}
} else if (debugGraphicObject != NULL) {
GraphicEngine::getInstance()->destroyObject(debugGraphicObject);
}
debugDraw = activate;
}
示例2: getObject
GraphicObject* GraphicUndoUtilities::getObject(const GraphicGroup* pGroup, const string& objectId)
{
if ((pGroup == NULL) || (objectId.empty() == true))
{
return NULL;
}
const list<GraphicObject*>& objects = pGroup->getObjects();
for (list<GraphicObject*>::const_iterator iter = objects.begin(); iter != objects.end(); ++iter)
{
GraphicObject* pObject = *iter;
if (pObject != NULL)
{
if (pObject->getId() == objectId)
{
return pObject;
}
}
GraphicGroup* pChildGroup = dynamic_cast<GraphicGroup*>(*iter);
if (pChildGroup != NULL)
{
GraphicObject* pGroupObject = getObject(pChildGroup, objectId);
if (pGroupObject != NULL)
{
return pGroupObject;
}
}
}
return NULL;
}
示例3: Create
GraphicObject* GraphicPencil::Create(CPoint point, COLORREF c, int thickness, int pattern) {
GraphicObject* pencil = new GraphicPencil;
pencil->AddPoint(point);
pencil->setColor(c);
pencil->setThickness(thickness);
pencil->setPattern(pattern);
return pencil;
}
示例4: while
// -----------------------------------------------------------------
// Name : getNextObjectAt
// -----------------------------------------------------------------
MapObject * Map::getNextObjectAt(int x, int y, u32 type)
{
GraphicObject * pObj = (GraphicObject*) m_pTiles[x][y]->m_pMapObjects->getNext(0);
while (pObj != NULL)
{
if (pObj->getType() & type)
return (MapObject*) pObj;
pObj = (GraphicObject*) m_pTiles[x][y]->m_pMapObjects->getNext(0);
}
return NULL;
}
示例5: ungroup
void GroupUngroupGraphicObjects::ungroup()
{
GraphicLayer* pLayer = dynamic_cast<GraphicLayer*>(getSessionItem());
if ((pLayer != NULL) && (mGroupId.empty() == false))
{
string viewId;
View* pView = pLayer->getView();
if (pView != NULL)
{
viewId = pView->getId();
}
GraphicGroup* pGroup = dynamic_cast<GraphicGroup*>(GraphicUndoUtilities::getObject(viewId,
pLayer->getId(), mGroupId));
if (pGroup != NULL)
{
list<GraphicObject*> selectedObjects;
pLayer->getSelectedObjects(selectedObjects);
pLayer->deselectAllObjects();
pLayer->selectObject(pGroup);
pLayer->ungroupSelection();
list<GraphicObject*> objects;
pLayer->getSelectedObjects(objects);
mObjectIds.clear();
for (list<GraphicObject*>::iterator iter = objects.begin(); iter != objects.end(); ++iter)
{
GraphicObject* pObject = *iter;
if (pObject != NULL)
{
string objectId = pObject->getId();
if (objectId.empty() == false)
{
mObjectIds.push_back(objectId);
}
}
}
for (list<GraphicObject*>::iterator iter = selectedObjects.begin(); iter != selectedObjects.end(); ++iter)
{
GraphicObject* pObject = *iter;
if ((pObject != NULL) && (pObject != pGroup))
{
pLayer->selectObject(pObject);
}
}
}
}
}
示例6: ProcessRange
/**
* @inheritDoc
*/
void GraphicScene::ProcessRange(u32 begin, u32 end) {
auto start = m_pObjects.begin() + begin;
for (auto iterator = start; iterator < start + end; iterator++) {
GraphicObject* pObject = static_cast<GraphicObject*>(iterator->second);
// Update objects based on paused state
// TODO maybe not pause some objects ?
if (!m_bPause) {
// Process this object
pObject->Update(m_fDeltaTime);
}
}
}
示例7:
QList<core::GraphicObject *> core::Connector::removeIgnoredObjects(const QList<GraphicObject *> &list) const
{
GraphicObject *obj;
QList<GraphicObject*> returnedList = list;
for(auto i = 0; i < returnedList.size(); i++){
obj = returnedList[i];
if(obj->type() == gotConnector || obj == beginObject){
returnedList.removeOne(obj);
i--;
}
}
return returnedList;
}
示例8: addFadeAnimation
// Adds a fade in animation
// lower numerical value for priority means a higher priority
void Animator::addFadeAnimation (GraphicObject &object, int time, int priority,
float startAlpha, float endAlpha) {
Animation newAnimation;
newAnimation.time = time;
// Alpha changes
newAnimation.startAlpha = startAlpha;
newAnimation.endAlpha = endAlpha;
// Position changeos
newAnimation.startX = object.getX ();
newAnimation.startY = object.getY ();
newAnimation.endX = object.getX ();
newAnimation.endY = object.getY ();
newAnimation.priority = priority;
newAnimation.timer.start ();
animationQueue.push (newAnimation);
}
示例9: createObject
void CreateDestroyGraphicObject::createObject()
{
if (mpClone == NULL)
{
return;
}
GraphicGroup* pGroup = dynamic_cast<GraphicGroup*>(getSessionItem());
if (pGroup != NULL)
{
string oldObjectId = mObjectId;
mObjectId.clear();
GraphicObject* pObject = pGroup->addObject(mpClone->getGraphicObjectType());
if (pObject != NULL)
{
mObjectId = pObject->getId();
GraphicObjectImp* pObjectImp = dynamic_cast<GraphicObjectImp*>(pObject);
if (pObjectImp != NULL)
{
pObjectImp->replicateObject(dynamic_cast<GraphicObject*>(mpClone));
}
if (mIndex != -1)
{
GraphicGroupImp* pGroupImp = dynamic_cast<GraphicGroupImp*>(pGroup);
if (pGroupImp != NULL)
{
GraphicLayerImp* pLayer = dynamic_cast<GraphicLayerImp*>(pGroupImp->getLayer());
if (pLayer != NULL)
{
pLayer->setObjectStackingIndex(pObject, mIndex);
}
}
}
}
emit sessionItemChanged(oldObjectId, mObjectId);
}
}
示例10: addSlideInAnimation
// Adds a slide in effect
void Animator::addSlideInAnimation (GraphicObject &object, int time, int priority,
int startX, int startY, int endX, int endY) {
Animation newAnimation;
newAnimation.time = time;
// Alpha changes
newAnimation.startAlpha = object.getAlpha();
newAnimation.endAlpha = object.getAlpha();
// Position changes
newAnimation.startX = startX;
newAnimation.startY = startY;
newAnimation.endX = endX;
newAnimation.endY = endY;
newAnimation.priority = priority;
newAnimation.timer.start ();
animationQueue.push (newAnimation);
}
示例11: UndoAction
GroupUngroupGraphicObjects::GroupUngroupGraphicObjects(GraphicLayer* pLayer, GraphicGroup* pGroup) :
UndoAction(pLayer)
{
if (pGroup != NULL)
{
const list<GraphicObject*>& objects = pGroup->getObjects();
for (list<GraphicObject*>::const_iterator iter = objects.begin(); iter != objects.end(); ++iter)
{
GraphicObject* pObject = *iter;
if (pObject != NULL)
{
string objectId = pObject->getId();
if (objectId.empty() == false)
{
mObjectIds.push_back(objectId);
}
}
}
mGroupId = pGroup->getId();
}
}
示例12: setViewPosition
void GameObject::setViewPosition( GraphicObject& obj,
const ProtoObject::View & v,
float x,
float y, float z) {
float dx = 0, dy = 0, dz = 0;
double modelSize[3] = { obj.bounds().max[0] - obj.bounds().min[0],
obj.bounds().max[1] - obj.bounds().min[1],
obj.bounds().max[2] - obj.bounds().min[2] };
const int * align = v.align;
double alignSize = v.alignSize;
dx = modelSize[0]*obj.sizeX()*align[0]*alignSize;
dy = modelSize[1]*obj.sizeY()*align[1]*alignSize;
dz = modelSize[2]*obj.sizeZ()*align[2]*alignSize;
obj.setPosition( x+dx, y+dy, z+dz );
}
示例13: getAttributeIndex
int ShapeFile::getAttributeIndex(const GraphicObject& graphicObject, const DynamicObject& dynObj) const
{
const string objectId = graphicObject.getId();
VERIFYRV(objectId.empty() == false, -1);
DataVariant idsVar = dynObj.getAttribute(graphicObjectIdAttrName);
vector<string> objectIds;
idsVar.getValue(objectIds);
for (vector<string>::size_type i = 0; i < objectIds.size(); ++i)
{
if (objectIds[i] == objectId)
{
return static_cast<int>(i);
}
}
return -1;
}
示例14: addGeoKeys
bool TiffDetails::addGeoKeys(TIFF* pOut, int width, int height, const SessionItem *pItem)
{
if ((pOut == NULL) || (width == 0) || (height == 0))
{
return false;
}
const View* pInputView = dynamic_cast<const View*>(pItem);
if (pInputView == NULL)
{
return false;
}
RasterElement* pGeoreferencedRaster = NULL; // First raster element we find with georeferencing information
const ProductView* pView = dynamic_cast<const ProductView*>(pInputView);
if (pView != NULL)
{
AnnotationLayer* pAnno = pView->getLayoutLayer();
if (pAnno == NULL)
{
return false;
}
/* NOTE: If we find more than one SpatialDataView with a georeferenced RasterElement, we will only provide
geo-data for the FIRST one - because two views could theoretically screw up the
geo-data if one is in Australia and the other in Canada.
*/
// get all the view objects
std::list<GraphicObject*> objs;
pAnno->getObjects(VIEW_OBJECT, objs);
// for every object, find the data set with a geocoord matrix
for (std::list<GraphicObject*>::iterator it = objs.begin(); it != objs.end(); ++it)
{
GraphicObject* pObj = *it;
if (pObj != NULL)
{
SpatialDataView* pSpView = dynamic_cast<SpatialDataView*>(pObj->getObjectView());
if (pSpView != NULL)
{
LayerList* pLayerList = pSpView->getLayerList();
if (pLayerList != NULL)
{
RasterElement* pRaster = pLayerList->getPrimaryRasterElement();
if (pRaster != NULL && pRaster->isGeoreferenced())
{
pGeoreferencedRaster = pRaster;
break;
}
}
}
}
}
}
const SpatialDataView* pSpView = dynamic_cast<const SpatialDataView*>(pInputView);
if (pSpView != NULL)
{
LayerList* pLayerList = pSpView->getLayerList();
if (pLayerList != NULL)
{
RasterElement* pRaster = pLayerList->getPrimaryRasterElement();
if (pRaster != NULL && pRaster->isGeoreferenced())
{
pGeoreferencedRaster = pRaster;
}
}
}
if (pGeoreferencedRaster == NULL)
{
return false;
}
GTIF* pGtif = GTIFNew(pOut);
if (pGtif == NULL)
{
return false;
}
LocationType lowerLeft;
LocationType upperLeft;
LocationType upperRight;
LocationType lowerRight;
pInputView->getVisibleCorners(lowerLeft, upperLeft, upperRight, lowerRight);
LocationType latLong;
//get the lat/long's (0,0)
latLong = pGeoreferencedRaster->convertPixelToGeocoord(upperLeft);
double ll1y = latLong.mY; //delta long
double ll1x = latLong.mX; //delta lat
latLong = pGeoreferencedRaster->convertPixelToGeocoord(upperRight);
double ll2y = latLong.mY; //long
double ll2x = latLong.mX; //lat
latLong = pGeoreferencedRaster->convertPixelToGeocoord(lowerLeft);
double ll3y = latLong.mY; //long
double ll3x = latLong.mX; //lat
//.........这里部分代码省略.........
示例15: progress
bool ChangeUpDirection::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
if (pInArgList == NULL || pOutArgList == NULL)
{
return false;
}
ProgressTracker progress(pInArgList->getPlugInArgValue<Progress>(Executable::ProgressArg()),
"Rotating data.", "app", "{11adadb9-c133-49de-8cf5-a16372da2578}");
RasterElement* pData = pInArgList->getPlugInArgValue<RasterElement>(Executable::DataElementArg());
if (pData == NULL)
{
progress.report("No data element specified.", 0, ERRORS, true);
return false;
}
bool display = false;
if (!pInArgList->getPlugInArgValue("Display Results", display))
{
progress.report("Unsure if results should be displayed. Invalid argument.", 0, ERRORS, true);
return false;
}
double rotation = 0.0;
SpatialDataView* pOrigView = NULL;
if (isBatch())
{
if (!pInArgList->getPlugInArgValue("Rotation", rotation))
{
progress.report("No rotation specified.", 0, ERRORS, true);
return false;
}
}
else
{
pOrigView = pInArgList->getPlugInArgValue<SpatialDataView>(Executable::ViewArg());
if (pOrigView == NULL)
{
progress.report("No view specified.", 0, ERRORS, true);
return false;
}
GraphicLayer* pLayer = dynamic_cast<GraphicLayer*>(pOrigView->getActiveLayer());
if (pLayer == NULL)
{
pLayer = dynamic_cast<GraphicLayer*>(pOrigView->getTopMostLayer(ANNOTATION));
}
GraphicObject* pArrow = NULL;
if (pLayer != NULL)
{
std::list<GraphicObject*> objects;
pLayer->getObjects(ARROW_OBJECT, objects);
if (!objects.empty())
{
pArrow = objects.back();
}
if (objects.size() > 1)
{
progress.report("Multiple arrow objects found. Using the most recently added one.", 0, WARNING, true);
}
}
if (pArrow == NULL)
{
progress.report("Unable to locate up direction. Add an arrow annotation and re-run this plugin.",
0, ERRORS, true);
return false;
}
LocationType ur = pArrow->getUrCorner();
LocationType ll = pArrow->getLlCorner();
double xlen = ur.mX - ll.mX;
double ylen = ur.mY - ll.mY;
// Initial rotatation value. The 90 degrees is due to the difference
// in the "0 point" (right vs. up). Also account for explicit rotation
// of the annotation object. Convert this to radians.
rotation = GeoConversions::convertDegToRad(90 + pArrow->getRotation());
// Determine a rotation adjustment based on the bounding box
rotation += atan2(ylen, xlen);
}
progress.report("Rotating data.", 10, NORMAL);
ModelResource<RasterElement> pRotated(pData->copyShallow(pData->getName() + "_rotated", pData->getParent()));
if (pRotated.get() == NULL)
{
progress.report("Unable to create destination raster element.", 0, ERRORS, true);
return false;
}
int defaultBadValue(0); // the rotate method will handle setting the default bad values into the rotated raster
if (!RasterUtilities::rotate(pRotated.get(), pData, rotation, defaultBadValue,
INTERP_NEAREST_NEIGHBOR, progress.getCurrentProgress(), &mAbort))
{
// error message already reported by rotate()
return false;
}
pOutArgList->setPlugInArgValue("Rotated Element", pRotated.get());
if (display)
{
SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(
Service<DesktopServices>()->createWindow(pRotated->getName(), SPATIAL_DATA_WINDOW));
SpatialDataView* pView = (pWindow == NULL) ? NULL : pWindow->getSpatialDataView();
//.........这里部分代码省略.........