本文整理汇总了C++中GraphicLayer类的典型用法代码示例。如果您正苦于以下问题:C++ GraphicLayer类的具体用法?C++ GraphicLayer怎么用?C++ GraphicLayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GraphicLayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UndoAction
AddVertices::AddVertices(MultipointObjectImp* pObject, const vector<LocationType>& oldVertices,
const vector<LocationType>& oldGeoVertices, const vector<LocationType>& newVertices,
const vector<LocationType>& newGeoVertices) :
UndoAction(dynamic_cast<SessionItem*>(pObject)),
mOldVertices(oldVertices),
mOldGeoVertices(oldGeoVertices),
mNewVertices(newVertices),
mNewGeoVertices(newGeoVertices)
{
if (pObject != NULL)
{
GraphicLayer* pLayer = pObject->getLayer();
if (pLayer != NULL)
{
View* pView = pLayer->getView();
if (pView != NULL)
{
mViewId = pView->getId();
}
mLayerId = pLayer->getId();
}
}
setText("Add Vertices");
}
示例2: getGeoreferenceElement
void ScaleBarObjectImp::updateAttachments()
{
if (mpGeoreference.get() == NULL)
{
const RasterElement* pGeoreference = getGeoreferenceElement();
if (pGeoreference != NULL)
{
mpGeoreference.reset(const_cast<RasterElement*>(pGeoreference));
mXgsd = GeoAlgorithms::getXaxisGSD(pGeoreference);
mNeedsLayout = true;
}
}
if (mpView.get() == NULL)
{
GraphicLayer* pLayer = getLayer();
if (pLayer != NULL)
{
PerspectiveView* pPerspectiveView = dynamic_cast<PerspectiveView*>(pLayer->getView());
if (pPerspectiveView != NULL)
{
mpView.reset(pPerspectiveView);
mNeedsLayout = true;
}
}
}
}
示例3: getLayer
void MeasurementObjectImp::updateGeoreferenceAttachment()
{
if (mpGeoreference.get() != NULL)
{
return;
}
RasterElement* pGeoreference = NULL;
// Must find Georeference through the view, since the GraphicElement is a root element.
GraphicLayer* pLayer = getLayer();
if (pLayer != NULL)
{
SpatialDataView* pView = dynamic_cast<SpatialDataView*>(pLayer->getView());
if (pView != NULL)
{
LayerList* pLayerList = pView->getLayerList();
VERIFYNRV(pLayerList != NULL);
pGeoreference = pLayerList->getPrimaryRasterElement();
}
}
if (pGeoreference != NULL && pGeoreference->isGeoreferenced())
{
mpGeoreference.reset(pGeoreference);
enableGeo();
generateGeoStrings();
}
}
示例4: getLocked
void FrameLabelObjectImp::updateAnimationList(bool force)
{
if (getAutoMode() == false)
{
return;
}
const bool wasLocked = getLocked();
if (force == true)
{
setLocked(false);
}
if (getLocked() == false)
{
View* pView = NULL;
GraphicLayer* pLayer = getLayer();
if (pLayer != NULL)
{
pView = pLayer->getView();
}
setAnimations(pView);
}
if (force == true)
{
setLocked(wasLocked);
}
}
示例5: linkInputLabels
void linkInputLabels()
{
GraphicLayer* layer = GraphicLayer::sharedLayer();
CCArray* children = layer->getChildren();
if(children != NULL)
{
for(int i = 0 ; i < children->count(); i++)
{
RawObject* child = (RawObject*)children->objectAtIndex(i);
//Force actualization of content size and fontSize after everything is loaded because the nodeToWorldTransform is only right after
if(isKindOfClass(child, InputLabel))
{
InputLabel* input = (InputLabel*)child;
child->getNode()->setContentSize(child->getNode()->getContentSize());
if(input->getOriginalInfos() != NULL)
{
((ui::EditBox*)child->getNode())->setFontSize(input->getOriginalInfos()->getFontSize());
}
}
if((isKindOfClass(child, InputLabel)) && child->getEventInfos()->objectForKey("LinkTo") != NULL && isKindOfClass(child->getEventInfos()->objectForKey("LinkTo"), CCString))
{
InputLabel* input = (InputLabel*)child;
if(input->getLinkTo() == NULL)
{
CCString* linkTo = (CCString*)child->getEventInfos()->objectForKey("LinkTo");
CCArray* matchs = layer->allObjectsWithName(linkTo);
for(long j = 0; j < matchs->count(); j++)
{
RawObject* match = (RawObject*)matchs->objectAtIndex(j);
if(isKindOfClass(match, LabelTTF))
{
input->setLinkTo((LabelTTF*)match);
j = matchs->count();
}
}
}
}
else if((isKindOfClass(child, DropDownList)) && child->getEventInfos()->objectForKey("LinkTo") != NULL && isKindOfClass(child->getEventInfos()->objectForKey("LinkTo"), CCString))
{
DropDownList* dropDownList = (DropDownList*)child;
if(dropDownList->getLinkTo() == NULL)
{
CCString* linkTo = (CCString*)child->getEventInfos()->objectForKey("LinkTo");
CCArray* matchs = layer->allObjectsWithName(linkTo);
for(long j = 0; j < matchs->count(); j++)
{
RawObject* match = (RawObject*)matchs->objectAtIndex(j);
if(isKindOfClass(match, LabelTTF))
{
dropDownList->setLinkTo((LabelTTF*)match);
j = matchs->count();
}
}
}
}
}
}
}
示例6: group
void GroupUngroupGraphicObjects::group()
{
GraphicLayer* pLayer = dynamic_cast<GraphicLayer*>(getSessionItem());
if (pLayer != NULL)
{
list<GraphicObject*> selectedObjects;
pLayer->getSelectedObjects(selectedObjects);
pLayer->deselectAllObjects();
for (list<string>::const_iterator iter = mObjectIds.begin(); iter != mObjectIds.end(); ++iter)
{
string objectId = *iter;
if (objectId.empty() == false)
{
string viewId;
View* pView = pLayer->getView();
if (pView != NULL)
{
viewId = pView->getId();
}
GraphicObject* pObject = GraphicUndoUtilities::getObject(viewId, pLayer->getId(), objectId);
if (pObject != NULL)
{
pLayer->selectObject(pObject);
}
}
}
pLayer->groupSelection();
list<GraphicObject*> newSelectedObjects;
pLayer->getSelectedObjects(newSelectedObjects);
VERIFYNRV(newSelectedObjects.size() == 1);
GraphicGroup* pGroup = dynamic_cast<GraphicGroup*>(newSelectedObjects.front());
VERIFYNRV(pGroup != NULL);
for (list<GraphicObject*>::iterator iter = selectedObjects.begin(); iter != selectedObjects.end(); ++iter)
{
GraphicObject* pObject = *iter;
if ((pObject != NULL) && (pGroup->hasObject(pObject) == false))
{
pLayer->selectObject(pObject);
}
}
string oldGroupId = mGroupId;
mGroupId = pGroup->getId();
emit sessionItemChanged(oldGroupId, mGroupId);
}
}
示例7: reorderZindex
void reorderZindex()
{
GraphicLayer* layer = GraphicLayer::sharedLayer();
CCArray* children = layer->getChildren();
if(children != NULL)
{
for(int i = 0 ; i < children->count(); i++)
{
RawObject* child = (RawObject*)children->objectAtIndex(i);
if(child->getZOrder() != 0)
{
layer->reorderChild(child, child->getZOrder());
}
}
}
}
示例8: toLayer
void GraphicLayerMemento::toLayer(Layer* pLayer) const
{
GraphicLayer* pGraphicLayer = dynamic_cast<GraphicLayer*>(pLayer);
if (pGraphicLayer != NULL)
{
GraphicElement* pElement = dynamic_cast<GraphicElement*>(pGraphicLayer->getDataElement());
if (pElement != NULL)
{
GraphicGroupImp* pGroup = dynamic_cast<GraphicGroupImp*>(pElement->getGroup());
if (pGroup != NULL)
{
pGroup->setLayer(pGraphicLayer);
}
}
}
}
示例9: 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);
}
}
}
}
}
示例10: getFont
QFont TextObjectImp::getScaledFont(double minSize, double maxSize)
{
QFont scaledFont = getFont();
GraphicLayer* pLayer = getLayer();
if (pLayer != NULL)
{
// Scale the point size
double pointSize = scaledFont.pointSizeF();
PerspectiveView* pPerspectiveView = dynamic_cast<PerspectiveView*>(pLayer->getView());
if (pPerspectiveView != NULL)
{
// Zoom percentage
double zoomPercent = pPerspectiveView->getZoomPercentage();
pointSize *= zoomPercent / 100.0;
// Product DPI
ProductView* pProductView = dynamic_cast<ProductView*>(pPerspectiveView);
if (pProductView != NULL)
{
int dpi = pProductView->getDpi();
pointSize *= dpi / 72.0;
}
}
// Restrict to the minimum size
if (minSize > 0.0)
{
pointSize = max(pointSize, minSize);
}
// Restrict to the maximum size
if (maxSize > 0.0)
{
pointSize = min(pointSize, maxSize);
}
// Set the scaled point size in the font
scaledFont.setPointSizeF(pointSize);
}
return scaledFont;
}
示例11: isKindOfClass
void Scene::onTouchMoved(Touch *touch, Event *pEvent)
{
//CCLOG("onTouchMoved started...");
if(linker->linkedObjectOf(touch) != NULL
&& isKindOfClass(linker->linkedObjectOf(touch), const Image))
{
Image* toggle = (Image*)linker->linkedObjectOf(touch);
GraphicLayer* layer = GraphicLayer::sharedLayer();
char *end = strrchr(toggle->getImageFile().c_str(), '-');
if(end && strcmp(end, "-on") == 0 && !layer->allObjectsAtPosition(Scene::touchPosition(touch))->containsObject(toggle))
{
this->switchButton(toggle, false);
}
}
for(GenericRecognizer* receiver : touchReceiversList)
{
receiver->onTouchMoved(touch, pEvent);
}
//CCLOG("onTouchMoved ended");
}
示例12: getSubstitutedText
void TextObjectImp::updateBoundingBox()
{
// Get the width and height of the bounding box in screen pixels based on the scaled text image size
int iWidth = 0;
int iHeight = 0;
string text = getSubstitutedText();
if (text.empty() == false)
{
QString strMessage = QString::fromStdString(text);
QFont scaledFont = getScaledFont();
int iMaxSize = 0;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &iMaxSize);
int iAlignment = getTextAlignment();
QFontMetrics ftMetrics(scaledFont);
QRect boundingBox = ftMetrics.boundingRect(0, 0, iMaxSize, iMaxSize,
iAlignment | Qt::TextWordWrap, strMessage);
iWidth = boundingBox.width();
iHeight = boundingBox.height();
}
// Get the current bounding box
LocationType llCorner = getLlCorner();
LocationType urCorner = getUrCorner();
// Use the lower left corner as the anchor and compute the data coordinate of the upper right corner
GraphicLayer* pLayer = getLayer();
if (pLayer != NULL)
{
// Compute the upper right coordinate
PerspectiveView* pView = dynamic_cast<PerspectiveView*>(pLayer->getView());
if (pView != NULL)
{
double zoomFactor = 100.0 / pView->getZoomPercentage();
double xScale = zoomFactor / pLayer->getXScaleFactor();
double yScale = zoomFactor / pLayer->getYScaleFactor();
urCorner.mX = llCorner.mX + (iWidth * xScale);
urCorner.mY = llCorner.mY + (iHeight * yScale);
}
if (dynamic_cast<OrthographicView*>(pLayer->getView()) != NULL)
{
double dScreenX = 0.0;
double dScreenY = 0.0;
pLayer->translateDataToScreen(llCorner.mX, llCorner.mY, dScreenX, dScreenY);
pLayer->translateScreenToData(dScreenX + iWidth, dScreenY + iHeight, urCorner.mX, urCorner.mY);
}
}
else
{
urCorner.mX = llCorner.mX + iWidth;
urCorner.mY = llCorner.mY + iHeight;
}
// Update the bounding box and selection handles
setBoundingBox(llCorner, urCorner);
updateHandles();
mUpdateBoundingBox = false;
}
示例13: 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();
//.........这里部分代码省略.........
示例14: getLlCorner
string MeasurementObjectImp::generateGeoStrings() const
{
LocationType llCorner = getLlCorner();
LocationType urCorner = getUrCorner();
LocationType llCornerLatLon;
LocationType urCornerLatLon;
bool unitsValid = false;
// Get lat lon coordinates and terrain raster
const RasterElement* pTerrain = NULL;
bool geoValid(false);
if (mpGeoreference.get() != NULL)
{
GraphicLayer* pLayer = getLayer();
if (pLayer != NULL)
{
SpatialDataView* pView = dynamic_cast<SpatialDataView*>(pLayer->getView());
if (pView != NULL)
{
LayerList* pLayerList = pView->getLayerList();
VERIFYRV(pLayerList != NULL, "");
VERIFYRV(pLayerList->getPrimaryRasterElement() == mpGeoreference.get(), "");
pTerrain = mpGeoreference->getTerrain();
Layer* pPrimaryRasterLayer = pLayerList->getLayer(RASTER, mpGeoreference.get());
if (pPrimaryRasterLayer != NULL)
{
pPrimaryRasterLayer->translateWorldToData(llCorner.mX, llCorner.mY, llCorner.mX, llCorner.mY);
pPrimaryRasterLayer->translateWorldToData(urCorner.mX, urCorner.mY, urCorner.mX, urCorner.mY);
}
}
}
if (mpGeoreference->isGeoreferenced())
{
bool llValid(false);
bool urValid(false);
llCornerLatLon = mpGeoreference->convertPixelToGeocoord(llCorner, false, &llValid);
urCornerLatLon = mpGeoreference->convertPixelToGeocoord(urCorner, false, &urValid);
geoValid = llValid && urValid;
}
}
mUsingInaccurateGeocoords = !geoValid;
unitsValid = geoValid;
//String Variables
string startLoc = "";
string endLoc = "";
string distance = "";
string bearing = "";
string distanceUnit = "";
GeoAlgorithms algs;
double distanceVal = 0;
double azimuthVal = 0;
// Create GeoPoint objects
LatLonPoint startLlPoint = llCornerLatLon;
LatLonPoint endLlPoint = urCornerLatLon;
UtmPoint startUtmPoint = startLlPoint;
UtmPoint endUtmPoint = endLlPoint;
MgrsPoint startMgrsPoint = startLlPoint;
MgrsPoint endMgrsPoint = endLlPoint;
// find elevations
double elevation1(0.0);
double elevation2(0.0);
if (pTerrain != NULL)
{
const RasterDataDescriptor* pDescriptor =
dynamic_cast<const RasterDataDescriptor*>(pTerrain->getDataDescriptor());
if (pDescriptor != NULL)
{
const vector<DimensionDescriptor>& activeRows = pDescriptor->getRows();
const vector<DimensionDescriptor>& activeColumns = pDescriptor->getColumns();
if ( llCorner.mY >= 0 && llCorner.mY < activeRows.size() &&
llCorner.mX >= 0 && llCorner.mX < activeColumns.size() &&
urCorner.mY >= 0 && urCorner.mY < activeRows.size() &&
urCorner.mX >= 0 && urCorner.mX < activeColumns.size() )
{
DimensionDescriptor llRowDim(activeRows[llCorner.mY]);
DimensionDescriptor llColumnDim(activeColumns[llCorner.mX]);
DimensionDescriptor urRowDim(activeRows[urCorner.mY]);
DimensionDescriptor urColumnDim(activeColumns[urCorner.mX]);
elevation1 = pTerrain->getPixelValue(llColumnDim, llRowDim, DimensionDescriptor(), COMPLEX_MAGNITUDE);
elevation2 = pTerrain->getPixelValue(urColumnDim, urRowDim, DimensionDescriptor(), COMPLEX_MAGNITUDE);
const Units* pElevationUnits = pDescriptor->getUnits();
if (pElevationUnits != NULL)
{
double scale = pElevationUnits->getScaleFromStandard();
elevation1 *= scale;
elevation2 *= scale;
}
}
}
}
//.........这里部分代码省略.........
示例15: getArcRegion
bool ArcObjectImp::hit(LocationType pixelCoord) const
{
int iStart = static_cast<int>(getStartAngle());
if (iStart < 0)
{
iStart--;
}
int iStop = static_cast<int>(getStopAngle());
if (iStop < 0)
{
iStop--;
}
if (iStart == iStop)
{
iStart = 0;
iStop = 360;
}
ArcRegion eArcRegion = getArcRegion();
DrawUtil::initializeCircle();
LocationType center = getCenter();
bool bHit = false;
// Filled area
FillStyle eFillStyle = getFillStyle();
if (eFillStyle != EMPTY_FILL)
{
int iSize = abs(iStop - iStart) + 1;
if (eArcRegion == ARC_CENTER)
{
iSize += 2;
}
else if (eArcRegion == ARC_CHORD)
{
iSize += 1;
}
double* pXVertices = new double[iSize];
double* pYVertices = new double[iSize];
int i = 0;
int iIndex = 0;
for (i = iStart, iIndex = 0; i <= iStop; i++, iIndex++)
{
LocationType arcPoint = getLocation(static_cast<double>(i));
pXVertices[iIndex] = arcPoint.mX;
pYVertices[iIndex] = arcPoint.mY;
}
if ((eArcRegion == ARC_CENTER) || (eArcRegion == ARC_CHORD))
{
if (eArcRegion == ARC_CENTER)
{
pXVertices[iSize - 2] = center.mX;
pYVertices[iSize - 2] = center.mY;
}
pXVertices[iSize - 1] = pXVertices[0];
pYVertices[iSize - 1] = pYVertices[0];
}
bHit = DrawUtil::isWithin(pixelCoord.mX, pixelCoord.mY, pXVertices, pYVertices, iSize);
delete [] pXVertices;
delete [] pYVertices;
}
// Line
if (bHit == false)
{
bool bLine = false;
bLine = getLineState();
if (bLine == true)
{
// Check the arc line
double size = 1.0;
GraphicLayer* pLayer = NULL;
pLayer = getLayer();
if (pLayer != NULL)
{
View* pView = pLayer->getView();
if (pView != NULL)
{
size = pView->getPixelSize(center, center);
}
size *= min(pLayer->getXScaleFactor(), pLayer->getYScaleFactor());
}
LocationType basePoint;
for (int i = iStart; i <= iStop; i++)
{
LocationType currentPoint = getLocation(static_cast<double>(i));
if (i != iStart)
{
//.........这里部分代码省略.........